JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtpfilledcurve.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3
4
5
6 This software is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License (LGPL) as published by
8 the Free Software Foundation, either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License (LGPL) for more details.
15
16 You should have received a copy of the GNU Lesser General Public License (LGPL)
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef jkqtpgraphsfilledcurve_H
21#define jkqtpgraphsfilledcurve_H
22
23
24#include "jkqtplotter/jkqtplotter_imexport.h"
25#include "jkqtplotter/jkqtpgraphsbase.h"
26#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
27#include "jkqtplotter/graphs/jkqtpspecialline.h"
28
29
30
31
32
33/** \brief a Base class for filled curve graphs like e.g. JKQTPFilledCurveXGraph
34 * \ingroup jkqtplotter_filledgraphs
35 *
36 * \image html filledgraphs.png
37 *
38 *
39 * \see JKQTPFilledCurveXGraph, JKQTPFilledCurveYGraph
40 */
42 Q_OBJECT
43public:
44 /** \brief specifies how the area below the graph is filled
45 *
46 * \see setFillMode(), getFillMode(), fillStyleBelow(), \ref JKQTPlotterWigglePlots
47 */
48 enum FillMode {
49 SingleFilling=0, /*!< \brief the whole area is filled with the same color/pattern, generates "simple filled plots", such as \image html filledgraphs_small.png */
50 TwoColorFilling=1 /*!< \brief the area above and below baseline with the two different colors/patterns, generates "wiggle plots", such as \image html wiggleplots_small.png */
51 };
52 Q_ENUM(FillMode)
53
54 /** \brief class constructor */
55 explicit JKQTPFilledCurveGraphBase(JKQTBasePlotter* parent=nullptr);
56
57 /** \brief returns the color to be used for the key label */
58 virtual QColor getKeyLabelColor() const override;
59 /** \brief plots a key marker inside the specified rectangle \a rect */
60 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
61 /** \copydoc m_fillStyleBelow */
62 JKQTPGraphFillStyleMixin& fillStyleBelow();
63 /** \copydoc m_fillStyleBelow */
64 const JKQTPGraphFillStyleMixin& fillStyleBelow() const;
65 /** \copydoc m_fillMode */
66 FillMode getFillMode() const;
67
68public Q_SLOTS:
69 /** \brief set line-color, fill color and symbol color */
70 void setColor(QColor c);
71 /** \copydoc m_fillMode */
72 void setFillMode(JKQTPFilledCurveGraphBase::FillMode mode);
73protected:
74 /** \brief specifies how the area of the graph is filles */
75 FillMode m_fillMode;
76 /** \brief if m_fillMode \c ==FillAboveAndBelowDifferently then this fill style is used below the baseline and
77 * the default fill style is used above */
78 JKQTPGraphFillStyleMixin m_fillStyleBelow;
79};
80
81
82
83/*! \brief This implements filled curve plots where the area is filled between the plot line and the x-Axis.
84 \ingroup jkqtplotter_filledgraphs
85
86 \image html JKQTPFilledCurveXGraph.png
87
88 \see \ref JKQTPlotterFilledGraphs
89
90 This class also provides the possibility to file above and below the baseline with different style.
91 Such plots are sometimes called "Wiggle Plots" and are often used (in their black/white-variety for seismographic
92 data plotting.
93
94 * \image html JKQTPFilledCurveXGraph_wiggle.png
95
96 To generate such a plot, used \c JKQTPFilledCurveXGraph::setFillMode(JKQTPFilledCurveXGraph::FillMode::TwoColorFilling)
97 and then use \c JKQTPFilledCurveXGraph::fillStyleBelow() to access the fill style for the area below the baseline
98 and the default fill style to define the fill style above the baseline.
99
100 \see \ref JKQTPlotterWigglePlots
101
102 */
104 Q_OBJECT
105 public:
106 /** \brief class constructor */
108 /** \brief class constructor */
110 /** \brief plots the graph to the plotter object specified as parent */
111 void draw(JKQTPEnhancedPainter &painter) override;
112
113 /** \brief get the maximum and minimum y-value of the graph
114 *
115 * The result is given in the two parameters which are call-by-reference parameters!
116 */
117 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
118
119};
120
121
122
123/*! \brief This implements filled curve plots with y errors where the area is filled between the plot line and the x-Axis.
124 \ingroup jkqtplotter_filledgraphs
125
126 \image html JKQTPFilledCurveXErrorGraph.png
127
128
129 \see \ref JKQTPlotterFilledGraphs, jkqtpstatAddXErrorFilledCurveGraph()
130 */
132 Q_OBJECT
133 public:
134 /** \brief class constructor */
136 /** \brief class constructor */
138 /** \copydoc JKQTPGraph::usesColumn() */
139 virtual bool usesColumn(int c) const override;
140 /** \brief get the maximum and minimum y-value of the graph
141 *
142 * The result is given in the two parameters which are call-by-reference parameters!
143 */
144 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
145
146
147 /** \copydoc JKQTPYGraphErrorData::yErrorSymmetric */
148 inline void setValueErrorSymmetric(bool __value) {
149 setYErrorSymmetric(__value);
150 }
151 /** \copydoc JKQTPYGraphErrorData::yErrorSymmetric */
152 inline bool getValueErrorSymmetric() const {
153 return getYErrorSymmetric();
154 }
155 /** \copydoc JKQTPYGraphErrorData::yErrorColumnLower */
156 inline int getValueErrorColumnLower() const {
157 return getYErrorColumnLower();
158 }
159 /** \copydoc JKQTPYGraphErrorData::yErrorColumn */
160 inline int getValueErrorColumn() const {
161 return getYErrorColumn();
162 }
163 /** \copydoc JKQTPYGraphErrorData::yErrorStyle */
165 setYErrorStyle(__value);
166 }
167 /** \copydoc JKQTPYGraphErrorData::yErrorStyle */
169 return getYErrorStyle();
170 }
171 /** \copydoc JKQTPYGraphErrorData::yErrorColumn */
172 inline void setValueErrorColumn(int __value) {
173 setYErrorColumn(__value);
174 }
175 /** \copydoc JKQTPYGraphErrorData::yErrorColumnLower */
176 inline void setValueErrorColumnLower(int __value) {
177 setYErrorColumnLower(__value);
178 }
179 protected:
180 /** \brief this function is used to plot error inidcators before plotting the graphs. */
181 virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override;
182
183};
184
185
186
187
188
189
190/*! \brief This implements filled curve plots where the area is filled between the plot line and y-Axis
191 \ingroup jkqtplotter_filledgraphs
192
193 \image html JKQTPFilledCurveYGraph.png
194
195 \see \ref JKQTPlotterFilledGraphs
196
197 This class also provides the possibility to file above and below the baseline with different style.
198 Such plots are sometimes called "Wiggle Plots" and are often used (in their black/white-variety for seismographic
199 data plotting.
200
201 * \image html JKQTPFilledCurveYGraph_wiggle.png
202
203 To generate such a plot, used \c JKQTPFilledCurveXGraph::setFillMode(JKQTPFilledCurveXGraph::FillMode::TwoColorFilling)
204 and then use \c JKQTPFilledCurveXGraph::fillStyleBelow() to access the fill style for the area below the baseline
205 and the default fill style to define the fill style above the baseline.
206
207 \see \ref JKQTPlotterWigglePlots
208
209 */
211 Q_OBJECT
212 public:
213 /** \brief class constructor */
215 /** \brief class constructor */
217
218 /** \copydoc JKQTPPlotElement::getXMinMax() */
219 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
220
221 /** \brief plots the graph to the plotter object specified as parent */
222 void draw(JKQTPEnhancedPainter &painter) override;
223 /** \brief returns the column used as "key" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
224 virtual int getKeyColumn() const override;
225 /** \brief returns the column used as "value" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
226 virtual int getValueColumn() const override;
227 public Q_SLOTS:
228 /** \brief sets the column used as "key" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
229 virtual void setKeyColumn(int __value) override;
230 /** \brief sets the column used as "value" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
231 virtual void setValueColumn(int __value) override;
232
233};
234
235
236
237/*! \brief This implements filled curve plots with y errors where the area is filled between the plot line and the x-Axis.
238 \ingroup jkqtplotter_filledgraphs
239
240 \image html JKQTPFilledCurveYErrorGraph.png
241
242 \see \ref JKQTPlotterFilledGraphs, jkqtpstatAddYErrorFilledCurveGraph()
243 */
245 Q_OBJECT
246 public:
247 /** \brief class constructor */
250 /** \copydoc JKQTPGraph::usesColumn() */
251 virtual bool usesColumn(int c) const override;
252
253 /** \copydoc JKQTPPlotElement::getXMinMax() */
254 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
255
256
257 /** \copydoc JKQTPXGraphErrorData::xErrorSymmetric */
258 inline void setValueErrorSymmetric(bool __value) {
259 setXErrorSymmetric(__value);
260 }
261 /** \copydoc JKQTPXGraphErrorData::xErrorSymmetric */
262 inline bool getValueErrorSymmetric() const {
263 return getXErrorSymmetric();
264 }
265 /** \copydoc JKQTPXGraphErrorData::xErrorColumnLower */
266 inline int getValueErrorColumnLower() const {
267 return getXErrorColumnLower();
268 }
269 /** \copydoc JKQTPXGraphErrorData::xErrorColumn */
270 inline int getValueErrorColumn() const {
271 return getXErrorColumn();
272 }
273 /** \copydoc JKQTPXGraphErrorData::xErrorStyle */
275 setXErrorStyle(__value);
276 }
277 /** \copydoc JKQTPXGraphErrorData::xErrorStyle */
279 return getXErrorStyle();
280 }
281 /** \copydoc JKQTPXGraphErrorData::xErrorColumn */
282 inline void setValueErrorColumn(int __value) {
283 setXErrorColumn(__value);
284 }
285 /** \copydoc JKQTPXGraphErrorData::xErrorColumnLower */
286 inline void setValueErrorColumnLower(int __value) {
287 setXErrorColumnLower(__value);
288 }
289 protected:
290 /** \brief this function is used to plot error inidcators before plotting the graphs. */
291 virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override;
292
293};
294
295
296
297
298
299
300
301/** \brief This implements filled curve plots where the area is filled between two data columns for each x-value
302 * \ingroup jkqtplotter_filledgraphs
303 *
304 * With \c setDrawlines(false):
305 *
306 * \image html JKQTPfilledVerticalRangeGraph.png
307 *
308 * With \c setDrawlines(true):
309 *
310 * \image html JKQTPfilledVerticalRangeGraph_WithLines.png
311 *
312 * \see JKQTPFilledHorizontalRangeGraph, \ref JKQTPlotterDateTimeAxes
313 */
315 Q_OBJECT
316public:
317 /** \brief class constructor */
319 /** \brief class constructor */
321
322 /** \brief plots the graph to the plotter object specified as parent */
323 virtual void draw(JKQTPEnhancedPainter& painter) override;
324 /** \brief plots a key marker inside the specified rectangle \a rect */
325 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
326 /** \brief returns the color to be used for the key label */
327 virtual QColor getKeyLabelColor() const override;
328
329
330protected:
331
332
333};
334
335
336
337
338
339
340
341/** \brief This implements filled curve plots where the area is filled between two data columns for each y-value
342 * \ingroup jkqtplotter_filledgraphs
343 *
344 * With \c setDrawlines(false):
345 *
346 * \image html JKQTPFilledHorizontalRangeGraph.png
347 *
348 * With \c setDrawlines(true):
349 *
350 * \image html JKQTPFilledHorizontalRangeGraph_WithLines.png
351 *
352 * \see JKQTPFilledVerticalRangeGraph, \ref JKQTPlotterDateTimeAxes
353 */
355 Q_OBJECT
356public:
357 /** \brief class constructor */
359 /** \brief class constructor */
361
362 /** \brief plots the graph to the plotter object specified as parent */
363 virtual void draw(JKQTPEnhancedPainter& painter) override;
364 /** \brief plots a key marker inside the specified rectangle \a rect */
365 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
366 /** \brief returns the color to be used for the key label */
367 virtual QColor getKeyLabelColor() const override;
368
369
370protected:
371
372
373};
374
375
376#endif // jkqtpgraphsfilledcurve_H
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
this class extends the QPainter
Definition jkqtpenhancedpainter.h:33
a Base class for filled curve graphs like e.g. JKQTPFilledCurveXGraph
Definition jkqtpfilledcurve.h:41
FillMode
specifies how the area below the graph is filled
Definition jkqtpfilledcurve.h:48
This implements filled curve plots with y errors where the area is filled between the plot line and t...
Definition jkqtpfilledcurve.h:131
void setValueErrorSymmetric(bool __value)
indicates whether the x-errors are symmetric (from one column only)
Definition jkqtpfilledcurve.h:148
void setValueErrorStyle(JKQTPErrorPlotstyle __value)
how to draw the errors (if available) of the x-value
Definition jkqtpfilledcurve.h:164
bool getValueErrorSymmetric() const
indicates whether the x-errors are symmetric (from one column only)
Definition jkqtpfilledcurve.h:152
virtual void drawErrorsAfter(JKQTPEnhancedPainter &painter) override
this function is used to plot error inidcators before plotting the graphs.
void setValueErrorColumn(int __value)
the column that contains the error of the x-component of the datapoints
Definition jkqtpfilledcurve.h:172
int getValueErrorColumnLower() const
the column that contains the error of the x-component of the datapoints. This is used as the lower er...
Definition jkqtpfilledcurve.h:156
int getValueErrorColumn() const
the column that contains the error of the x-component of the datapoints
Definition jkqtpfilledcurve.h:160
JKQTPFilledCurveXErrorGraph(JKQTPlotter *parent)
class constructor
JKQTPErrorPlotstyle getValueErrorStyle() const
how to draw the errors (if available) of the x-value
Definition jkqtpfilledcurve.h:168
void setValueErrorColumnLower(int __value)
the column that contains the error of the x-component of the datapoints. This is used as the lower er...
Definition jkqtpfilledcurve.h:176
virtual bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
virtual bool usesColumn(int c) const override
returns true if the given column is used by the graph
JKQTPFilledCurveXErrorGraph(JKQTBasePlotter *parent=nullptr)
class constructor
This implements filled curve plots where the area is filled between the plot line and the x-Axis.
Definition jkqtpfilledcurve.h:103
JKQTPFilledCurveXGraph(JKQTBasePlotter *parent=nullptr)
class constructor
void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
JKQTPFilledCurveXGraph(JKQTPlotter *parent)
class constructor
virtual bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
This implements filled curve plots with y errors where the area is filled between the plot line and t...
Definition jkqtpfilledcurve.h:244
bool getValueErrorSymmetric() const
indicates whether the x-errors are symmetric (from one column only)
Definition jkqtpfilledcurve.h:262
void setValueErrorColumn(int __value)
the column that contains the error of the x-component of the datapoints
Definition jkqtpfilledcurve.h:282
virtual bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
virtual void drawErrorsAfter(JKQTPEnhancedPainter &painter) override
this function is used to plot error inidcators before plotting the graphs.
int getValueErrorColumnLower() const
the column that contains the error of the x-component of the datapoints. This is used as the lower er...
Definition jkqtpfilledcurve.h:266
void setValueErrorStyle(JKQTPErrorPlotstyle __value)
how to draw the errors (if available) of the x-value
Definition jkqtpfilledcurve.h:274
void setValueErrorSymmetric(bool __value)
indicates whether the x-errors are symmetric (from one column only)
Definition jkqtpfilledcurve.h:258
JKQTPFilledCurveYErrorGraph(JKQTBasePlotter *parent=nullptr)
class constructor
void setValueErrorColumnLower(int __value)
the column that contains the error of the x-component of the datapoints. This is used as the lower er...
Definition jkqtpfilledcurve.h:286
JKQTPErrorPlotstyle getValueErrorStyle() const
how to draw the errors (if available) of the x-value
Definition jkqtpfilledcurve.h:278
int getValueErrorColumn() const
the column that contains the error of the x-component of the datapoints
Definition jkqtpfilledcurve.h:270
JKQTPFilledCurveYErrorGraph(JKQTPlotter *parent)
virtual bool usesColumn(int c) const override
returns true if the given column is used by the graph
This implements filled curve plots where the area is filled between the plot line and y-Axis.
Definition jkqtpfilledcurve.h:210
virtual void setKeyColumn(int __value) override
sets the column used as "key" for the current graph (typically this call setXColumn(),...
virtual void setValueColumn(int __value) override
sets the column used as "value" for the current graph (typically this call setXColumn(),...
virtual int getValueColumn() const override
returns the column used as "value" for the current graph (typically this call getXColumn(),...
virtual int getKeyColumn() const override
returns the column used as "key" for the current graph (typically this call getXColumn(),...
JKQTPFilledCurveYGraph(JKQTPlotter *parent)
class constructor
virtual bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
JKQTPFilledCurveYGraph(JKQTBasePlotter *parent=nullptr)
class constructor
void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
This implements filled curve plots where the area is filled between two data columns for each y-value...
Definition jkqtpfilledcurve.h:354
virtual void drawKeyMarker(JKQTPEnhancedPainter &painter, const QRectF &rect) override
plots a key marker inside the specified rectangle rect
JKQTPFilledHorizontalRangeGraph(JKQTBasePlotter *parent=nullptr)
class constructor
JKQTPFilledHorizontalRangeGraph(JKQTPlotter *parent)
class constructor
virtual QColor getKeyLabelColor() const override
returns the color to be used for the key label
virtual void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
This implements filled curve plots where the area is filled between two data columns for each x-value...
Definition jkqtpfilledcurve.h:314
virtual void drawKeyMarker(JKQTPEnhancedPainter &painter, const QRectF &rect) override
plots a key marker inside the specified rectangle rect
JKQTPFilledVerticalRangeGraph(JKQTBasePlotter *parent=nullptr)
class constructor
virtual QColor getKeyLabelColor() const override
returns the color to be used for the key label
virtual void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
JKQTPFilledVerticalRangeGraph(JKQTPlotter *parent)
class constructor
This Mix-In class provides setter/getter methods, storage and other facilities for the graph filling ...
Definition jkqtpgraphsbasestylingmixins.h:529
This Mix-In class provides setter/getter methods, storage and other facilities for the graph line and...
Definition jkqtpgraphsbasestylingmixins.h:595
This class is the base class for graphs that only display error indicators in x-direction.
Definition jkqtpgraphsbaseerrors.h:299
This virtual JKQTPGraph descendent extends JKQTPXYGraph to two columns for x-values (e....
Definition jkqtpgraphsbase.h:812
This virtual JKQTPGraph descendent extends JKQTPXYGraph adds a baseline-property, which is necessary,...
Definition jkqtpgraphsbase.h:712
This virtual JKQTPGraph descendent extends JKQTPXYGraph to two columns for y-values (e....
Definition jkqtpgraphsbase.h:754
This class is the base class for graphs that only display error indicators in y-direction.
Definition jkqtpgraphsbaseerrors.h:323
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
QFlags< JKQTPErrorPlotstyleElements > JKQTPErrorPlotstyle
specifies the plot styles for the error information, e.g. error bars, boxes, lines ....
Definition jkqtptools.h:728
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89