KChart

KChartLeveyJenningsDiagram.h
1 /*
2  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef KCHARTLEVEYJENNINGSDIAGRAM_H
10 #define KCHARTLEVEYJENNINGSDIAGRAM_H
11 
12 #include "KChartLineDiagram.h"
13 #include "KChartLeveyJenningsCoordinatePlane.h"
14 
15 QT_BEGIN_NAMESPACE
16 class QPainter;
17 class QPolygonF;
18 class QSvgRenderer;
19 QT_END_NAMESPACE
20 
21 namespace KChart {
22 
23  class ThreeDLineAttributes;
24 
25 /**
26  * @brief LeveyDiagram defines a Levey Jennings chart.
27  *
28  * It provides different subtypes which are set using \a setType.
29  */
30 class KCHART_EXPORT LeveyJenningsDiagram : public LineDiagram
31 {
32  Q_OBJECT
33 
34  Q_DISABLE_COPY( LeveyJenningsDiagram )
35 // KCHART_DECLARE_PRIVATE_DERIVED_PARENT( LineDiagram, CartesianCoordinatePlane * )
36 
37  KCHART_DECLARE_DERIVED_DIAGRAM( LeveyJenningsDiagram, LeveyJenningsCoordinatePlane )
38 
39 
40 public:
41  explicit LeveyJenningsDiagram( QWidget* parent = nullptr, LeveyJenningsCoordinatePlane* plane = nullptr );
42  ~LeveyJenningsDiagram() override;
43 
44 
45  /**
46  * Creates an exact copy of this diagram.
47  */
48  LineDiagram * clone() const override;
49 
50  enum Symbol
51  {
52  OkDataPoint,
53  NotOkDataPoint,
54  LotChanged,
55  SensorChanged,
56  FluidicsPackChanged
57  };
58 
59  /**
60  * Returns true if both diagrams have the same settings.
61  */
62  bool compare( const LeveyJenningsDiagram* other ) const;
63 
64 
65  /**
66  * Sets the position of the lot change symbol to \a pos.
67  * Valid values are: Qt::AlignTop (default), Qt::AlignBottom.
68  */
69  void setLotChangedSymbolPosition( Qt::Alignment pos );
70 
71  /**
72  * Returns the position of the lot change symbol.
73  */
74  Qt::Alignment lotChangedSymbolPosition() const;
75 
76 
77  /**
78  * Sets the position of the fluidics pack changed symbol to \a pos.
79  * Valid values are: Qt::AlignBottom (default), Qt::AlignTop.
80  */
81  void setFluidicsPackChangedSymbolPosition( Qt::Alignment pos );
82 
83  /**
84  * Returns the position of the fluidics pack changed symbol.
85  */
86  Qt::Alignment fluidicsPackChangedSymbolPosition() const;
87 
88 
89  /**
90  * Sets the position of the sensor changed symbol to \a pos.
91  * Valid values are: Qt::AlignBottom (default), Qt::AlignTop.
92  */
93  void setSensorChangedSymbolPosition( Qt::Alignment pos );
94 
95  /**
96  * Returns the position of the sensor changed symbol.
97  */
98  Qt::Alignment sensorChangedSymbolPosition() const;
99 
100 
101  /**
102  * Sets the expected mean value over all QC values to \a meanValue.
103  */
104  void setExpectedMeanValue( float meanValue );
105 
106  /**
107  * Returns the expected mean values over all QC values.
108  */
109  float expectedMeanValue() const;
110 
111 
112  /**
113  * Sets the expected standard deviaction over all QC values to \a sd.
114  */
115  void setExpectedStandardDeviation( float sd );
116 
117  /**
118  * Returns the expected standard deviation over all QC values.
119  */
120  float expectedStandardDeviation() const;
121 
122 
123  /**
124  * Returns the calculated mean values over all QC values.
125  */
126  float calculatedMeanValue() const;
127 
128  /**
129  * Returns the calculated standard deviation over all QC values.
130  */
131  float calculatedStandardDeviation() const;
132 
133 
134  /**
135  * Sets the date/time of all fluidics pack changes to \a changes.
136  */
137  void setFluidicsPackChanges( const QVector< QDateTime >& changes );
138 
139  /**
140  * Returns the list of all fluidics pack changes.
141  */
142  QVector< QDateTime > fluidicsPackChanges() const;
143 
144 
145  /**
146  * Sets the date/time of all sensor changes to \a changes.
147  */
148  void setSensorChanges( const QVector< QDateTime >& changes );
149 
150  /**
151  * Returns the list of all sensor changes.
152  */
153  QVector< QDateTime > sensorChanges() const;
154 
155 
156  /**
157  * Sets the pen used for drawing the scan line to \a pen
158  */
159  void setScanLinePen( const QPen& pen );
160 
161  /**
162  * Returns the pen being used for drawing the scan line.
163  */
164  QPen scanLinePen() const;
165 
166 
167  /**
168  * Sets the symbol being used for \a symbol to a SVG file \a filename.
169  */
170  void setSymbol( Symbol symbol, const QString& filename );
171 
172  /**
173  * Returns the SVG file name usef for \a symbol
174  */
175  QString symbol( Symbol symbol ) const;
176 
177  /* \reimpl */
178  void setModel( QAbstractItemModel* model ) override;
179 
180 
181  /**
182  * Returns the timerange of the diagram's data.
183  */
184  QPair< QDateTime, QDateTime > timeRange() const;
185 
186  /**
187  * Sets the \a timeRange visible on the x axis. Set it to QPair< QDateTime, QDateTime >()
188  * to use the default auto calculation.
189  */
190  void setTimeRange( const QPair< QDateTime, QDateTime >& timeRange );
191 
192 protected:
193 
194  /** \reimpl */
195  void paint( PaintContext* paintContext ) override;
196 
197  /**
198  * Draws the fluidics pack and sensor changed symbols.
199  */
200  void drawChanges( PaintContext* paintContext );
201 
202 
203  /**
204  * Draws a data point symbol for the data point at \a pos.
205  * @param ok True, when the data point is ok, false otherwise (different symbol)
206  * @param ctx The PaintContext being used
207  * @param pos Position
208  * @param ok Draw as Ok or notOK data point
209  */
210  virtual void drawDataPointSymbol( PaintContext* paintContext, const QPointF& pos, bool ok );
211 
212  /**
213  * Draws a lot changed symbol for the data point at \a pos.
214  * @param ctx The PaintContext being used
215  * @param pos Position
216  * \sa lotChangedSymbolPosition
217  */
218  virtual void drawLotChangeSymbol( PaintContext* paintContext, const QPointF& pos );
219 
220  /**
221  * Draws a sensor changed symbol for the data point at \a pos.
222  * @param ctx The PaintContext being used
223  * @param pos Position
224  * \sa sensorChangedSymbolPosition
225  */
226  virtual void drawSensorChangedSymbol( PaintContext* paintContext, const QPointF& pos );
227 
228  /**
229  * Draws a fluidics pack changed symbol for the data point at \a pos.
230  * @param ctx The PaintContext being used
231  * @param pos Position
232  * \sa fluidicsPackChangedSymbolPosition
233  */
234  virtual void drawFluidicsPackChangedSymbol( PaintContext* paintContext, const QPointF& pos );
235 
236 
237  /**
238  * Returns the rectangle being used for drawing the icons
239  */
240  virtual QRectF iconRect() const;
241 
242 
243  /**
244  * Returns the SVG icon renderer for \a symbol
245  */
246  QSvgRenderer* iconRenderer( Symbol symbol );
247 
248  /* \reimpl */
249 
250  /** \reimpl */
251  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
252 
253 protected Q_SLOTS:
254  void calculateMeanAndStandardDeviation() const;
255 }; // End of class KChartLineDiagram
256 
257 }
258 
259 #endif // KCHARTLINEDIAGRAM_H
typedef Alignment
Class only listed here to document inheritance of some KChart classes.
Stores information about painting diagrams.
Levey Jennings coordinate plane This is actually nothing real more than a plain cartesian coordinate ...
LeveyDiagram defines a Levey Jennings chart.
LineDiagram defines a common line diagram.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Jul 1 2022 05:09:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.