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
jkqtprange.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#ifndef jkqtpgraphsrange_H
20#define jkqtpgraphsrange_H
21
22
23#include <QString>
24#include <QPainter>
25#include <QPair>
26#include "jkqtplotter/jkqtptools.h"
27#include "jkqtplotter/jkqtplotter_imexport.h"
28#include "jkqtcommon/jkqtpdrawingtools.h"
29#include "jkqtplotter/jkqtpgraphsbase.h"
30#include "jkqtcommon/jkqtpenhancedpainter.h"
31#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
32#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
33
34// forward declarations
35class JKQTBasePlotter;
36class JKQTPlotter;
38class JKQTPDatastore;
39//class JKQTPColorPaletteStyleAndToolsMixin;
40
41
42
43
44
45
46
47/** \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
48 * or a range of interest, or the range of good values, ...
49 * \ingroup jkqtplotter_annotations
50 *
51 * \image html JKQTPRangeBase.png
52 *
53 * You can also invert the range, i.e. everything outside the range will be filled (\c setInvertedRange() ):
54 *
55 * \image html JKQTPRangeBase_Inverted.png
56 */
58 Q_OBJECT
59 public:
60 /** \brief class constructor */
62
63
64 /** \brief returns the color to be used for the key label */
65 virtual QColor getKeyLabelColor() const override;
66
67
68 /** \copydoc centerColor */
69 QColor getCenterColor() const;
70 /** \copydoc centerStyle */
71 Qt::PenStyle getCenterStyle() const;
72 /** \copydoc centerLineWidth */
73 void setCenterLineWidth(double __value);
74 /** \copydoc centerLineWidth */
75 double getCenterLineWidth() const;
76 /** \copydoc rangeMin */
77 double getRangeMin() const;
78 /** \copydoc rangeMax */
79 double getRangeMax() const;
80 /** \copydoc sizeMin */
81 double getSizeMin() const;
82 /** \copydoc sizeMax */
83 double getSizeMax() const;
84 /** \copydoc unlimitedSizeMin */
85 bool getUnlimitedSizeMin() const;
86 /** \copydoc unlimitedSizeMax */
87 bool getUnlimitedSizeMax() const;
88
89 /** \copydoc rangeCenter */
90 double getRangeCenter() const;
91 /** \copydoc plotCenterLine */
92 bool getPlotCenterLine() const;
93 /** \copydoc invertedRange */
94 bool getInvertedRange() const;
95 /** \copydoc plotRange */
96 bool getPlotRange() const;
97 /** \copydoc fillRange */
98 bool getFillRange() const;
99 /** \copydoc plotRangeLines */
100 bool getPlotRangeLines() const;
101 public Q_SLOTS:
102 /** \brief set the color of the graph (all lines and filling) */
103 virtual void setColor(QColor c);
104
105 /** \brief disables all drawing features except the centerline */
107 /** \copydoc centerColor */
108 void setCenterColor(const QColor & __value);
109 /** \copydoc centerStyle */
110 void setCenterStyle(Qt::PenStyle __value);
111 /** \copydoc plotRangeLines */
112 void setPlotRangeLines(bool __value);
113 /** \copydoc fillRange */
114 void setFillRange(bool __value);
115 /** \copydoc plotRange */
116 void setPlotRange(bool __value);
117 /** \copydoc invertedRange */
118 void setInvertedRange(bool __value);
119 /** \copydoc rangeCenter */
120 void setRangeCenter(double __value);
121 /** \copydoc plotCenterLine */
122 void setPlotCenterLine(bool __value);
123 /** \copydoc unlimitedSizeMax */
124 void setUnlimitedSizeMax(bool __value);
125 /** \copydoc unlimitedSizeMin */
126 void setUnlimitedSizeMin(bool __value);
127 /** \copydoc sizeMax
128 *
129 * \note this also sets unlimitedSizeMax to \c true
130 * \see unlimitedSizeMax
131 */
132 void setSizeMax(double __value);
133 /** \copydoc sizeMin
134 *
135 * \note this also sets unlimitedSizeMin to \c true
136 * \see unlimitedSizeMin
137 */
138 void setSizeMin(double __value);
139 /** \copydoc rangeMax*/
140 void setRangeMax(double __value);
141 /** \copydoc rangeMin*/
142 void setRangeMin(double __value);
143 protected:
144 /** \brief min-value of range
145 * \image html JKQTPRangeBase.png
146 */
147 double rangeMin;
148 /** \brief max-value of range
149 * \image html JKQTPRangeBase.png
150 */
151 double rangeMax;
152 /** \brief where to plot the center line
153 * \image html JKQTPRangeBase.png
154 */
156 /** \brief if \c unlimitedSizeMin==false, then the range rectangle only extends to this value on the axis perpendicular to the range axis (towards smaller numbers)
157 *
158 * \image html JKQTPRangeBase.png
159 * \see unlimitedSizeMin
160 */
161 double sizeMin;
162 /** \brief if \c unlimitedSizeMax==false, then the range rectangle only extends to this value on the axis perpendicular to the range axis (towards larger numbers)
163 *
164 * \image html JKQTPRangeBase.png
165 * \see unlimitedSizeMax
166 */
167 double sizeMax;
168 /** \brief if \c true, the range elongates infinitely in the direction perpendicular to the range axis and towards smaller numbers, otherwise the range rectangle stops at rangeMin
169 *
170 * \image html JKQTPRangeBase.png
171 * \see sizeMin
172 */
174 /** \brief if \c true, the range elongates infinitely in the direction perpendicular to the range axis and towards larger numbers, otherwise the range rectangle stops at rangeMin
175 *
176 * \image html JKQTPRangeBase.png
177 * \see sizeMax
178 */
180 /** \brief indicates whether to plot a center line */
182 /** \brief if \c true, fills the parts outside the given range
183 *
184 * \image html JKQTPRangeBase_Inverted.png
185 */
187 /** \brief if \c true, the range is plotted, if \c false, only the center line is plotted (if \a plotCenterLine is \c true ) */
189 /** \brief if \c true, draws lines at the range borders \a color */
191 /** \brief if \c true, this fills the range with \a fillColor */
193 /** \brief color of the center line graph */
195 /** \brief linestyle of the center line graph lines */
196 Qt::PenStyle centerStyle;
197 /** \brief width (pt) of the center line graph, given in pt */
199
200};
201
202
203
204
205
206/** \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
207 * or a range of interest, or the range of good values, ...
208 * \ingroup jkqtplotter_annotations
209 *
210 * \image html JKQTPHorizontalRange.png
211 *
212 * \see JKQTPVerticalRange
213 *
214 * <b>Explanation of basic features:</b>
215 *
216 * \copydetails JKQTPRangeBase
217 */
219 Q_OBJECT
220public:
221 /** \brief class constructor */
223 /** \brief class constructor */
225
226 /** \brief plots the graph to the plotter object specified as parent */
227 virtual void draw(JKQTPEnhancedPainter& painter) override;
228 /** \brief plots a key marker inside the specified rectangle \a rect */
229 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
230
231 /** \brief get the maximum and minimum x-value of the graph
232 *
233 * The result is given in the two parameters which are call-by-reference parameters!
234 */
235 bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
236 /** \brief get the maximum and minimum y-value of the graph
237 *
238 * The result is given in the two parameters which are call-by-reference parameters!
239 */
240 bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
241};
242
243
244
245
246/** \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
247 * or a range of interest, or the range of good values, ...
248 * \ingroup jkqtplotter_annotations
249 *
250 * \image html JKQTPVerticalRange.png
251 *
252 * \see JKQTPHorizontalRange
253 *
254 * <b>Explanation of basic features (using the example of JKQTPHorizontalRange):</b>
255 *
256 * \copydetails JKQTPRangeBase
257 */
259 Q_OBJECT
260 public:
261 /** \brief class constructor */
263 /** \brief class constructor */
265
266 /** \brief plots the graph to the plotter object specified as parent */
267 virtual void draw(JKQTPEnhancedPainter& painter) override;
268 /** \brief plots a key marker inside the specified rectangle \a rect */
269 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
270
271 /** \brief get the maximum and minimum x-value of the graph
272 *
273 * The result is given in the two parameters which are call-by-reference parameters!
274 */
275 bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
276 /** \brief get the maximum and minimum y-value of the graph
277 *
278 * The result is given in the two parameters which are call-by-reference parameters!
279 */
280 bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
281};
282
283#endif // jkqtpgraphsrange_H
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter.
Definition jkqtpcoordinateaxes.h:181
This class manages data columns (with entries of type double ), used by JKQTPlotter/JKQTBasePlotter t...
Definition jkqtpdatastorage.h:282
this class extends the QPainter
Definition jkqtpenhancedpainter.h:33
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 sty...
Definition jkqtpgraphsbasestylingmixins.h:49
simply marks a range (and possibly a centerline) in a plot. This may be used to display e....
Definition jkqtprange.h:218
JKQTPHorizontalRange(JKQTBasePlotter *parent=nullptr)
class constructor
virtual void drawKeyMarker(JKQTPEnhancedPainter &painter, const QRectF &rect) override
plots a key marker inside the specified rectangle rect
virtual void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
JKQTPHorizontalRange(JKQTPlotter *parent)
class constructor
bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
this virtual base class of every element, which is part of a JKQTPlotter plot and may appear in its k...
Definition jkqtpgraphsbase.h:62
simply marks a range (and possibly a centerline) in a plot. This may be used to display e....
Definition jkqtprange.h:57
void setCenterLineWidth(double __value)
width (pt) of the center line graph, given in pt
virtual void setColor(QColor c)
set the color of the graph (all lines and filling)
void setCenterColor(const QColor &__value)
color of the center line graph
Qt::PenStyle getCenterStyle() const
linestyle of the center line graph lines
void setUnlimitedSizeMin(bool __value)
if true, the range elongates infinitely in the direction perpendicular to the range axis and towards ...
void setDrawCenterLineOnly()
disables all drawing features except the centerline
bool getPlotCenterLine() const
indicates whether to plot a center line
JKQTPRangeBase(JKQTBasePlotter *parent=nullptr)
class constructor
double sizeMin
if unlimitedSizeMin==false, then the range rectangle only extends to this value on the axis perpendic...
Definition jkqtprange.h:161
void setUnlimitedSizeMax(bool __value)
if true, the range elongates infinitely in the direction perpendicular to the range axis and towards ...
bool unlimitedSizeMin
if true, the range elongates infinitely in the direction perpendicular to the range axis and towards ...
Definition jkqtprange.h:173
QColor getCenterColor() const
color of the center line graph
bool fillRange
if true, this fills the range with fillColor
Definition jkqtprange.h:192
bool plotRange
if true, the range is plotted, if false, only the center line is plotted (if plotCenterLine is true )
Definition jkqtprange.h:188
void setPlotCenterLine(bool __value)
indicates whether to plot a center line
double getRangeMax() const
max-value of range
double getCenterLineWidth() const
width (pt) of the center line graph, given in pt
double rangeCenter
where to plot the center line
Definition jkqtprange.h:155
void setRangeCenter(double __value)
where to plot the center line
void setFillRange(bool __value)
if true, this fills the range with fillColor
bool invertedRange
if true, fills the parts outside the given range
Definition jkqtprange.h:186
void setPlotRange(bool __value)
if true, the range is plotted, if false, only the center line is plotted (if plotCenterLine is true )
bool plotRangeLines
if true, draws lines at the range borders color
Definition jkqtprange.h:190
virtual QColor getKeyLabelColor() const override
returns the color to be used for the key label
void setSizeMax(double __value)
if unlimitedSizeMax==false, then the range rectangle only extends to this value on the axis perpendic...
double centerLineWidth
width (pt) of the center line graph, given in pt
Definition jkqtprange.h:198
bool getFillRange() const
if true, this fills the range with fillColor
double rangeMin
min-value of range
Definition jkqtprange.h:147
void setInvertedRange(bool __value)
if true, fills the parts outside the given range
double rangeMax
max-value of range
Definition jkqtprange.h:151
double getRangeCenter() const
where to plot the center line
void setRangeMax(double __value)
max-value of range
double getSizeMin() const
if unlimitedSizeMin==false, then the range rectangle only extends to this value on the axis perpendic...
bool getPlotRange() const
if true, the range is plotted, if false, only the center line is plotted (if plotCenterLine is true )
double getSizeMax() const
if unlimitedSizeMax==false, then the range rectangle only extends to this value on the axis perpendic...
QColor centerColor
color of the center line graph
Definition jkqtprange.h:194
void setSizeMin(double __value)
if unlimitedSizeMin==false, then the range rectangle only extends to this value on the axis perpendic...
bool getInvertedRange() const
if true, fills the parts outside the given range
double getRangeMin() const
min-value of range
bool getUnlimitedSizeMax() const
if true, the range elongates infinitely in the direction perpendicular to the range axis and towards ...
bool getPlotRangeLines() const
if true, draws lines at the range borders color
Qt::PenStyle centerStyle
linestyle of the center line graph lines
Definition jkqtprange.h:196
void setPlotRangeLines(bool __value)
if true, draws lines at the range borders color
bool unlimitedSizeMax
if true, the range elongates infinitely in the direction perpendicular to the range axis and towards ...
Definition jkqtprange.h:179
void setCenterStyle(Qt::PenStyle __value)
linestyle of the center line graph lines
double sizeMax
if unlimitedSizeMax==false, then the range rectangle only extends to this value on the axis perpendic...
Definition jkqtprange.h:167
bool getUnlimitedSizeMin() const
if true, the range elongates infinitely in the direction perpendicular to the range axis and towards ...
void setRangeMin(double __value)
min-value of range
bool plotCenterLine
indicates whether to plot a center line
Definition jkqtprange.h:181
simply marks a range (and possibly a centerline) in a plot. This may be used to display e....
Definition jkqtprange.h:258
bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
JKQTPVerticalRange(JKQTPlotter *parent)
class constructor
JKQTPVerticalRange(JKQTBasePlotter *parent=nullptr)
class constructor
virtual void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
virtual void drawKeyMarker(JKQTPEnhancedPainter &painter, const QRectF &rect) override
plots a key marker inside the specified rectangle rect
bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89