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
jkqtpgraphlabelstylemixin.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
21#ifndef jkqtpgraphlabelstylemixin_H
22#define jkqtpgraphlabelstylemixin_H
23
24
25#include <QString>
26#include <QPainter>
27#include <QPen>
28#include <QBrush>
29#include "jkqtplotter/jkqtptools.h"
30#include "jkqtplotter/jkqtplotter_imexport.h"
31#include "jkqtplotter/jkqtpbaseplotter.h"
32#include "jkqtcommon/jkqtpdrawingtools.h"
33#include "jkqtplotter/jkqtplotter_configmacros.h"
34#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
35
36
37class JKQTPlotter; // forward
38
39
40
41/** \brief position of a label near a data-point, used by JKQTPGraphValueLabelStyleMixin
42 * \ingroup jkqtplotter_specialgraphs_stylemixins
43 *
44 * \see JKQTPGraphValueLabelStyleMixin
45 */
47 JKQTPGLabelAboveData=0, /*!< \brief all labels always above the datapoint \image html JKQTPGLabelAboveData.png */
48 JKQTPGLabelBelowData, /*!< \brief all labels always below the datapoint \image html JKQTPGLabelBelowData.png */
49 JKQTPGLabelTowardsXAxis, /*!< \brief all labels between the datapoint and the x-axis the datapoint \image html JKQTPGLabelTowardsXAxis.png */
50 JKQTPGLabelAwayFromXAxis, /*!< \brief all labels pointing away from the x-axis \image html JKQTPGLabelAwayFromXAxis.png */
51 JKQTPGLabelRightHandSide, /*!< \brief all labels always on the right-hand side of the datapoint \image html JKQTPGLabelRightHandSide.png */
52 JKQTPGLabelLeftHandSide, /*!< \brief all labels always on the left-hand side of the datapoint \image html JKQTPGLabelLeftHandSide.png */
53 JKQTPGLabelTowardsYAxis, /*!< \brief all labels between the datapoint and the y-axis the datapoint \image html JKQTPGLabelTowardsYAxis.png */
54 JKQTPGLabelAwayFromYAxis, /*!< \brief all labels pointing away from the y-axis \image html JKQTPGLabelAwayFromYAxis.png */
55 JKQTPGLabelCenteredOnData, /*!< \brief graph label is drawn centered arond the data point \c (x,y) \image html JKQTPGLabelCenteredOnData.png */
56 JKQTPGLabelHalfwaysToXAxis, /*!< \brief all labels half-ways between the datapoint and the x-axis the datapoint \image html JKQTPGLabelHalfwaysToXAxis.png */
57 JKQTPGLabelHalfwaysToYAxis, /*!< \brief all labels half-ways between the datapoint and the y-axis the datapoint \image html JKQTPGLabelHalfwaysToYAxis.png */
58
59
61};
62
63
64/** \brief converts a JKQTPGraphLabelPosition variable into a human-readable string
65 * \ingroup jkqtplotter_specialgraphs_stylemixins
66 */
68
69/** \brief converts a String into a JKQTPGraphLabelPosition
70 * \ingroup jkqtplotter_specialgraphs_stylemixins
71 */
73
74/** \brief type of box surrounding a label near a data-point, used by JKQTPGraphValueLabelStyleMixin
75 * \ingroup jkqtplotter_specialgraphs_stylemixins
76 *
77 * \see JKQTPGraphValueLabelStyleMixin
78 */
80 JKQTPGLSimpleBox=0, /*!< \brief a simple (possibly rounded and outlined) box \image html JKQTPGLSimpleBox.png */
81 JKQTPGLSimpleBoxAndLine=1, /*!< \brief a simple (possibly rounded and outlined) box, connected to the datapoint by a line \image html JKQTPGLSimpleBoxAndLine.png */
82
84};
85
86
87/** \brief converts a JKQTPGraphLabelBoxType variable into a human-readable string
88 * \ingroup jkqtplotter_specialgraphs_stylemixins
89 */
91
92/** \brief converts a String into a JKQTPGraphLabelBoxType
93 * \ingroup jkqtplotter_specialgraphs_stylemixins
94 */
96
97
98
99
100/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for value labels in graphs
101 \ingroup jkqtplotter_specialgraphs_stylemixins
102
103 in addition to all properties of JKQTPGraphTextStyleMixin for the actual label text,
104 JKQTPGraphLineStyleMixin & JKQTPGraphFillStyleMixin for a box around the label,
105 it also supports properties for positioning and further sryling the labels.
106
107 supported properties:
108 - padding from actual label to border
109 - distance of label to actual datapoint
110 - positioning of the label
111 - styling for the box around the label
112 .
113
114 \image html jkqtpxygraphlabelsmixin.png
115
116 \see JKQTPGraphTextStyleMixin, JKQTPGraphLineStyleMixin, JKQTPGraphFillStyleMixin, JKQTPXYGraphLabels
117 */
119#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
120 Q_GADGET
121#endif
122public:
123
124
125 /** \brief class constructor */
127
128 /** \brief initiaize the fill style (from the parent plotter) */
130
132
133 /** \copydoc m_labelOffset */
134 void setLabelOffset(double r);
135 /** \copydoc m_labelOffset */
136 double getLabelOffset() const;
137 /** \brief determines, whether to use getLabelOffset() or getLabelOffsetWithConnector() (or something else) and returns it */
138 double getUsedLabelOffset() const;
139
140 /** \copydoc m_labelOffsetWithConnector */
142 /** \copydoc m_labelOffsetWithConnector */
144
145 /** \copydoc m_labelBoxRounding */
146 void setLabelBoxRounding(double r);
147 /** \copydoc m_labelBoxRounding */
148 double getLabelBoxRounding() const;
149
150 /** \copydoc m_labelXPadding */
151 void setLabelXPadding(double r);
152 /** \copydoc m_labelXPadding */
153 double getLabelXPadding() const;
154
155
156 /** \copydoc m_labelYPadding */
157 void setLabelYPadding(double r);
158 /** \copydoc m_labelYPadding */
159 double getLabelYPadding() const;
160
161 /** \copydoc m_labelPosition */
163 /** \copydoc m_labelPosition */
165 /** \brief determines whether a label is positioned left of the mininmum, or right of the maxinmum datapoint (\c true ) */
167 /** \brief determines whether a label is positioned below the mininmum, or above the maxinmum datapoint (\c true ) */
169
170 /** \copydoc m_drawLabelBoxFrame */
172 /** \copydoc m_drawLabelBoxFrame */
173 bool drawsLabelBoxFrame() const;
174
175 /** \copydoc m_labelBoxType */
177 /** \copydoc m_labelBoxType */
179
180 /** \brief draws a label, including its box
181 *
182 * \brief painter the JKQTPEnhancedPainter to use for drawing
183 * \brief xDataPixel position of the labeled datapoint in (screen) pixels
184 * \brief xData x- and y-coordinate of the datapoint (needed for some JKQTPGraphLabelPosition)
185 * \brief contents the text to be rendered
186 * \brief parent the JKQTPBasePlotter in whos context we are drawing (e.g. needed to render \a contents )
187 * \brief baselineX baseline (in graph coordinate system, not pixels) of the graph in x-direction (typically 0), needed for JKQTPGLabelHalfwaysToYAxis
188 * \brief baselineY baseline (in graph coordinate system, not pixels) of the graph in y-direction (typically 0), needed for JKQTPGLabelHalfwaysToXAxis
189 *
190 */
191 void drawLabel(JKQTPEnhancedPainter& painter, const QPointF& xDataPixel, const QPointF& xData, const QString& contents, JKQTBasePlotter *parent, double baselineX, double baselineY) const;
192
193
194
195#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
196 Q_PROPERTY(double labelOffset MEMBER m_labelOffset READ getLabelOffset WRITE setLabelOffset)
197 Q_PROPERTY(double labelOffsetWithConnector MEMBER m_labelOffsetWithConnector READ getLabelOffsetWithConnector WRITE setLabelOffsetWithConnector)
198 Q_PROPERTY(double labelBoxRounding MEMBER m_labelBoxRounding READ getLabelBoxRounding WRITE setLabelBoxRounding)
199 Q_PROPERTY(double labelXPadding MEMBER m_labelXPadding READ getLabelXPadding WRITE setLabelXPadding)
200 Q_PROPERTY(double labelYPadding MEMBER m_labelYPadding READ getLabelYPadding WRITE setLabelYPadding)
201 Q_PROPERTY(JKQTPGraphLabelPosition labelPosition MEMBER m_labelPosition READ getLabelPosition WRITE setLabelPosition)
202 Q_PROPERTY(bool drawLabelBoxFrame MEMBER m_drawLabelBoxFrame READ drawsLabelBoxFrame WRITE setDrawLabelBoxFrame)
203 Q_PROPERTY(JKQTPGraphLabelBoxType labelBoxType MEMBER m_labelBoxType READ getLabelBoxType WRITE setLabelBoxType)
204#endif
205
206protected:
207 /** \brief describes details about the geometry of a label, used by calcLabelGeometry() */
210 labelOffsetPx(0.0),
211 padX(0.0),
212 padY(0.0),
213 lw(0.0),
214 label(""),
215 textSize(),
216 textRect(),
217 boxRect(),
218 boxpos(BoxTop)
219 { };
221 double padX;
222 double padY;
223 double lw;
224 QString label;
226 QRectF textRect;
227 QRectF boxRect;
236 };
237
238 /** \brief calculate everything that is necessary to draw a label, including its box
239 *
240 * \brief painter the JKQTPEnhancedPainter to use for drawing
241 * \brief xDataPixel position of the labeled datapoint in (screen) pixels
242 * \brief xData x- and y-coordinate of the datapoint (needed for some JKQTPGraphLabelPosition)
243 * \brief contents the text to be rendered
244 * \brief parent the JKQTPBasePlotter in whos context we are drawing (e.g. needed to render \a contents )
245 * \brief baselineX baseline (in graph coordinate system, not pixels) of the graph in x-direction (typically 0), needed for JKQTPGLabelHalfwaysToYAxis
246 * \brief baselineY baseline (in graph coordinate system, not pixels) of the graph in y-direction (typically 0), needed for JKQTPGLabelHalfwaysToXAxis
247 *
248 */
249 LabelGeometry calcLabelGeometry(JKQTPEnhancedPainter& painter, const QPointF& xDataPixel, const QPointF& xData, const QString& contents, JKQTBasePlotter *parent, double baselineX, double baselineY) const;
250
251private:
252 /** \brief offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and is a rather close distance (e.g. JKQTPGLSimpleBox)
253 *
254 * \image html jkqtpxygraphlabelsmixin.png
255 *
256 * \see setLabelOffset(), getLabelOffset(), setLabelOffsetWithConnector(), getLabelOffsetWithConnector()
257 */
259 /** \brief offset of the box rectangle to the actual data point location [pt], this variant is used when a visible connector is shown (e.g. JKQTPGLSimpleBoxAndLine)
260 *
261 * \image html jkqtpxygraphlabelsmixin.png
262 *
263 * \see setLabelOffsetWithConnector(), getLabelOffsetWithConnector(), setLabelOffset(), getLabelOffset()
264 */
266 /** \brief rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt] */
268 /** \brief padding in x-direction between label and surrounding box [pt]
269 *
270 * \image html jkqtpxygraphlabelsmixin.png
271 */
273 /** \brief padding in y-direction between label and surrounding box [pt] *
274 *
275 * \image html jkqtpxygraphlabelsmixin.png
276 */
278 /** \brief indicates whether to draw a frame around the box *
279 *
280 * \image html jkqtpxygraphlabelsmixin.png
281 */
283 /** \brief position of the label
284 *
285 * \see JKQTPGraphLabelPosition for details on available options
286 */
288 /** \brief type or style of the box surrounding the label text
289 *
290 * \see JKQTPGraphLabelBoxType for details on available options
291 */
293};
294
295
296
297
298/** \brief display mode for the (axis) labels
299 * \ingroup jkqtplotter_specialgraphs_stylemixins */
301 JKQTPGLCdecimal, /*!< \brief print the numbers in decimal notation, without using exponent characters e.g. \c "0.00123" */
302 JKQTPGLCscientific, /*!< \brief print the numbers in scientific notation, e.g. \c "1.23e-4" */
303 JKQTPGLCexponentCharacter, /*!< \brief print the numbers and show a unit character, i.e. 5&mu; for \f$ 5\cdot 10^{-6} \f$ , \c 3k for \f$ 3\cdot 10^3 \f$ ... */
304 JKQTPGLCexponent, /*!< \brief show numbers in exponential for, e.g. \f$ 3\cdot 10^5 \f$ ... */
305 JKQTPGLCdatetime, /*!< \brief show numbers as times */
306
308 };
309
310
311/*! \brief This Mix-In class provides setter/getter methods, and tools for x- and y-value label formatting (i.e. double to string conversion)
312 \ingroup jkqtplotter_specialgraphs_stylemixins
313
314 \see JKQTPXYGraphLabels
315 */
317#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
318 Q_GADGET
319#endif
320public:
321
322 /** \brief class constructor */
324
326
327
328
329 /** \copydoc m_xDefaultPrecision */
331 /** \copydoc m_xDefaultPrecision */
333 /** \copydoc m_yDefaultPrecision */
335 /** \copydoc m_yDefaultPrecision */
337
338 /** \copydoc m_xDefaultConverter */
340 /** \copydoc m_xDefaultConverter */
342 /** \copydoc m_yDefaultConverter */
344 /** \copydoc m_yDefaultConverter */
346
347
348 /** \copydoc m_xValueLabelFormat */
349 QString getXValueLabelFormat() const;
350 /** \copydoc m_xValueLabelFormat */
351 void setXValueLabelFormat(const QString& v);
352 /** \copydoc m_yValueLabelFormat */
353 QString getYValueLabelFormat() const;
354 /** \copydoc m_yValueLabelFormat */
355 void setYValueLabelFormat(const QString& v);
356 /** \copydoc m_xyValueLabelFormat */
357 QString getXYValueLabelFormat() const;
358 /** \copydoc m_xyValueLabelFormat */
359 void setXYValueLabelFormat(const QString& v);
360
361
362 /** \copydoc m_xBelowIsZero */
363 double getXBelowIsZero() const;
364 /** \copydoc m_xBelowIsZero */
365 void setXBelowIsZero(double v);
366 /** \copydoc m_yBelowIsZero */
367 double getYBelowIsZero() const;
368 /** \copydoc m_yBelowIsZero */
369 void setYBelowIsZero(double v);
370
371
372 /** \copydoc m_xMinNoExponent */
373 double getXMinNoExponent() const;
374 /** \copydoc m_xMinNoExponent */
375 void setXMinNoExponent(double v);
376 /** \copydoc m_yMinNoExponent */
377 double getYMinNoExponent() const;
378 /** \copydoc m_yMinNoExponent */
379 void setYMinNoExponent(double v);
380
381
382 /** \copydoc m_xMaxNoExponent */
383 double getXMaxNoExponent() const;
384 /** \copydoc m_xMaxNoExponent */
385 void setXMaxNoExponent(double v);
386 /** \copydoc m_yMaxNoExponent */
387 double getYMaxNoExponent() const;
388 /** \copydoc m_yMaxNoExponent */
389 void setYMaxNoExponent(double v);
390
391
392
393 /** \copydoc m_xDateTimeFormat */
394 QString getXDateTimeFormat() const;
395 /** \copydoc m_xDateTimeFormat */
396 void setXDateTimeFormat(const QString& v);
397 /** \copydoc m_yDateTimeFormat */
398 QString getYDateTimeFormat() const;
399 /** \copydoc m_yDateTimeFormat */
400 void setYDateTimeFormat(const QString& v);
401
402
403protected:
404 /** \brief default label generator for x-value only */
405 QString generateDefaultXLabel(double x, double y, int index) const;
406 /** \brief default label generator for y-value only */
407 QString generateDefaultYLabel(double x, double y, int index) const;
408 /** \brief default label generator for x- and y-value */
409 QString generateDefaultXYLabel(double x, double y, int index) const;
410 /** \brief converts \a x to a string, using several of the formatting properties set in this class for x-values */
411 QString xValToString(double x) const;
412 /** \brief converts \a y to a string, using several of the formatting properties set in this class for y-values */
413 QString yValToString(double y) const;
414 /** \brief converts \a x to a QString, using the provided options */
415 static QString valToString(double x, JKQTPGraphLabelConverterType m_xDefaultConverter, int m_xDefaultPrecision, double m_xBelowIsZero, double m_xMinNoExponent, double m_xMaxNoExponent, const QString& m_xDateTimeFormat);
416private:
417 /** \brief format string for the x-label, use \c %1 as placeholder for the numeric value */
419 /** \brief format string for the y-label, use \c %1 as placeholder for the numeric value */
421 /** \brief format string for the x/y-label, use \c %1 as placeholder for the numeric value of x and \c %2 for y */
423 /** \brief type of number to string conversion for x-values */
425 /** \brief type of number to string conversion for y-values */
427 /** \brief default precision for x-labels */
429 /** \brief default precision for x-labels */
431 /** \brief x-values below this value are treated as exactly 0 */
433 /** \brief y-values below this value are treated as exactly 0 */
435 /** \brief x-values below this value will be shown in exponent notation, above in decimal notation */
437 /** \brief y-values below this value will be shown in exponent notation, above in decimal notation */
439 /** \brief x-values above this value will be shown in exponent notation, below in decimal notation */
441 /** \brief y-values above this value will be shown in exponent notation, below in decimal notation */
443 /** \brief format string for datetime -> string conversion of x-values */
445 /** \brief format string for datetime -> string conversion of y-value */
447};
448
449
450
451#endif // jkqtpgraphlabelstylemixin_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
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
This Mix-In class provides setter/getter methods, storage and other facilities for text in graphs.
Definition jkqtpgraphsbasestylingmixins.h:640
This Mix-In class provides setter/getter methods, storage and other facilities for value labels in gr...
Definition jkqtpgraphlabelstylemixin.h:118
void setLabelBoxType(JKQTPGraphLabelBoxType r)
type or style of the box surrounding the label text
double m_labelBoxRounding
rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]
Definition jkqtpgraphlabelstylemixin.h:267
bool m_drawLabelBoxFrame
indicates whether to draw a frame around the box *
Definition jkqtpgraphlabelstylemixin.h:282
void setLabelYPadding(double r)
padding in y-direction between label and surrounding box [pt] *
bool isLabelPositioningGrowingInY() const
determines whether a label is positioned below the mininmum, or above the maxinmum datapoint (true )
double m_labelYPadding
padding in y-direction between label and surrounding box [pt] *
Definition jkqtpgraphlabelstylemixin.h:277
double getLabelOffsetWithConnector() const
offset of the box rectangle to the actual data point location [pt], this variant is used when a visib...
void setDrawLabelBoxFrame(bool r)
indicates whether to draw a frame around the box *
JKQTPGraphLabelPosition getLabelPosition() const
position of the label
void setLabelOffset(double r)
offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and...
JKQTPGraphLabelBoxType m_labelBoxType
type or style of the box surrounding the label text
Definition jkqtpgraphlabelstylemixin.h:292
void setLabelOffsetWithConnector(double r)
offset of the box rectangle to the actual data point location [pt], this variant is used when a visib...
double getLabelBoxRounding() const
rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]
void setLabelBoxRounding(double r)
rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]
LabelGeometry calcLabelGeometry(JKQTPEnhancedPainter &painter, const QPointF &xDataPixel, const QPointF &xData, const QString &contents, JKQTBasePlotter *parent, double baselineX, double baselineY) const
calculate everything that is necessary to draw a label, including its box
void initValueLabelStyle(JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
initiaize the fill style (from the parent plotter)
double getLabelXPadding() const
padding in x-direction between label and surrounding box [pt]
void drawLabel(JKQTPEnhancedPainter &painter, const QPointF &xDataPixel, const QPointF &xData, const QString &contents, JKQTBasePlotter *parent, double baselineX, double baselineY) const
draws a label, including its box
double getLabelOffset() const
offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and...
double m_labelOffset
offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and...
Definition jkqtpgraphlabelstylemixin.h:258
double m_labelOffsetWithConnector
offset of the box rectangle to the actual data point location [pt], this variant is used when a visib...
Definition jkqtpgraphlabelstylemixin.h:265
void setLabelXPadding(double r)
padding in x-direction between label and surrounding box [pt]
double getLabelYPadding() const
padding in y-direction between label and surrounding box [pt] *
JKQTPGraphLabelPosition m_labelPosition
position of the label
Definition jkqtpgraphlabelstylemixin.h:287
JKQTPGraphValueLabelStyleMixin(JKQTBasePlotter *parent)
class constructor
double m_labelXPadding
padding in x-direction between label and surrounding box [pt]
Definition jkqtpgraphlabelstylemixin.h:272
double getUsedLabelOffset() const
determines, whether to use getLabelOffset() or getLabelOffsetWithConnector() (or something else) and ...
void setLabelPosition(JKQTPGraphLabelPosition r)
position of the label
bool isLabelPositioningGrowingInX() const
determines whether a label is positioned left of the mininmum, or right of the maxinmum datapoint (tr...
JKQTPGraphLabelBoxType getLabelBoxType() const
type or style of the box surrounding the label text
bool drawsLabelBoxFrame() const
indicates whether to draw a frame around the box *
This Mix-In class provides setter/getter methods, and tools for x- and y-value label formatting (i....
Definition jkqtpgraphlabelstylemixin.h:316
QString getYValueLabelFormat() const
format string for the y-label, use %1 as placeholder for the numeric value
QString getXDateTimeFormat() const
format string for datetime -> string conversion of x-values
double getYMaxNoExponent() const
y-values above this value will be shown in exponent notation, below in decimal notation
QString generateDefaultXYLabel(double x, double y, int index) const
default label generator for x- and y-value
QString getXValueLabelFormat() const
format string for the x-label, use %1 as placeholder for the numeric value
void setXValueLabelFormat(const QString &v)
format string for the x-label, use %1 as placeholder for the numeric value
void setXMinNoExponent(double v)
x-values below this value will be shown in exponent notation, above in decimal notation
void setXDefaultConverter(JKQTPGraphLabelConverterType v)
type of number to string conversion for x-values
double m_yBelowIsZero
y-values below this value are treated as exactly 0
Definition jkqtpgraphlabelstylemixin.h:434
QString generateDefaultXLabel(double x, double y, int index) const
default label generator for x-value only
static QString valToString(double x, JKQTPGraphLabelConverterType m_xDefaultConverter, int m_xDefaultPrecision, double m_xBelowIsZero, double m_xMinNoExponent, double m_xMaxNoExponent, const QString &m_xDateTimeFormat)
converts x to a QString, using the provided options
double getXBelowIsZero() const
x-values below this value are treated as exactly 0
JKQTPGraphLabelConverterType m_xDefaultConverter
type of number to string conversion for x-values
Definition jkqtpgraphlabelstylemixin.h:424
JKQTPXYLabelsGeneratorMixin()
class constructor
QString generateDefaultYLabel(double x, double y, int index) const
default label generator for y-value only
void setYDateTimeFormat(const QString &v)
format string for datetime -> string conversion of y-value
double getXMaxNoExponent() const
x-values above this value will be shown in exponent notation, below in decimal notation
void setYMinNoExponent(double v)
y-values below this value will be shown in exponent notation, above in decimal notation
virtual ~JKQTPXYLabelsGeneratorMixin()
double m_yMinNoExponent
y-values below this value will be shown in exponent notation, above in decimal notation
Definition jkqtpgraphlabelstylemixin.h:438
double getXMinNoExponent() const
x-values below this value will be shown in exponent notation, above in decimal notation
QString yValToString(double y) const
converts y to a string, using several of the formatting properties set in this class for y-values
void setYDefaultPrecision(int v)
default precision for x-labels
void setYMaxNoExponent(double v)
y-values above this value will be shown in exponent notation, below in decimal notation
QString m_xValueLabelFormat
format string for the x-label, use %1 as placeholder for the numeric value
Definition jkqtpgraphlabelstylemixin.h:418
QString xValToString(double x) const
converts x to a string, using several of the formatting properties set in this class for x-values
QString m_yValueLabelFormat
format string for the y-label, use %1 as placeholder for the numeric value
Definition jkqtpgraphlabelstylemixin.h:420
int m_yDefaultPrecision
default precision for x-labels
Definition jkqtpgraphlabelstylemixin.h:430
void setXYValueLabelFormat(const QString &v)
format string for the x/y-label, use %1 as placeholder for the numeric value of x and %2 for y
QString getXYValueLabelFormat() const
format string for the x/y-label, use %1 as placeholder for the numeric value of x and %2 for y
double getYMinNoExponent() const
y-values below this value will be shown in exponent notation, above in decimal notation
QString getYDateTimeFormat() const
format string for datetime -> string conversion of y-value
void setXMaxNoExponent(double v)
x-values above this value will be shown in exponent notation, below in decimal notation
void setXDateTimeFormat(const QString &v)
format string for datetime -> string conversion of x-values
void setYBelowIsZero(double v)
y-values below this value are treated as exactly 0
JKQTPGraphLabelConverterType m_yDefaultConverter
type of number to string conversion for y-values
Definition jkqtpgraphlabelstylemixin.h:426
QString m_xDateTimeFormat
format string for datetime -> string conversion of x-values
Definition jkqtpgraphlabelstylemixin.h:444
void setXBelowIsZero(double v)
x-values below this value are treated as exactly 0
double m_xMaxNoExponent
x-values above this value will be shown in exponent notation, below in decimal notation
Definition jkqtpgraphlabelstylemixin.h:440
void setYValueLabelFormat(const QString &v)
format string for the y-label, use %1 as placeholder for the numeric value
JKQTPGraphLabelConverterType getYDefaultConverter() const
type of number to string conversion for y-values
int getXDefaultPrecision() const
default precision for x-labels
int m_xDefaultPrecision
default precision for x-labels
Definition jkqtpgraphlabelstylemixin.h:428
int getYDefaultPrecision() const
default precision for x-labels
QString m_yDateTimeFormat
format string for datetime -> string conversion of y-value
Definition jkqtpgraphlabelstylemixin.h:446
void setXDefaultPrecision(int v)
default precision for x-labels
void setYDefaultConverter(JKQTPGraphLabelConverterType v)
type of number to string conversion for y-values
double getYBelowIsZero() const
y-values below this value are treated as exactly 0
double m_yMaxNoExponent
y-values above this value will be shown in exponent notation, below in decimal notation
Definition jkqtpgraphlabelstylemixin.h:442
double m_xBelowIsZero
x-values below this value are treated as exactly 0
Definition jkqtpgraphlabelstylemixin.h:432
double m_xMinNoExponent
x-values below this value will be shown in exponent notation, above in decimal notation
Definition jkqtpgraphlabelstylemixin.h:436
JKQTPGraphLabelConverterType getXDefaultConverter() const
type of number to string conversion for x-values
QString m_xyValueLabelFormat
format string for the x/y-label, use %1 as placeholder for the numeric value of x and %2 for y
Definition jkqtpgraphlabelstylemixin.h:422
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
JKQTPGraphLabelPosition
position of a label near a data-point, used by JKQTPGraphValueLabelStyleMixin
Definition jkqtpgraphlabelstylemixin.h:46
JKQTPLOTTER_LIB_EXPORT QString JKQTPGraphLabelBoxType2String(JKQTPGraphLabelBoxType pos)
converts a JKQTPGraphLabelBoxType variable into a human-readable string
JKQTPGraphLabelConverterType
display mode for the (axis) labels
Definition jkqtpgraphlabelstylemixin.h:300
JKQTPLOTTER_LIB_EXPORT JKQTPGraphLabelBoxType String2JKQTPGraphLabelBoxType(const QString &pos)
converts a String into a JKQTPGraphLabelBoxType
JKQTPLOTTER_LIB_EXPORT JKQTPGraphLabelPosition String2JKQTPGraphLabelPosition(const QString &pos)
converts a String into a JKQTPGraphLabelPosition
JKQTPLOTTER_LIB_EXPORT QString JKQTPGraphLabelPosition2String(JKQTPGraphLabelPosition pos)
converts a JKQTPGraphLabelPosition variable into a human-readable string
JKQTPGraphLabelBoxType
type of box surrounding a label near a data-point, used by JKQTPGraphValueLabelStyleMixin
Definition jkqtpgraphlabelstylemixin.h:79
@ JKQTPGLabelAwayFromYAxis
all labels pointing away from the y-axis
Definition jkqtpgraphlabelstylemixin.h:54
@ JKQTPGLabelLeftHandSide
all labels always on the left-hand side of the datapoint
Definition jkqtpgraphlabelstylemixin.h:52
@ JKQTPGLabelHalfwaysToYAxis
all labels half-ways between the datapoint and the y-axis the datapoint
Definition jkqtpgraphlabelstylemixin.h:57
@ JKQTPGLabelAwayFromXAxis
all labels pointing away from the x-axis
Definition jkqtpgraphlabelstylemixin.h:50
@ JKQTPGLabelTowardsYAxis
all labels between the datapoint and the y-axis the datapoint
Definition jkqtpgraphlabelstylemixin.h:53
@ JKQTPGLabelCenteredOnData
graph label is drawn centered arond the data point (x,y)
Definition jkqtpgraphlabelstylemixin.h:55
@ JKQTPGLabelTowardsXAxis
all labels between the datapoint and the x-axis the datapoint
Definition jkqtpgraphlabelstylemixin.h:49
@ JKQTPGLabelHalfwaysToXAxis
all labels half-ways between the datapoint and the x-axis the datapoint
Definition jkqtpgraphlabelstylemixin.h:56
@ JKQTPGLabelAboveData
all labels always above the datapoint
Definition jkqtpgraphlabelstylemixin.h:47
@ JKQTPGraphLabelDefault
Definition jkqtpgraphlabelstylemixin.h:60
@ JKQTPGLabelBelowData
all labels always below the datapoint
Definition jkqtpgraphlabelstylemixin.h:48
@ JKQTPGLabelRightHandSide
all labels always on the right-hand side of the datapoint
Definition jkqtpgraphlabelstylemixin.h:51
@ JKQTPGLCexponent
show numbers in exponential for, e.g. ...
Definition jkqtpgraphlabelstylemixin.h:304
@ JKQTPGLDefaultConverter
Definition jkqtpgraphlabelstylemixin.h:307
@ JKQTPGLCdecimal
print the numbers in decimal notation, without using exponent characters e.g. "0.00123"
Definition jkqtpgraphlabelstylemixin.h:301
@ JKQTPGLCscientific
print the numbers in scientific notation, e.g. "1.23e-4"
Definition jkqtpgraphlabelstylemixin.h:302
@ JKQTPGLCexponentCharacter
print the numbers and show a unit character, i.e. 5μ for , 3k for ...
Definition jkqtpgraphlabelstylemixin.h:303
@ JKQTPGLCdatetime
show numbers as times
Definition jkqtpgraphlabelstylemixin.h:305
@ JKQTPGLSimpleBoxAndLine
a simple (possibly rounded and outlined) box, connected to the datapoint by a line
Definition jkqtpgraphlabelstylemixin.h:81
@ JKQTPGLSimpleBox
a simple (possibly rounded and outlined) box
Definition jkqtpgraphlabelstylemixin.h:80
@ JKQTPGraphLabelBoxDefault
Definition jkqtpgraphlabelstylemixin.h:83
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89
JKQTPPlotStyleType
used to specify teh type of graph when calling getPlotStyle()
Definition jkqtptools.h:68
beschreibt die Größe(n) eines Knotens
Definition jkqtmathtexttools.h:393
describes details about the geometry of a label, used by calcLabelGeometry()
Definition jkqtpgraphlabelstylemixin.h:208
LabelGeometry()
Definition jkqtpgraphlabelstylemixin.h:209
QRectF textRect
Definition jkqtpgraphlabelstylemixin.h:226
BoxPos boxpos
Definition jkqtpgraphlabelstylemixin.h:235
double lw
Definition jkqtpgraphlabelstylemixin.h:223
BoxPos
Definition jkqtpgraphlabelstylemixin.h:228
@ BoxTop
Definition jkqtpgraphlabelstylemixin.h:231
@ BoxRight
Definition jkqtpgraphlabelstylemixin.h:230
@ BoxLeft
Definition jkqtpgraphlabelstylemixin.h:229
@ BoxBottom
Definition jkqtpgraphlabelstylemixin.h:232
JKQTMathTextNodeSize textSize
Definition jkqtpgraphlabelstylemixin.h:225
double padX
Definition jkqtpgraphlabelstylemixin.h:221
QRectF boxRect
Definition jkqtpgraphlabelstylemixin.h:227
QString label
Definition jkqtpgraphlabelstylemixin.h:224
double labelOffsetPx
Definition jkqtpgraphlabelstylemixin.h:220
double padY
Definition jkqtpgraphlabelstylemixin.h:222