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
jkqtpcoordinateaxes.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
22
23#ifndef JKQTPCOORDINATEAXES_H
24#define JKQTPCOORDINATEAXES_H
25
26
27#include <QString>
28#include <QPainter>
29#include <QPair>
30#include <QSettings>
31#include "jkqtplotter/jkqtptools.h"
32#include "jkqtmathtext/jkqtmathtext.h"
33#include "jkqtplotter/jkqtplotter_imexport.h"
34#include "jkqtplotter/jkqtpcoordinateaxesstyle.h"
35
36// forward declarations
37class JKQTBasePlotter;
38
39/*! \brief named references for different oordinate axes in the plot
40 \ingroup jkqtpplottersupprt
41*/
46
47/*! \brief type for indexing coordinate axes in a plot
48 \ingroup jkqtpplottersupprt
49*/
51
52/*! \brief this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter.
53 \ingroup jkqtpbaseplotter_elements
54
55 Classes derived from JKQTPCoordinateAxis implements all the functionality needed for a coordinate axis:
56 - transform world to screen coordinates and vice versa
57 - draw the axis (implemented by child classes!) with these elements: axis lines, ticks, tick labels, axis label, x/y=0 axis
58 - measure the axes in screen coordinates
59 - load and save the settings to an ini file
60 .
61
62 Most of the actual draw and measure functions have to be implemented in descendents of this class (namely
63 JKQTPHorizontalAxis and JKQTPVerticalAxis, as they are specific to whether the axis is drawn horizontally or
64 vertically.
65
66 Each axis is split up into several parts, as depicted in this image:
67
68 \image html jkqtpcoordinateaxis1.png
69
70 Which parts to actually draw is set by the diverse properties.
71
72
73 \section jkqtplotter_base_systems_baseelements Coordinate Systems and Transformations
74 The plot itself is positioned inside the widget (see \ref jkqtplotter_base_plotsize for details).
75 You simply supply the widget dimensions and the border
76 widths between the plot and the widget. The Object then calculates the size of the plot:
77
78 \image html plot_widget_orientation.png
79
80 The plot shows the parameter range xmin ... xmax and ymin ... ymax. Note that if you plot logarithmic plots
81 you may only plot positive (>0) values. Any other value may lead to an error or unpredictable behaviour.
82
83 From these parameters the object calculates the scaling laws for plotting pints to the screen. The next paragraphs
84 show all calculations for x- and y-coordinates, ahough this class only implements a generic form. The actual calculation
85 is also influenced by the parameters set in the child classes!
86
87 -# <tt>width = xmax - xmin</tt>
88 -# <tt>height = ymax - ymin</tt>
89 -# <tt>plotWidth = widgetWidth - plotBorderLeft - plotBorderRight</tt>
90 -# <tt>plotHeight = widgetHeight - plotBorderTop - plotBorderBottom</tt>
91 -# <tt>xPlotOffset = plotBorderLeft</tt>
92 -# <tt>yPlotOffset = plotBorderTop</tt>
93 .
94 These parameters are common to all scaling laws. The next image explains these formulas:
95
96 \image html plot_coordinates.png
97
98 The actual scaling laws \f$ (x_p(x), y_p(y)) \f$ may be derived from these equations:
99 \f[ x_p(\mbox{xmin})=\mbox{xPlotOffset},\ \ \ \ \ x_p(\mbox{xmax})=\mbox{xPlotOffset}+\mbox{plotWidth} \f]
100 \f[ y_p(\mbox{ymax})=\mbox{yPlotOffset},\ \ \ \ \ y_p(\mbox{ymin})=\mbox{yPlotOffset}+\mbox{plotHeight} \f]
101 Here \f$ (x_p, y_p) \f$ denotes a point in pixel coordinates (green coordinate system) and \f$ (x,y) \f$ denotes a point in the
102 plotting coordinate system.
103
104 If you assume a <b>linear scaling law</b>. \f[ x_p(x)=\mbox{xoffset}+x\cdot\mbox{xscale} \ \ \ \ \ \ \ \ \ y_p(y)=\mbox{yoffset}-y\cdot\mbox{yscale} \f]
105 you can derive:
106 \f[ \mbox{xscale}=\frac{\mbox{plotWidth}}{\mbox{xwidth}},\ \ \ \ \ \ \mbox{xoffset}=\mbox{xPlotOffset}-\mbox{xmin}\cdot\mbox{xscale} \f]
107 \f[ \mbox{yscale}=\frac{\mbox{plotHeight}}{\mbox{ywidth}},\ \ \ \ \ \ \mbox{yoffset}=\mbox{yPlotOffset}+\mbox{ymax}\cdot\mbox{yscale} \f]
108
109 If you have a <b>logarithmic axis</b> (i.e. we plot \f$ \log_b(x) \f$ insetad of \f$ x \f$ for a given base \f$ b \f$ ) we get the same
110 formulas, but with \f$ x \f$ exchanged by \f$ \log_b(x) \f$. If we use the equation \f$ \log_b(x)=\log(x)/\log(b) \f$ we finally get
111 the scaling laws:
112 \f[ x_p(x)=\mbox{xoffset}+\frac{\log(x)}{\log(\mbox{logXAxisBase})}\cdot\mbox{xscale} \ \ \ \ \ \ \ \ \ y_p(y)=\mbox{yoffset}-\frac{\log(y)}{\log(\mbox{logYAxisBase})}\cdot\mbox{yscale} \f]
113 From these we can calculate their parameters with the same defining equations as above:
114 \f[ \mbox{xscale}=\frac{\mbox{plotWidth}\cdot\log(\mbox{logXAxisBase})}{\log(\mbox{xmax})-\log(\mbox{xmin})},\ \ \ \ \ \ \mbox{xoffset}=\mbox{xPlotOffset}-\frac{\log(\mbox{xmin})}{\log(\mbox{logXAxisBase})}\cdot\mbox{xscale} \f]
115 \f[ \mbox{yscale}=\frac{\mbox{plotHeight}\cdot\log(\mbox{logYAxisBase})}{\log(\mbox{ymax})-\log(\mbox{ymin})},\ \ \ \ \ \ \mbox{yoffset}=\mbox{yPlotOffset}+\frac{\log(\mbox{ymax})}{\log(\mbox{logYAxisBase})}\cdot\mbox{yscale} \f]
116
117 The object implements the above coordinate transformations in the (inline) method x2p(). The inverse transformations
118 are implemented in p2x(). They can be used to show the system coordinates of the current mouse position.
119
120
121 \section jkqtplotter_coordinateaxes_inverted Inverted Coordinate Axes
122
123 In some cases it may be necessary to invert the direction of increasing coordinates on an axis. One such case is image analysis, as computer images usually
124 have coordinates starting with (0,0) at the top left and increasing to the right (x) and down (y). You can invert any axis by setting \c setInverted(true).
125
126 \image html jkqtplotter_inverted_yaxis.png
127
128 \see You can find example here: \ref JKQTPlotterImagePlotQImageRGB and \ref JKQTPlotterImagePlotRGBOpenCV
129
130
131 \section jkqtplotter_base_grids_baseelemenets Axis Ticks and Grids
132 This section explains how this component draws the ticks on coordinate axes and the grids that may be drawn below
133 the plots. In principle both - grids and axes - are drawn the same way, i.e. with the same step widths. There are
134 two types of ticks and grids: The major and the minor ticks/grids. The major ticks also show a label that denotes the
135 value they represent. Between two major ticks the axis shows \a JKQTPCoordinateAxisStyle::minorTicks small ticks that are not
136 accompanied by a label. The next image shows an example of an axis:
137
138 \image html plot_axis_ticksandlabels.png
139
140 For the labels this class also uses an algorithm that extimates the number of valid digits (after the comma) that are
141 needed so that two adjacent labels do not show the same text, so if you plot the range 1.10 .. 1.15 The algorithm will
142 show at least two valid digits, as with one digit the labels would be 1.1, 1.1, 1.1, 1.1, 1.1, 1.1. With two digits they
143 are 1.10, 1.11, 1.12, 1.13, 1.14, 1.15. The class may also use a method that can write \c 1m instead of \c 0.001 and \c 1k
144 instead of \c 1000 (the algorithm supports the "exponent letters" f, p, n, u, m, k, M, G, T, P. The latter option may
145 (de)activated by using showXExponentCharacter and showYExponentCharacter.
146
147 For grids applies the same. There are two grids that are drawn in different styles (often the major grid is drawn
148 thicker and darker than the minor grid).
149
150 The minor ticks and grid lines are generated automatically, depending in the setting of \a JKQTPCoordinateAxisStyle::minorTicks.
151 These properties give the number of minor ticks between two major ticks, so if the major ticks are at 1,2,3,... and you
152 want minor ticks at 1.1, 1.2, 1.3,... then you will have to set \c JKQTPCoordinateAxisStyle::minorTicks=9 as there are nine ticks between two major
153 ticks. So the minor tick spacing is calculated as: \f[ \Delta\mbox{MinorTicks}=\frac{\Delta\mbox{ticks}}{\mbox{minorTicks}+1} \f]
154
155 The same applies for logarithmic axes. If the major ticks are at 1,10,100,... and you set \c JKQTPCoordinateAxisStyle::minorTicks=9 the program will
156 generate 9 equally spaced minor ticks in between, so you have minor ticks at 2,3,4,...,11,12,13,... This results in a standard
157 logarithmic axis. If you set \c JKQTPCoordinateAxisStyle::minorTicks=1 then you will get minor ticks at 5,15,150,...
158
159 \image html plot_logaxis_ticksandlabels.png
160
161 The major tick-tick distances of linear axes may be calculated automatically in a way that the axis shows at least a given
162 number of ticks \c JKQTPCoordinateAxisStyle::minTicks. The algorithm takes that tick spacing that will give a number of ticks per axis
163 nearest but \c ">=" to the given \c JKQTPCoordinateAxisStyle::minTicks. The Algorithm is described in detail with the function
164 calcLinearTickSpacing(). To activate this automatic tick spacing you have to set <code>autoAxisSpacing=true</code>.
165
166 \section jkqtplotter_coordinateaxes_tickscaling Axis Tick Units/Scaling
167 In some cases it is desired to put the axis ticks not at 1,2,3,... but rather at \f$ 1\pi \f$ , \f$ 2\pi \f$ , \f$ 3\pi \f$ or any other
168 unit than \f$ pi \f$ ,i.e.:
169
170 \image html axisstyle/axis_unit_scaling_none.png "no axis scaling (default case)"
171 \image html axisstyle/axis_unit_scaling_pi.png "pi-axis scaling"
172
173 You can use these methods to set such a factor:
174 - JKQTPCoordinateAxis::setTickUnitFactor() for the actual factor and setTickUnitName() for a name, added to the tick label
175 - JKQTPCoordinateAxis::setTickUnit() sets factor and name in one call
176 - JKQTPCoordinateAxis::setTickUnitPi() shortcut to set pi-scaling
177 - JKQTPCoordinateAxis::resetTickUnit() resets to no-scaling (default case)
178 .
179
180 */
182 Q_OBJECT
183 protected:
184 public:
185
186 /** \brief class constructor */
188 /** \brief class destructor */
190 virtual void setParent(JKQTBasePlotter* parent);
191 /** \brief loads the plot properties from a QSettings object */
192 virtual void loadSettings(const QSettings &settings, const QString& group=QString("plots/axes/"));
193
194 /** \brief saves the plot properties into a QSettings object.
195 *
196 * This method only saves those properties that differ from their default value.
197 */
198 virtual void saveSettings(QSettings& settings, const QString& group=QString("plots/axes/")) const;
199
200
201 /** \brief return x-pixel coordinate from x coordinate */
202 inline double x2p(double x) const {
203 double r=0;
204 if (logAxis) {
205 if (x<=0) r= offset+scaleSign*log(axismin)/log(logAxisBase)*scale;
206 else r= offset+scaleSign*log(x)/log(logAxisBase)*scale;
207 } else {
208 r= offset+scaleSign*x*scale;
209 }
210 if (inverted) {
211 return 2.0*getParentPlotOffset()+getParentPlotWidth()-r;//getParentPlotOffset()+getParentPlotWidth()-(r-getParentPlotOffset());
212 } else {
213 return r;
214 }
215 }
216
217 /** \brief return x coordinate from x-pixel */
218 inline double p2x(double x) const {
219 double xx=x;
220 if (inverted) {
221 xx=2.0*getParentPlotOffset()+getParentPlotWidth()-x;
222 }
223 xx=xx-offset;
224 if (logAxis) {
225 return exp(log(logAxisBase)*(xx)/(scaleSign*scale));
226 } else {
227 return xx/(scaleSign*scale);
228 }
229 }
230
231
232 /** \brief clear axis tick labels. This switches back to automatic labels mode for the axis. */
234
235 /** \brief add a new tick label to the axis */
236 void addAxisTickLabel(double x, const QString& label);
237
238
239 /** \brief add a new tick label to the axis */
240 void addAxisTickLabels(const QVector<double>& x, const QStringList& label);
241 /** \brief add a new tick label to the axis */
242 void addAxisTickLabels(const double* x, const QStringList& label);
243 /** \brief add a new tick label to the axis */
244 void addAxisTickLabels(const QVector<double>& x, const QString* label);
245 /** \brief add a new tick label to the axis */
246 void addAxisTickLabels(const double* x, const QString* label, int items);
247
248
249 /** \brief return value type for getSize1() and getSize2() */
251 inline AxisElementsSizeDescription(double _requiredSize=0.0, double _elongateMin=0.0, double _elongateMax=0.0): requiredSize(_requiredSize), elongateMin(_elongateMin), elongateMax(_elongateMax) {}
252
253 /** \brief required space, starting at the axis line, in outward direction [pixels] */
255 /** \brief extra space on the min (horizontal: left, vertical: bottom) side BESIDE the axis, e.g. when labels elongate to the left/right or top/bottom of the plot rectangle [pixels] */
257 /** \brief extra space on the max (horizontal: right, vertical: top) side BESIDE the axis, e.g. when labels elongate to the left/right or top/bottom of the plot rectangle [pixels] */
259 };
260
261 /** \brief returns the sizerequirement of the left/bottom axis in pixels
262 *
263 * \param painter a JKQTPEnhancedPainter to use for determining sizes (the same that would be used for drawing!)
264 *
265 * \returns size of the additional space outside the plot rectangle, required for the axis.
266 */
268
269 /** \brief returns the size of the right/top axis in pixels
270 *
271 * \param painter a JKQTPEnhancedPainter to use for determining sizes (the same that would be used for drawing!)
272 *
273 * \returns size of the additional space outside the plot rectangle, required for the axis.
274 */
276
277 /** \brief draw the axes
278 *
279 * \param painter the painter to use for drawing
280 * \param move1 offset in pixels on the major side (horizontal: bottom, vertical: left)
281 * \param move2 offset in pixels on the secondary side (horizontal: top, vertical: right)
282 */
283 virtual void drawAxes(JKQTPEnhancedPainter& painter, int move1=0, int move2=0)=0;
284
285 /** \brief draw grids */
286 virtual void drawGrids(JKQTPEnhancedPainter& painter)=0;
287
288
289 /** \copydoc tickSpacing */
290 inline double getTickSpacing() const { return this->tickSpacing; }
291 /** \copydoc JKQTPCoordinateAxisStyle::labelDigits */
292 inline int getLabelDigits() const { return this->axisStyle.labelDigits; }
293 /** \copydoc autoAxisSpacing */
294 inline bool getAutoAxisSpacing() const { return this->autoAxisSpacing; }
295 /** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelsEnabled */
296 inline bool getMinorTickLabelsEnabled() const { return this->axisStyle.minorTickLabelsEnabled; }
297 /** \copydoc logAxis */
298 inline bool getLogAxis() const { return this->logAxis; }
299 /** \copydoc inverted */
300 inline bool getInverted() const { return this->inverted; }
301 /** \copydoc logAxisBase */
302 inline double getLogAxisBase() const { return this->logAxisBase; }
303 /** \copydoc userTickSpacing */
304 inline double getUserTickSpacing() const { return this->userTickSpacing; }
305 /** \copydoc userLogTickSpacing */
306 inline double getUserLogTickSpacing() const { return this->userLogTickSpacing; }
307 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelType */
308 inline JKQTPCALabelType getTickLabelType() const { return this->axisStyle.tickLabelType; }
309 /** \copydoc axisLabel */
310 inline QString getAxisLabel() const { return this->axisLabel; }
311 /** \copydoc tickUnitFactor */
312 inline double getTickUnitFactor() const { return this->tickUnitFactor; }
313 /** \copydoc tickUnitName */
314 inline QString getTickUnitName() const { return this->tickUnitName; }
315 /** \copydoc JKQTPCoordinateAxisStyle::labelPosition */
316 inline JKQTPLabelPosition getLabelPosition() const { return this->axisStyle.labelPosition; }
317 /** \copydoc JKQTPCoordinateAxisStyle::labelFontSize */
318 inline double getLabelFontSize() const { return this->axisStyle.labelFontSize; }
319 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelFontSize */
320 inline double getTickLabelFontSize() const { return this->axisStyle.tickLabelFontSize; }
321 /** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelFontSize */
322 inline double getMinorTickLabelFontSize() const { return this->axisStyle.minorTickLabelFontSize; }
323 /** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelFullNumber */
324 inline bool getMinorTickLabelFullNumber() const { return this->axisStyle.minorTickLabelFullNumber; }
325 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelAngle */
326 inline double getTickLabelAngle() const { return this->axisStyle.tickLabelAngle; }
327 /** \copydoc JKQTPCoordinateAxisStyle::minTicks */
328 inline unsigned int getMinTicks() const { return this->axisStyle.minTicks; }
329 /** \copydoc JKQTPCoordinateAxisStyle::minorTicks */
330 inline unsigned int getMinorTicks() const { return this->axisStyle.minorTicks; }
331 /** \copydoc JKQTPCoordinateAxisStyle::tickOutsideLength */
332 inline double getTickOutsideLength() const { return this->axisStyle.tickOutsideLength; }
333 /** \copydoc JKQTPCoordinateAxisStyle::arrowSizeFactor */
334 inline double getArrowSizeFactor() const { return this->axisStyle.arrowSizeFactor; }
335 /** \copydoc JKQTPCoordinateAxisStyle::minorTickOutsideLength */
336 inline double getMinorTickOutsideLength() const { return this->axisStyle.minorTickOutsideLength; }
337 /** \copydoc JKQTPCoordinateAxisStyle::axisColor */
338 inline QColor getAxisColor() const { return this->axisStyle.axisColor; }
339 /** \copydoc JKQTPCoordinateAxisStyle::labelColor */
340 inline QColor getLabelColor() const { return this->axisStyle.labelColor; }
341 /** \copydoc JKQTPCoordinateAxisStyle::minorTickColor */
342 inline QColor getMinorTickColor() const { return this->axisStyle.minorTickColor; }
343 /** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelColor */
344 inline QColor getMinorTickLabelColor() const { return this->axisStyle.minorTickLabelColor; }
345 /** \copydoc JKQTPCoordinateAxisStyle::tickColor */
346 inline QColor getTickColor() const { return this->axisStyle.tickColor; }
347 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelColor */
348 inline QColor getTickLabelColor() const { return this->axisStyle.tickLabelColor; }
349 /** \copydoc JKQTPCoordinateAxisStyle::showZeroAxis */
350 inline bool getShowZeroAxis() const { return this->axisStyle.showZeroAxis; }
351 /** \copydoc JKQTPGridStyle::lineColor */
352 inline QColor getGridColor() const { return this->axisStyle.majorGridStyle.lineColor; }
353 /** \copydoc JKQTPGridStyle::lineColor */
354 inline QColor getMinorGridColor() const { return this->axisStyle.minorGridStyle.lineColor; }
355 /** \copydoc JKQTPGridStyle::lineWidth */
356 inline double getGridWidth() const { return this->axisStyle.majorGridStyle.lineWidth; }
357 /** \copydoc JKQTPGridStyle::lineStyle */
358 inline Qt::PenStyle getGridStyle() const { return this->axisStyle.majorGridStyle.lineStyle; }
359 /** \copydoc JKQTPGridStyle::lineWidth */
360 inline double getMinorGridWidth() const { return this->axisStyle.minorGridStyle.lineWidth; }
361 /** \copydoc JKQTPGridStyle::lineStyle */
362 inline Qt::PenStyle getMinorGridStyle() const { return this->axisStyle.minorGridStyle.lineStyle; }
363 /** \copydoc JKQTPCoordinateAxisStyle::tickTimeFormat */
364 inline QString getTickTimeFormat() const { return this->axisStyle.tickTimeFormat; }
365 /** \copydoc JKQTPCoordinateAxisStyle::tickDateFormat */
366 inline QString getTickDateFormat() const { return this->axisStyle.tickDateFormat; }
367 /** \copydoc JKQTPCoordinateAxisStyle::tickDateTimeFormat */
368 inline QString getTickDateTimeFormat() const { return this->axisStyle.tickDateTimeFormat; }
369 /** \copydoc JKQTPCoordinateAxisStyle::tickPrintfFormat */
370 inline QString getTickPrintfFormat() const { return this->axisStyle.tickPrintfFormat; }
371 /** \copydoc JKQTPCoordinateAxisStyle::tickMode */
372 inline JKQTPLabelTickMode getTickMode() const { return this->axisStyle.tickMode; }
373#if __cplusplus >= 202002L
374# ifdef __cpp_lib_format
375 /** \copydoc JKQTPCoordinateAxisStyle::tickFormatFormat */
376 inline QString getTickFormatfFormat() const { return this->axisStyle.tickFormatFormat; }
377# endif
378#endif
379
380 /** \copydoc JKQTPCoordinateAxisStyle::drawMode0 */
381 inline JKQTPCADrawMode getDrawMode0() const { return this->axisStyle.drawMode0; }
382 /** \copydoc JKQTPCoordinateAxisStyle::drawMode1 */
383 inline JKQTPCADrawMode getDrawMode1() const { return this->axisStyle.drawMode1; }
384 /** \copydoc JKQTPCoordinateAxisStyle::drawMode2 */
385 inline JKQTPCADrawMode getDrawMode2() const { return this->axisStyle.drawMode2; }
386 /** \copydoc JKQTPCoordinateAxisStyle::minorTickWidth */
387 inline double getMinorTickWidth() const { return this->axisStyle.minorTickWidth; }
388 /** \copydoc JKQTPCoordinateAxisStyle::tickWidth */
389 inline double getTickWidth() const { return this->axisStyle.tickWidth; }
390 /** \copydoc JKQTPCoordinateAxisStyle::lineWidth */
391 inline double getLineWidth() const { return this->axisStyle.lineWidth; }
392 /** \copydoc JKQTPCoordinateAxisStyle::lineWidthZeroAxis */
393 inline double getLineWidthZeroAxis() const { return this->axisStyle.lineWidthZeroAxis; }
394 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelDistance */
395 inline double getTickLabelDistance() const { return this->axisStyle.tickLabelDistance; }
396 /** \copydoc JKQTPCoordinateAxisStyle::labelDistance */
397 inline double getLabelDistance() const { return this->axisStyle.labelDistance; }
398 /** \copydoc JKQTPGridStyle::enabled */
399 inline bool getDrawGrid() const { return this->axisStyle.majorGridStyle.enabled; }
400 /** \copydoc JKQTPGridStyle::enabled */
401 inline bool getDrawMinorGrid() const { return this->axisStyle.minorGridStyle.enabled; }
402 /** \copydoc JKQTPCoordinateAxisStyle::autoLabelDigits */
403 inline void setAutoLabelDigits(bool __value)
404 {
405 this->axisStyle.autoLabelDigits = __value;
406 }
407 /** \copydoc JKQTPCoordinateAxisStyle::autoLabelDigits */
408 inline bool getAutoLabelDigits() const
409 {
410 return this->axisStyle.autoLabelDigits;
411 }
412 /** \copydoc parent */
413 inline const JKQTBasePlotter* getParent() const { return this->parent; }
414 /** \copydoc parent */
415 inline JKQTBasePlotter* getParent() { return this->parent; }
416 /** \copydoc doUpdateScaling */
417 inline void setDoUpdateScaling(bool __value)
418 {
419 this->doUpdateScaling = __value;
420 }
421 /** \copydoc doUpdateScaling */
422 inline bool getDoUpdateScaling() const
423 {
424 return this->doUpdateScaling;
425 }
426
427
428 /** \brief returns the current min */
429 inline double getMin() const {return axismin; }
430
431 /** \brief returns the current max */
432 inline double getMax() const {return axismax; }
433
434 /** \brief returns the current absolute min */
435 inline double getAbsoluteMin() const {return axisabsoultemin; }
436
437 /** \brief returns the current absolute max */
438 inline double getAbsoluteMax() const {return axisabsoultemax; }
439 /** \brief calculate the scaling and offset values from axis min/max values
440 *
441 * This is only executed when \c paramChanged==true, as otherwise the data has to be still
442 * correct. recalculating may be forced by caling calcPlotScaing(true);
443 */
444 void calcPlotScaling(bool force=false);
445
446 /** \brief returns whether this axis uses logarithmic scaling */
447 bool isLogAxis() const;
448
449 /** \brief returns whether this axis uses linear scaling (is false e.g. for isLogAxis()==true) */
450 bool isLinearAxis() const;
451
452
453 /** \brief current style properties for this JKQTBasePlotter
454 *
455 * \see JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), \ref jkqtpplotter_styling
456 */
458
459 /** \brief replace the current style properties for this JKQTBasePlotter
460 *
461 * \see JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), \ref jkqtpplotter_styling
462 */
464 /** \brief replace the current style properties for this JKQTBasePlotter with properties loaded from \a settings
465 *
466 * \param settings the QSettings object to read from
467 * \param group group in \a settings to read from
468 *
469 * \see JKQTPCoordinateAxisStyle getCurrentAxisStyle(), \ref jkqtpplotter_styling
470 */
471 void loadCurrentAxisStyle(const QSettings& settings, const QString& group="plot/axes/");
472 /** \brief store the current style properties for this JKQTBasePlotter with properties loaded from \a settings
473 *
474 * \param settings the QSettings object to write to
475 * \param group group in \a settings to write to
476 *
477 * \see JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), \ref jkqtpplotter_styling
478 */
479 void saveCurrentAxisStyle(QSettings& settings, const QString& group="plot/axes/") const;
480
481 /** \brief width of the plot in the direction of the axis */
482 virtual double getParentPlotWidth() const=0;
483 /** \brief offset of the plot in the direction of the axis */
484 virtual double getParentPlotOffset() const=0;
485 /** \brief width of other (perpendicular) axis (needed for grids) */
486 virtual double getParentOtheraxisWidth() const=0;
487 /** \brief is other (perpendicular) axis inverted (needed for grids) */
488 virtual bool getParentOtheraxisInverted() const=0;
489 /** \brief pixel offset of (perpendicular) other axis (needed for grids) */
490 virtual double getParentOtheraxisOffset() const=0;
491 /** \brief calls x2p() of the other axis (or returns \c NAN if the other axis does not exist */
492 virtual double parentOtherAxisX2P(double x) const =0;
493
494 /** \brief convert a float to a tick label string */
495 QString floattolabel(double data) const;
496
497 /** \brief convert a float to a tick label string with a given precision */
498 QString floattolabel(double data, int past_comma) const;
499
500 public Q_SLOTS:
501 /** \brief set range of plot axis */
502 void setRange(double amin, double amax);
503 /** \brief sets absolutely limiting range of the plot
504 *
505 * The user (or programmer) cannot zoom to a viewport that is larger than the range given to this function.
506 *
507 * \param aamin absolute minimum of the axis
508 * \param aamax absolute maximum of the axis
509 *
510 * \note if the aspect ratio (set in the JKQTBasePlotter or JKQTPlotter) of this does not fit into the widget, it is possible that you don't see the complete contents!
511 *
512 * \see setAbsoluteX(), setAbsoluteY(), zoomToFit(), JKQTPCoordinateAxis::setAbsoluteRange()
513 */
514 void setAbsoluteRange(double aamin, double aamax);
515 /** \brief do not use an absolute range of plot axis */
517
518 /** \copydoc tickSpacing */
519 void setTickSpacing(double __value);
520
521 /** \copydoc axisMinWidth */
522 void setAxisMinWidth(double __value);
523
524 /** \copydoc autoAxisSpacing */
525 void setAutoAxisSpacing(bool __value);
526
527 /** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelsEnabled */
528 void setMinorTickLabelsEnabled(bool __value);
529
530 /** \copydoc logAxis */
531 void setLogAxis(bool __value) ;
532
533 /** \copydoc logAxisBase */
534 void setLogAxisBase (double __value);
535
536 /** \copydoc userTickSpacing */
537 void setUserTickSpacing (double __value);
538
539 /** \copydoc userLogTickSpacing */
540 void setUserLogTickSpacing (double __value);
541
542 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelType */
544
545 /** \copydoc JKQTPCoordinateAxisStyle::tickMode */
547 /** \copydoc JKQTPCoordinateAxisStyle::tickMode */
548 void setTickMode (int __value);
549
550 /** \copydoc axisLabel */
551 void setAxisLabel (const QString& __value);
552
553 /** \copydoc tickUnitName */
554 void setTickUnitName(const QString& __value);
555
556 /** \copydoc tickUnitFactor */
557 void setTickUnitFactor(double __value);
558 /** \brief sets tickUnitFactor and tickUnitName in one call
559 *
560 * \see calls setTickUnitName() and setTickUnitFactor()
561 */
562 void setTickUnit(double factor, const QString& name);
563 /** \brief sets pi-scaling for tickUnitFactor and tickUnitName in one call
564 *
565 * \image html axisstyle/axis_unit_scaling_pi.png
566 * \see calls setTickUnitName() and setTickUnitFactor()
567 */
569 /** \brief resets tickUnitFactor and tickUnitName in one call
570 *
571 * \see calls setTickUnit(), setTickUnitName() and setTickUnitFactor()
572 */
574
575 /** \copydoc JKQTPCoordinateAxisStyle::labelPosition */
577
578 /** \copydoc JKQTPCoordinateAxisStyle::labelFontSize */
579 void setLabelFontSize (double __value);
580
581 /** \copydoc JKQTPCoordinateAxisStyle::tickTimeFormat */
582 void setTickTimeFormat (const QString& __value);
583
584 /** \copydoc JKQTPCoordinateAxisStyle::tickDateFormat */
585 void setTickDateFormat (const QString& __value);
586
587
588 /** \copydoc JKQTPCoordinateAxisStyle::tickDateTimeFormat */
589 void setTickDateTimeFormat (const QString& __value);
590
591 /** \copydoc JKQTPCoordinateAxisStyle::tickPrintfFormat */
592 void setTickPrintfFormat(const QString& __value);
593#if __cplusplus >= 202002L
594# ifdef __cpp_lib_format
595 /** \copydoc JKQTPCoordinateAxisStyle::tickFormatFormat */
596 void setTickFormatFormat(const QString& __value);
597# endif
598#endif
599 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelFontSize */
600 void setTickLabelFontSize (double __value);
601
602 /** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelFontSize */
603 void setMinorTickLabelFontSize (double __value);
604
605 /** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelFullNumber */
606 void setMinorTickLabelFullNumber (bool __value);
607
608 /** \copydoc JKQTPCoordinateAxisStyle::minTicks */
609 void setMinTicks(unsigned int __value);
610
611 /** \copydoc JKQTPCoordinateAxisStyle::minorTicks */
612 void setMinorTicks (unsigned int __value);
613
614 /** \copydoc JKQTPCoordinateAxisStyle::minorTicks */
615 void setMinorTicks (int __value);
616
617 /** \copydoc JKQTPCoordinateAxisStyle::tickOutsideLength */
618 void setTickOutsideLength(double __value);
619
620 /** \copydoc JKQTPCoordinateAxisStyle::minorTickOutsideLength */
621 void setMinorTickOutsideLength (double __value);
622
623 /** \copydoc JKQTPCoordinateAxisStyle::tickInsideLength */
624 void setTickInsideLength(double __value);
625
626 /** \copydoc JKQTPCoordinateAxisStyle::minorTickInsideLength */
627 void setMinorTickInsideLength (double __value);
628
629 /** \copydoc JKQTPCoordinateAxisStyle::axisColor */
630 void setAxisColor (const QColor& __value);
631
632 /** \copydoc JKQTPCoordinateAxisStyle::showZeroAxis */
633 void setShowZeroAxis(bool __value);
634
635 /** \copydoc inverted */
636 void setInverted(bool __value);
637
638 /** \copydoc JKQTPGridStyle::lineColor */
639 void setGridColor(const QColor& __value);
640 /** \copydoc JKQTPGridStyle::lineColor */
641 void setGridColor(const QColor& __value, double alpha);
642
643 /** \copydoc JKQTPGridStyle::lineColor */
644 void setMinorGridColor(const QColor& __value);
645 /** \copydoc JKQTPGridStyle::lineColor */
646 void setMinorGridColor(const QColor& __value, double alpha);
647
648 /** \copydoc JKQTPGridStyle::lineWidth */
649 void setGridWidth (double __value);
650
651 /** \copydoc JKQTPGridStyle::lineStyle */
652 void setGridStyle(Qt::PenStyle __value);
653
654 /** \copydoc JKQTPGridStyle::lineWidth */
655 void setMinorGridWidth(double __value);
656
657 /** \copydoc JKQTPGridStyle::lineStyle */
658 void setMinorGridStyle (Qt::PenStyle __value);
659
660
661 /** \copydoc JKQTPCoordinateAxisStyle::drawMode1 */
663 /** \copydoc JKQTPCoordinateAxisStyle::drawMode0 */
665
666 /** \copydoc JKQTPCoordinateAxisStyle::drawMode2 */
668
669 /** \copydoc JKQTPCoordinateAxisStyle::minorTickWidth */
670 void setMinorTickWidth(double __value);
671
672 /** \copydoc JKQTPCoordinateAxisStyle::tickWidth */
673 void setTickWidth (double __value);
674
675 /** \copydoc JKQTPCoordinateAxisStyle::lineWidth */
676 void setLineWidth (double __value);
677
678 /** \copydoc JKQTPCoordinateAxisStyle::lineWidthZeroAxis */
679 void setLineWidthZeroAxis (double __value);
680
681 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelDistance */
682 void setTickLabelDistance(double __value);
683
684 /** \copydoc JKQTPCoordinateAxisStyle::labelDistance */
685 void setLabelDistance(double __value);
686 /** \copydoc JKQTPCoordinateAxisStyle::labelDigits */
687 void setLabelDigits(int __value);
688
689 /** \copydoc JKQTPGridStyle::enabled */
690 void setDrawGrid(bool __value);
691
692 /** \copydoc JKQTPGridStyle::enabled */
693 void setDrawMinorGrid(bool __value);
694
695
696 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelAngle */
697 void setTickLabelAngle(double __value);
698 /** \copydoc JKQTPCoordinateAxisStyle::arrowSizeFactor */
699 void setArrowSizeFactor(double f) ;
700 /** \copydoc JKQTPCoordinateAxisStyle::labelColor */
701 void setLabelColor(QColor c) ;
702 /** \copydoc JKQTPCoordinateAxisStyle::minorTickColor */
703 void setMinorTickColor(QColor c) ;
704 /** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelColor */
705 void setMinorTickLabelColor(QColor c) ;
706 /** \copydoc JKQTPCoordinateAxisStyle::tickColor */
707 void setTickColor(QColor c);
708 /** \copydoc JKQTPCoordinateAxisStyle::tickLabelColor */
709 void setTickLabelColor(QColor c) ;
710 /** \brief sets all colors (line, ticks, label, ...) of the axis */
711 void setColor(QColor c) ;
712
713 protected:
715 inline Axis0ElementsSizeDescription(double _requiredSize=0.0, double _requiredSizeOpposite=0.0, double _elongateMin=0.0, double _elongateMax=0.0): AxisElementsSizeDescription(_requiredSize, _elongateMin, _elongateMax), requiredSizeOpposite(_requiredSizeOpposite) {}
716 /** \brief additional size, required for the axis, in the opposite direction as AxisElementsSizeDescription::requiredSize */
718 inline double maxRequiredSize() const {
719 return qMax(requiredSize,requiredSizeOpposite);
720 }
721 };
722
723 /** \brief returns the size of the zero axis in pixels, the first part of the return-value is the lhs size and the second part the rhs size */
725 /** \brief indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ... */
727 /** \brief can be used to switch off calcPlotScaling() temporarily, while modifying some properties
728 *
729 * use setDoUpdateScaling() to set this property
730 *
731 * \see setDoUpdateScaling() and getDoUpdateScaling()
732 */
734
735 /** \brief simply calls the redrawPlot method of the parent plotter class */
737 /** \brief a list of tick labels.
738 *
739 * If this list contains items, this class will NOT plot a standard x-axis,
740 * but only mark the positions in this list. Every item is a x-position together with
741 * the label to be plotted there. The label may contain LaTeX markup.
742 */
743 QVector<QPair<double, QString> > tickLabels;
744 /** \brief retun parents JKQTMathText* object */
746 /** \brief retun parents JKQTMathText* object */
748
749
750 /** \brief parent plotter class */
752 /** \brief current view: minimum of axis */
753 double axismin;
754 /** \brief current view: maximum of axis */
755 double axismax;
756
757 /** \brief absoulte minimum of axis (axismin/axismax xan not be set below this) */
759 /** \brief absoulte maximum of axis (axismin/axismax xan not be set above this) */
761
762
763 /** \brief current style properties for this coordinate axis instance
764 *
765 * \see JKQTBasePlotterStyle, JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), \ref jkqtpplotter_styling
766 */
768
769 /** \brief absolute minimum range width, feature switched off when <0 */
771
772 /** \brief <b>calculated property:</b> width of plot on axis (calculated by calcPlotScaling() )
773 *
774 * \see calcPlotScaling(), calcTickSpacing()
775 */
776 double width;
777
778 /** \brief <b>calculated property:</b> axis scaling factor (calculated by calcPlotScaling() )
779 *
780 * \see calcPlotScaling(), calcTickSpacing()
781 */
782 double scale;
783 /** \brief <b>calculated property:</b> axis offset (calculated by calcPlotScaling() )
784 *
785 * \see calcPlotScaling(), calcTickSpacing()
786 */
787 double offset;
788 /** \brief indicates whether the axis is to be inverted or not
789 *
790 * \image html jkqtplotter_inverted_yaxis.png
791 */
793
794 /** \brief <b>calculated property:</b> x position of the first tick (calculated by calcPlotScaling() ). Given in system coordinates, not pixel coordinates.
795 *
796 * \see calcPlotScaling(), calcTickSpacing()
797 */
798 double tickStart;
799
800 /** \brief <b>calculated property:</b> indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() )
801 *
802 * \see calcPlotScaling(), calcTickSpacing()
803 */
805
806 /** \brief indicates whether the y axis has a logarithmic scale */
808 /** \brief the base for a logarithmic x axis */
810 /** \brief if autoXAxisSpacing is \c false then this value is used for xTickSpacing. So this is the property which
811 * is editable by use of public access methods.
812 */
814 /** \brief if autoXAxisSpacing is \c false then this value is used for xTickSpacing. So this is the property which
815 * is editable by use of public access methods.
816 */
818
819 /** \brief <b>calculated property:</b> axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes.
820 *
821 * \see calcPlotScaling(), calcTickSpacing()
822 */
824 /** \brief <b>calculated property:</b> axis tick spacing for logarithmic JKQTPCoordinateAxisStyle::ticks (calculated by calcPlotScaling() and calcTickSpacing() ) axes.
825 *
826 * \see calcPlotScaling()
827 */
829
830
831 /** \brief axis label of the axis */
832 QString axisLabel;
833
834 /** \brief tick values are the actual x/y-coordiniate, divided by this value (e.g. pu \f$ \pi \f$ to have an axis with values <tt>0, pi, 2pi, 3pi ...</tt>) */
836
837 /** \brief name of the factor tickUnitFactor. This string is used in tick-labels to write e.g. \c "2pi" instead of 6.28... */
839
840
841 /** \brief calculates the tick spacing for a linear axis that spans \a awidth and that should
842 * show at least \a JKQTPCoordinateAxisStyle::minTicks JKQTPCoordinateAxisStyle::ticks.
843 *
844 * The <b>algorithm</b> used in here works as follows:
845 *
846 * There is only a limited subset of allowed tick distances. These distances are 1 (resulting in 10 JKQTPCoordinateAxisStyle::ticks per decade, i.e. 0,1,2,3,4,...),
847 * 2 (5 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,2,4,...), 2.5 (4 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,2.5,5,...) and 5 (2 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,5,10,15,...). So the
848 * axis is divided into decades that each is divided into JKQTPCoordinateAxisStyle::ticks, as defined above. With these preconditions the algorithm tries
849 * to find a tick increment \f$ \Delta\mbox{tick} \f$ which is one of the above distances multiplied by a power \f$ \rho \f$ of 10.
850 * This increment is determined in a way, that the axis contains at least \a JKQTPCoordinateAxisStyle::minTicks JKQTPCoordinateAxisStyle::ticks:
851 * \f[ \Delta\mbox{tick}=f\cdot 10^\rho,\ \ \ \ \ f\in\{1, 2, 2.5, 5\} \f]
852 *
853 * -# The algorithm starts by finding a start exponent \f$ \rho_s=\left\lfloor\log_{10}(\mbox{awidth})\right\rfloor+3 \f$. This
854 * is a good (over)estimate for the biggest possible power \f$ \rho \f$.
855 * -# now we set \f$ \rho=\rho_0 \f$ and \f$ f=10 \f$.
856 * -# now the algorithm cycles through all possible factors \f$ f\in\{1, 2, 2.5, 5, 10\} \f$ (starting from 10) and calculates
857 * \f$ \Delta\mbox{tick}=f\cdot 10^\rho \f$. Then it checks whether \f$ \mbox{tickcount}=\mbox{round}\left(\frac{\mbox{awidth}}{\Delta\mbox{tick}}\right) \f$
858 * is smaller than \a JKQTPCoordinateAxisStyle::minTicks (if yes the algorithm reached its end and \f$ \Delta\mbox{tick} \f$ can be used.
859 * -# if \f$ f=1 \f$ is reached and checked \c false, then the algorithm decreases the exponent \f$ \rho \leftarrow \rho-1 \f$ and returns to step 3.
860 *
861 */
863 /** \brief same as calcLinearTickSpacing(), but for logarithmic scaling
864 *
865 * \see calcLinearTickSpacing()
866 * */
868
869 /** \brief Calculate the number of digits needed for the labels of an axis that starts at
870 * \a minval and where the tick spacing is \a tickSpacing.
871 *
872 * This method determines how many digits to output for the labels on a coordinate axis.
873 * This is done by testing different digit numbers and comparing subsequent labels. If two labels
874 * are equal, then we need more valid digits to distinguish them.
875 */
877
878
879
880 /** \brief axis prefix for storage of parameters */
881 QString axisPrefix;
882 /** \brief this is used by x2p() and p2x() to determine the sign */
883 double scaleSign;
884
885 /** \brief calculates the next label from the given parameters.
886 *
887 * \return \c true on success and \c false if there is no more label
888 * \param x \b before \b call: the position of the label for which the text should be returned (or JKQTPCoordinateAxisStyle::tickStart for first call),
889 * \b after \b call: position of the next label (given in world coordinates!)
890 * \param label \b after \b call: text of the (input) tick label This is an empty string, if the label is not visible!
891 * \param init call this function with \c init=true to obtain the first label (at JKQTPCoordinateAxisStyle::tickStart)
892 */
893 bool getNextLabel(double& x, QString& label, bool init=false);
894
895 /** \brief returns the distance from the current tick position (x before call) to the next tick position */
896 double getNextLabelDistance(double x);
897
898 /** \brief calculates the maximum width and height (returned as QSize) of all tick labels.
899 * Ascent and descent may also be returned in the two additional pointer arguments- */
900 QSizeF getMaxTickLabelSize(JKQTPEnhancedPainter& painter, double* ascent=nullptr, double* descent=nullptr);
901 /** \brief draw the axis line \a l (pointing from axismin to axismax) optionally decorated as specified by \a drawMode using JKQTPEnhancedPainter \a painter */
902 void drawAxisLine(JKQTPEnhancedPainter& painter, const QLineF& l, JKQTPCADrawMode drawMode) const;
903
904 /** \brief calculate the position of the zero-axis (and whether to draw it or not) */
905 double getZeroAxisPos(bool* drawZeroAxis=nullptr);
906
907 /** \brief figures out (possibly by probing the parent JKQTBasePloter), whether this axis is a secondary axis */
908 virtual bool isSecondaryAxis() const;
909
910
911};
912
913
914
915
916
917/*! \brief base class for vertical axes, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
918 \ingroup jkqtpbaseplotter_elements
919
920 The positioning of the different axis elements depends on the psition of the "other" axis (i.e. a horizontal/x-axis),
921 i.e. the corresponding vertical axis:
922
923 \image html JKQTPVerticalAxisPositioning.png
924
925 But this "other>" axis is not defined here, but has to be defined in derived classes by immplementing the corresponding
926 pure virtual functions:
927 - getParentPlotWidth()
928 - getParentPlotOffset()
929 - getParentOtheraxisWidth()
930 - getParentOtheraxisInverted()
931 - getParentOtheraxisOffset()
932 - parentOtherAxisX2P()
933 .
934
935 \see JKQTPHorizontalAxisBase
936 */
938 Q_OBJECT
939 protected:
940 public:
941 /** \brief class constructor */
943
944 /** \brief returns the size of the left axis in pixels */
947
948 /** \brief returns the size of the right axis in pixels */
951
952 /** copydoc JKQTPCoordinateAxis::drawAxes() */
953 virtual void drawAxes(JKQTPEnhancedPainter& painter, int move1=0, int move2=0) override;
954
955 /** copydoc JKQTPCoordinateAxis::drawGrids() */
956 virtual void drawGrids(JKQTPEnhancedPainter& painter) override;
957
958
959 protected:
960 /** copydoc JKQTPCoordinateAxis::getSize0() */
962 /** \brief draw a tick label on the left axis 1 with text \a label (with optional rotation) at ( \a xx , \a yy ) (in pixel)
963 *
964 * \param painter the JKQTPEnhancedPainter used for drawing
965 * \param xx the exact position of the tick in pixels
966 * \param yy the exact position of the tick in pixels
967 * \param labelOffset offset of the label from ( \a xx , \a yy ) in pt, this is typically equal to \c tickOuterLength+tickLabelDistance
968 * \param label text to display
969 * \param fontSize the fontSize of the label (in pt)
970 * \param isMinor indicates whether the axis tick is a minor tick
971 */
972 void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, bool isMinor=false) ;
973 /** \brief draw a tick label on the right axis 2 with text \a label (with optional rotation) at ( \a xx , \a yy ) (in pixel)
974 *
975 * \param painter the JKQTPEnhancedPainter used for drawing
976 * \param xx the exact position of the tick in pixels
977 * \param yy the exact position of the tick in pixels
978 * \param labelOffset offset of the label from ( \a xx , \a yy ) in pt, this is typically equal to \c tickOuterLength+tickLabelDistance
979 * \param label text to display
980 * \param fontSize the fontSize of the label (in pt)
981 * \param isMinor indicates whether the axis tick is a minor tick
982 */
983 void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, bool isMinor=false) ;
984 /** \brief draw the axis label using \a painter for axis 1 at \c x= \a left and \c y= \a bottom. \a labelMax is the maximum Size of all tick labels */
985 void drawAxisLabel1(JKQTPEnhancedPainter &painter, double left, double bottom, QSizeF labelMax, JKQTPCADrawMode drawMode);
986 /** \brief draw the axis label using \a painter for axis 2 at \c x= \a right and \c y= \a bottom. \a labelMax is the maximum Size of all tick labels */
987 void drawAxisLabel2(JKQTPEnhancedPainter &painter, double right, double bottom, QSizeF labelMax, JKQTPCADrawMode drawMode);
988
989};
990
991
992
993/*! \brief implements a vertical axis for use as primary, secondary, ... axis of a JKQTPBasePlotter,
994 * based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
995 \ingroup jkqtpbaseplotter_elements
996
997 The positioning of the different axis elements depends on the psition of the "other" axis (here x-axis),
998 i.e. the corresponding vertical axis:
999
1000 \image html JKQTPVerticalAxisPositioning.png
1001 */
1003 Q_OBJECT
1004 protected:
1005 public:
1006 /** \brief class constructor */
1008
1009
1010 /** copydoc JKQTPCoordinateAxis::getParentPlotWidth() */
1011 virtual double getParentPlotWidth() const override;
1012 /** copydoc JKQTPCoordinateAxis::getParentPlotOffset() */
1013 virtual double getParentPlotOffset() const override;
1014 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisWidth() */
1015 virtual double getParentOtheraxisWidth() const override;
1016 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisInverted() */
1017 virtual bool getParentOtheraxisInverted() const override;
1018 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisOffset() */
1019 virtual double getParentOtheraxisOffset() const override;
1020 /** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */
1021 virtual double parentOtherAxisX2P(double x) const override;
1022 /** \copydoc otherAxisRef */
1024 /** \brief returns the "other" axis, refernced by otherAxisRef */
1026
1027 protected:
1028
1029 /** \brief references the other axis fromm the JKQTPBasePLotter to use as "other" axis */
1031};
1032
1033
1034/*! \brief implements a position-indipendent vertical axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
1035 \ingroup jkqtpbaseplotter_elements
1036
1037
1038 This axis may be draw at a user-supplied position (used e.g. for color bar axes).
1039 The axis positioning parameters are supplied via the constructor,or setter methods.
1040
1041 \image html JKQTPVerticalIndependentAxisPositioning.png
1042
1043 Basically this class overwrites several virtual methods as follows:
1044 - getParentPlotWidth() returns axisWidth, provided in the connstructor or via setParentPlotWidth()
1045 - getParentPlotOffset() returns axisOffset, provided in the connstructor or via setParentPlotOffset()
1046 - getParentOtheraxisWidth() returns otherAxisWidth, provided in the connstructor or via setParentPlotOtheraxisWidth()
1047 - getParentOtheraxisOffset() returns otherAxisOffset, provided in the connstructor or via setParentPlotOtheraxisOffset()
1048 .
1049
1050 If it is paired with another axis, the parameters of that axis have to be given explizitly in the constructor or with setters.
1051
1052 */
1054 Q_OBJECT
1055 protected:
1056 public:
1057 /** \brief class constructor */
1058 JKQTPVerticalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter* parent);
1059
1060 /** copydoc JKQTPCoordinateAxis::getParentPlotWidth() */
1061 virtual double getParentPlotWidth() const override;
1062 /** copydoc JKQTPCoordinateAxis::getParentPlotOffset() */
1063 virtual double getParentPlotOffset() const override;
1064 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisWidth() */
1065 virtual double getParentOtheraxisWidth() const override;
1066 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisInverted() */
1067 virtual bool getParentOtheraxisInverted() const override;
1068 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisOffset() */
1069 virtual double getParentOtheraxisOffset() const override;
1070 /** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */
1071 virtual double parentOtherAxisX2P(double x) const override;
1072
1073 /** copydoc JKQTPCoordinateAxis::drawAxes() */
1074 virtual void drawAxes(JKQTPEnhancedPainter& painter, int move1=0, int move2=0) override;
1075
1076 public Q_SLOTS:
1077 /** \brief set the axis offset */
1078 virtual void setAxisOffset(double __value) ;
1079 /** \brief set the axis width */
1080 virtual void setAxisWidth(double __value) ;
1081 /** \brief set the other axis offset */
1082 virtual void setOtherAxisOffset(double __value) ;
1083 /** \brief set the other axis width */
1084 virtual void setOtherAxisWidth(double __value) ;
1085 /** \brief set whether the other axis is inverted */
1086 virtual void setOtherAxisInverted(bool __value) ;
1087
1088 protected:
1089 /** \brief the offset of the axis */
1091 /** \brief the width of the axis */
1093 /** \brief the width of the other axis */
1095 /** \brief the offset of the other axis */
1097 /** \brief indicates whether the other axis is inverted */
1099};
1100
1101
1102
1103/*! \brief base class for horizontal axes, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
1104 \ingroup jkqtpbaseplotter_elements
1105
1106 The positioning of the different axis elements depends on the psition of the "other" axis (i.e. a vertical/y-axis),
1107 i.e. the corresponding vertical axis:
1108
1109 \image html JKQTPHorizontalAxisPositioning.png
1110
1111
1112 But this "other>" axis is not defined here, but has to be defined in derived classes by immplementing the corresponding
1113 pure virtual functions:
1114 - getParentPlotWidth()
1115 - getParentPlotOffset()
1116 - getParentOtheraxisWidth()
1117 - getParentOtheraxisInverted()
1118 - getParentOtheraxisOffset()
1119 - parentOtherAxisX2P()
1120 .
1121
1122 \see JKQTPVerticalAxisBase
1123 */
1125 Q_OBJECT
1126 protected:
1127 public:
1128 /** \brief class constructor */
1130
1131 /** \brief returns the size of the bottom axis in pixels */
1134
1135 /** \brief returns the size of the top axis in pixels */
1138
1139 /** copydoc JKQTPCoordinateAxis::drawAxes() */
1140 virtual void drawAxes(JKQTPEnhancedPainter& painter, int move1=0, int move2=0) override;
1141
1142 /** copydoc JKQTPCoordinateAxis::drawGrids() */
1143 virtual void drawGrids(JKQTPEnhancedPainter& painter) override;
1144
1145
1146 protected:
1147 /** copydoc JKQTPCoordinateAxis::getSize0() */
1149 /** \brief draw a tick label on the lower axis 1 with text \a label (with optional rotation) at ( \a xx , \a yy ) (in pixel)
1150 *
1151 * \param painter the JKQTPEnhancedPainter used for drawing
1152 * \param xx the exact position of the tick in pixels
1153 * \param yy the exact position of the tick in pixels
1154 * \param labelOffset offset of the label from ( \a xx , \a yy ) in pt, this is typically equal to \c tickOuterLength+tickLabelDistance
1155 * \param label text to display
1156 * \param fontSize the fontSize of the label (in pt)
1157 * \param ascentMax maximum ascent of all tick labels
1158 * \param descentMax maximum descent of all tick labels
1159 * \param isMinor indicates whether the axis tick is a minor tick
1160 */
1161 void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, double ascentMax, double descentMax, bool isMinor=false) ;
1162 /** \brief draw a tick label on the upper axis 2 with text \a label (with optional rotation) at ( \a xx , \a yy ) (in pixel)
1163 *
1164 * \param painter the JKQTPEnhancedPainter used for drawing
1165 * \param xx the exact position of the tick in pixels
1166 * \param yy the exact position of the tick in pixels
1167 * \param labelOffset offset of the label from ( \a xx , \a yy ) in pt, this is typically equal to \c tickOuterLength+tickLabelDistance
1168 * \param label text to display
1169 * \param fontSize the fontSize of the label (in pt)
1170 * \param ascentMax maximum ascent of all tick labels
1171 * \param descentMax maximum descent of all tick labels
1172 * \param isMinor indicates whether the axis tick is a minor tick
1173 */
1174 void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, double ascentMax, double descentMax, bool isMinor=false) ;
1175 /** \brief draw the axis label using \a painter for axis 1 at \c x= \a left and \c y= \a bottom. \a labelMax is the maximum Size of all tick labels */
1176 void drawAxisLabel1(JKQTPEnhancedPainter &painter, double left, double bottom, QSizeF labelMax, JKQTPCADrawMode drawMode);
1177 /** \brief draw the axis label using \a painter for axis 2 at \c x= \a left and \c y= \a top. \a labelMax is the maximum Size of all tick labels */
1178 void drawAxisLabel2(JKQTPEnhancedPainter &painter, double left, double top, QSizeF labelMax, JKQTPCADrawMode drawMode);
1179
1180};
1181
1182
1183/*! \brief implements a horizontal axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
1184 \ingroup jkqtpbaseplotter_elements
1185
1186 The positioning of the different axis elements depends on the psition of the "other" axis (here y-axis),
1187 i.e. the corresponding vertical axis:
1188
1189 \image html JKQTPHorizontalAxisPositioning.png
1190 */
1192 Q_OBJECT
1193 protected:
1194 public:
1195 /** \brief class constructor */
1197
1198 /** copydoc JKQTPCoordinateAxis::getParentPlotWidth() */
1199 virtual double getParentPlotWidth() const override;
1200 /** copydoc JKQTPCoordinateAxis::getParentPlotOffset() */
1201 virtual double getParentPlotOffset() const override;
1202 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisWidth() */
1203 virtual double getParentOtheraxisWidth() const override;
1204 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisInverted() */
1205 virtual bool getParentOtheraxisInverted() const override;
1206 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisOffset() */
1207 virtual double getParentOtheraxisOffset() const override;
1208 /** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */
1209 virtual double parentOtherAxisX2P(double x) const override;
1210 /** \copydoc otherAxisRef */
1212 /** \brief returns the "other" axis, refernced by otherAxisRef */
1214
1215 protected:
1216
1217 /** \brief references the other axis fromm the JKQTPBasePLotter to use as "other" axis */
1219
1220};
1221
1222/*! \brief implements a position-indipendent horizontal axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
1223 \ingroup jkqtpbaseplotter_elements
1224
1225 This axis may be draw at a user-supplied position (used e.g. for color bar axes).
1226 The axis positioning parameters are supplied via the constructor,or setter methods.
1227
1228 \image html JKQTPHorizontalIndependentAxisPositioning.png
1229
1230 Basically this class overwrites several virtual methods as follows:
1231 - getParentPlotWidth() returns axisWidth, provided in the connstructor or via setParentPlotWidth()
1232 - getParentPlotOffset() returns axisOffset, provided in the connstructor or via setParentPlotOffset()
1233 - getParentOtheraxisWidth() returns otherAxisWidth, provided in the connstructor or via setParentPlotOtheraxisWidth()
1234 - getParentOtheraxisOffset() returns otherAxisOffset, provided in the connstructor or via setParentPlotOtheraxisOffset()
1235 .
1236
1237 If it is paired with another axis, the parameters of that axis have to be given explizitly in the constructor or with setters.
1238
1239 */
1241 Q_OBJECT
1242 protected:
1243 public:
1244 /** \brief class constructor */
1245 JKQTPHorizontalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter* parent);
1246
1247 /** copydoc JKQTPCoordinateAxis::getParentPlotWidth() */
1248 virtual double getParentPlotWidth() const override;
1249 /** copydoc JKQTPCoordinateAxis::getParentPlotOffset() */
1250 virtual double getParentPlotOffset() const override;
1251 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisWidth() */
1252 virtual double getParentOtheraxisWidth() const override;
1253 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisInverted() */
1254 virtual bool getParentOtheraxisInverted() const override;
1255 /** copydoc JKQTPCoordinateAxis::getParentOtheraxisOffset() */
1256 virtual double getParentOtheraxisOffset() const override;
1257 /** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */
1258 virtual double parentOtherAxisX2P(double x) const override;
1259 /** copydoc JKQTPCoordinateAxis::drawAxes() */
1260 virtual void drawAxes(JKQTPEnhancedPainter& painter, int move1=0, int move2=0) override;
1261 public Q_SLOTS:
1262 /** \brief set the axis offset */
1263 virtual void setAxisOffset(double __value);
1264 /** \brief set the axis width */
1265 virtual void setAxisWidth(double __value);
1266 /** \brief set the other axis offset */
1267 virtual void setOtherAxisOffset(double __value);
1268 /** \brief set the other axis width */
1269 virtual void setOtherAxisWidth(double __value);
1270 /** \brief set whether the other axis is inverted */
1271 virtual void setOtherAxisInverted(bool __value);
1272
1273 protected:
1274
1275
1276 /** \brief the offset of the axis */
1278 /** \brief the width of the axis */
1280 /** \brief the width of the other axis */
1282 /** \brief the offset of the other axis */
1284 /** \brief indicates whether the other axis is inverted */
1286};
1287
1288#endif // JKQTPCOORDINATEAXES_H
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
this class parses a mathematical markup string and can then draw the contained text/equation onto a Q...
Definition jkqtmathtext.h:192
this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter.
Definition jkqtpcoordinateaxes.h:181
virtual void saveSettings(QSettings &settings, const QString &group=QString("plots/axes/")) const
saves the plot properties into a QSettings object.
double getTickWidth() const
line width of ticks in pt
Definition jkqtpcoordinateaxes.h:389
JKQTPCoordinateAxis(JKQTBasePlotter *parent)
class constructor
int calcLinearUnitDigits()
Calculate the number of digits needed for the labels of an axis that starts at minval and where the t...
void setAbsoluteRange(double aamin, double aamax)
sets absolutely limiting range of the plot
void redrawPlot()
simply calls the redrawPlot method of the parent plotter class
void setTickLabelColor(QColor c)
color of axis tick labels
double getTickUnitFactor() const
tick values are the actual x/y-coordiniate, divided by this value (e.g. pu to have an axis with valu...
Definition jkqtpcoordinateaxes.h:312
double userLogTickSpacing
if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which ...
Definition jkqtpcoordinateaxes.h:817
bool getInverted() const
indicates whether the axis is to be inverted or not
Definition jkqtpcoordinateaxes.h:300
virtual double getParentPlotWidth() const =0
width of the plot in the direction of the axis
void setLabelColor(QColor c)
color of the axis label
void setTickLabelAngle(double __value)
rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal)
double tickSpacingLog
calculated property: axis tick spacing for logarithmic JKQTPCoordinateAxisStyle::ticks (calculated by...
Definition jkqtpcoordinateaxes.h:828
void setMinTicks(unsigned int __value)
minimum number of axis ticks
void setLabelDigits(int __value)
digits used for tick labels
bool isLinearAxis() const
returns whether this axis uses linear scaling (is false e.g. for isLogAxis()==true)
double getMinorTickLabelFontSize() const
fontsize of the minor axis tick labels
Definition jkqtpcoordinateaxes.h:322
bool logAxis
indicates whether the y axis has a logarithmic scale
Definition jkqtpcoordinateaxes.h:807
const JKQTPCoordinateAxisStyle & getCurrentAxisStyle() const
current style properties for this JKQTBasePlotter
double getTickLabelFontSize() const
fontsize of the axis tick labels
Definition jkqtpcoordinateaxes.h:320
bool isLogAxis() const
returns whether this axis uses logarithmic scaling
void setMinorTicks(int __value)
number of minor grid lines per axis tick interval
void addAxisTickLabels(const QVector< double > &x, const QStringList &label)
add a new tick label to the axis
void setTickUnit(double factor, const QString &name)
sets tickUnitFactor and tickUnitName in one call
JKQTPLabelPosition getLabelPosition() const
position of the axis label
Definition jkqtpcoordinateaxes.h:316
virtual void drawAxes(JKQTPEnhancedPainter &painter, int move1=0, int move2=0)=0
draw the axes
void setLineWidthZeroAxis(double __value)
line width of 0-line in pt
JKQTMathText * getParentMathText()
retun parents JKQTMathText* object
virtual void setParent(JKQTBasePlotter *parent)
void drawAxisLine(JKQTPEnhancedPainter &painter, const QLineF &l, JKQTPCADrawMode drawMode) const
draw the axis line l (pointing from axismin to axismax) optionally decorated as specified by drawMode...
double getLineWidthZeroAxis() const
line width of 0-line in pt
Definition jkqtpcoordinateaxes.h:393
JKQTBasePlotter * getParent()
parent plotter class
Definition jkqtpcoordinateaxes.h:415
void setAutoAxisSpacing(bool __value)
calculated property: indicates whether the object should use automatic tick spacing for the x axis (c...
bool getDrawGrid() const
indicates whether to draw the major grid lines
Definition jkqtpcoordinateaxes.h:399
double getMinorGridWidth() const
width of the grid lines (in pixel)
Definition jkqtpcoordinateaxes.h:360
double getMax() const
returns the current max
Definition jkqtpcoordinateaxes.h:432
virtual void drawGrids(JKQTPEnhancedPainter &painter)=0
draw grids
bool getDoUpdateScaling() const
can be used to switch off calcPlotScaling() temporarily, while modifying some properties
Definition jkqtpcoordinateaxes.h:422
double tickStart
calculated property: x position of the first tick (calculated by calcPlotScaling() )....
Definition jkqtpcoordinateaxes.h:798
QColor getMinorTickColor() const
color of minor ticks
Definition jkqtpcoordinateaxes.h:342
double getGridWidth() const
width of the grid lines (in pixel)
Definition jkqtpcoordinateaxes.h:356
double calcLogTickSpacing()
same as calcLinearTickSpacing(), but for logarithmic scaling
double getTickSpacing() const
calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for l...
Definition jkqtpcoordinateaxes.h:290
void setLogAxisBase(double __value)
the base for a logarithmic x axis
QString getTickDateFormat() const
format string for date tick labels, see QDateTime::toString() documentation for details on format str...
Definition jkqtpcoordinateaxes.h:366
void setMinorGridColor(const QColor &__value)
color of the grid
double getLineWidth() const
line width of axis in pt
Definition jkqtpcoordinateaxes.h:391
void setCurrentAxisStyle(const JKQTPCoordinateAxisStyle &style)
replace the current style properties for this JKQTBasePlotter
const JKQTBasePlotter * getParent() const
parent plotter class
Definition jkqtpcoordinateaxes.h:413
void setLineWidth(double __value)
line width of axis in pt
void setTickInsideLength(double __value)
length of an axis tick inside the plot border in pt
QString getTickDateTimeFormat() const
format string for datetime tick labels, see QDateTime::toString() documentation for details on format...
Definition jkqtpcoordinateaxes.h:368
void setAxisColor(const QColor &__value)
color of the axis (labels, ticks, axis itself ...)
double getUserTickSpacing() const
if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which ...
Definition jkqtpcoordinateaxes.h:304
QString floattolabel(double data) const
convert a float to a tick label string
void setMinorGridColor(const QColor &__value, double alpha)
color of the grid
void setLabelFontSize(double __value)
fontsize of the axis labels
double getTickOutsideLength() const
length of an axis tick outside the plot border in pt
Definition jkqtpcoordinateaxes.h:332
QColor getMinorGridColor() const
color of the grid
Definition jkqtpcoordinateaxes.h:354
unsigned int getMinTicks() const
minimum number of axis ticks
Definition jkqtpcoordinateaxes.h:328
virtual double getParentOtheraxisOffset() const =0
pixel offset of (perpendicular) other axis (needed for grids)
void setDrawMode2(JKQTPCADrawMode __value)
draw mode of the secondary (right/top) axis
double userTickSpacing
if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which ...
Definition jkqtpcoordinateaxes.h:813
JKQTPCoordinateAxisStyle axisStyle
current style properties for this coordinate axis instance
Definition jkqtpcoordinateaxes.h:767
void setMinorTickWidth(double __value)
line width of minor ticks in pt
double scaleSign
this is used by x2p() and p2x() to determine the sign
Definition jkqtpcoordinateaxes.h:883
void setAutoLabelDigits(bool __value)
when true, the digits of the labels are calculated automatically
Definition jkqtpcoordinateaxes.h:403
void setMinorTickInsideLength(double __value)
length of a minor axis tick inside the plot border in pt
void setMinorTickLabelsEnabled(bool __value)
if true, the plotter displays minor axis labels as number between 1 and 10 in some cases
JKQTPLabelTickMode getTickMode() const
mode of the major ticks
Definition jkqtpcoordinateaxes.h:372
double getMin() const
returns the current min
Definition jkqtpcoordinateaxes.h:429
QColor getGridColor() const
color of the grid
Definition jkqtpcoordinateaxes.h:352
virtual ~JKQTPCoordinateAxis()
class destructor
QColor getMinorTickLabelColor() const
color of minor tick labels
Definition jkqtpcoordinateaxes.h:344
void setGridColor(const QColor &__value, double alpha)
color of the grid
unsigned int getMinorTicks() const
number of minor grid lines per axis tick interval
Definition jkqtpcoordinateaxes.h:330
QString getTickUnitName() const
name of the factor tickUnitFactor. This string is used in tick-labels to write e.g....
Definition jkqtpcoordinateaxes.h:314
virtual double parentOtherAxisX2P(double x) const =0
calls x2p() of the other axis (or returns NAN if the other axis does not exist
QString getAxisLabel() const
axis label of the axis
Definition jkqtpcoordinateaxes.h:310
void setTickOutsideLength(double __value)
length of an axis tick outside the plot border in pt
double getAbsoluteMax() const
returns the current absolute max
Definition jkqtpcoordinateaxes.h:438
void setShowZeroAxis(bool __value)
indicates whether to draw a thick axis line at x=0 (zero axis)
virtual AxisElementsSizeDescription getSize2(JKQTPEnhancedPainter &painter)=0
returns the size of the right/top axis in pixels
bool paramsChanged
indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ....
Definition jkqtpcoordinateaxes.h:726
double getAbsoluteMin() const
returns the current absolute min
Definition jkqtpcoordinateaxes.h:435
double offset
calculated property: axis offset (calculated by calcPlotScaling() )
Definition jkqtpcoordinateaxes.h:787
virtual void loadSettings(const QSettings &settings, const QString &group=QString("plots/axes/"))
loads the plot properties from a QSettings object
void setTickUnitFactor(double __value)
tick values are the actual x/y-coordiniate, divided by this value (e.g. pu to have an axis with valu...
void setTickWidth(double __value)
line width of ticks in pt
void setMinorGridWidth(double __value)
width of the grid lines (in pixel)
void setTickColor(QColor c)
color of axis ticks
bool getAutoAxisSpacing() const
calculated property: indicates whether the object should use automatic tick spacing for the x axis (c...
Definition jkqtpcoordinateaxes.h:294
double scale
calculated property: axis scaling factor (calculated by calcPlotScaling() )
Definition jkqtpcoordinateaxes.h:782
QVector< QPair< double, QString > > tickLabels
a list of tick labels.
Definition jkqtpcoordinateaxes.h:743
void setTickDateTimeFormat(const QString &__value)
format string for datetime tick labels, see QDateTime::toString() documentation for details on format...
QColor getTickLabelColor() const
color of axis tick labels
Definition jkqtpcoordinateaxes.h:348
virtual Axis0ElementsSizeDescription getSize0(JKQTPEnhancedPainter &painter)
returns the size of the zero axis in pixels, the first part of the return-value is the lhs size and t...
void setGridStyle(Qt::PenStyle __value)
line stye of the grid lines
void addAxisTickLabels(const double *x, const QString *label, int items)
add a new tick label to the axis
virtual double getParentPlotOffset() const =0
offset of the plot in the direction of the axis
double axisabsoultemax
absoulte maximum of axis (axismin/axismax xan not be set above this)
Definition jkqtpcoordinateaxes.h:760
double axisabsoultemin
absoulte minimum of axis (axismin/axismax xan not be set below this)
Definition jkqtpcoordinateaxes.h:758
QString axisPrefix
axis prefix for storage of parameters
Definition jkqtpcoordinateaxes.h:881
void setTickLabelFontSize(double __value)
fontsize of the axis tick labels
bool getAutoLabelDigits() const
when true, the digits of the labels are calculated automatically
Definition jkqtpcoordinateaxes.h:408
QString tickUnitName
name of the factor tickUnitFactor. This string is used in tick-labels to write e.g....
Definition jkqtpcoordinateaxes.h:838
void loadCurrentAxisStyle(const QSettings &settings, const QString &group="plot/axes/")
replace the current style properties for this JKQTBasePlotter with properties loaded from settings
void setDrawMode0(JKQTPCADrawMode __value)
draw mode of the zero axis
void addAxisTickLabel(double x, const QString &label)
add a new tick label to the axis
void addAxisTickLabels(const QVector< double > &x, const QString *label)
add a new tick label to the axis
void setDoUpdateScaling(bool __value)
can be used to switch off calcPlotScaling() temporarily, while modifying some properties
Definition jkqtpcoordinateaxes.h:417
void setGridColor(const QColor &__value)
color of the grid
void setTickSpacing(double __value)
calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for l...
void setUserTickSpacing(double __value)
if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which ...
JKQTPCADrawMode getDrawMode2() const
draw mode of the secondary (right/top) axis
Definition jkqtpcoordinateaxes.h:385
void setAxisLabel(const QString &__value)
axis label of the axis
bool getMinorTickLabelFullNumber() const
indicates whether the minor tick labels should be full numbers, or just a number between 0....
Definition jkqtpcoordinateaxes.h:324
void setArrowSizeFactor(double f)
factor used to calculate the size of line arrows
void setDrawMinorGrid(bool __value)
indicates whether to draw the major grid lines
void setTickLabelType(JKQTPCALabelType __value)
indicates how to draw the labels
QSizeF getMaxTickLabelSize(JKQTPEnhancedPainter &painter, double *ascent=nullptr, double *descent=nullptr)
calculates the maximum width and height (returned as QSize) of all tick labels. Ascent and descent ma...
void setMinorGridStyle(Qt::PenStyle __value)
line stye of the grid lines
void clearAxisTickLabels()
clear axis tick labels. This switches back to automatic labels mode for the axis.
void setTickMode(JKQTPLabelTickMode __value)
mode of the major ticks
double getTickLabelDistance() const
distance between tick end and label start in pt
Definition jkqtpcoordinateaxes.h:395
void setMinorTickOutsideLength(double __value)
length of a minor axis tick outside the plot border in pt
double getZeroAxisPos(bool *drawZeroAxis=nullptr)
calculate the position of the zero-axis (and whether to draw it or not)
void calcPlotScaling(bool force=false)
calculate the scaling and offset values from axis min/max values
void setMinorTickColor(QColor c)
color of minor ticks
virtual double getParentOtheraxisWidth() const =0
width of other (perpendicular) axis (needed for grids)
bool getShowZeroAxis() const
indicates whether to draw a thick axis line at x=0 (zero axis)
Definition jkqtpcoordinateaxes.h:350
double calcLinearTickSpacing()
calculates the tick spacing for a linear axis that spans awidth and that should show at least JKQTPCo...
bool autoAxisSpacing
calculated property: indicates whether the object should use automatic tick spacing for the x axis (c...
Definition jkqtpcoordinateaxes.h:804
bool getLogAxis() const
indicates whether the y axis has a logarithmic scale
Definition jkqtpcoordinateaxes.h:298
void setTickLabelDistance(double __value)
distance between tick end and label start in pt
Qt::PenStyle getGridStyle() const
line stye of the grid lines
Definition jkqtpcoordinateaxes.h:358
double getLabelDistance() const
distance between tick label and axis label in pt
Definition jkqtpcoordinateaxes.h:397
QString axisLabel
axis label of the axis
Definition jkqtpcoordinateaxes.h:832
void setTickPrintfFormat(const QString &__value)
format string for printf tick labels, see https://en.wikipedia.org/wiki/Printf_format_string document...
virtual bool getParentOtheraxisInverted() const =0
is other (perpendicular) axis inverted (needed for grids)
void setTickMode(int __value)
mode of the major ticks
void setMinorTickLabelColor(QColor c)
color of minor tick labels
QColor getTickColor() const
color of axis ticks
Definition jkqtpcoordinateaxes.h:346
void setDrawMode1(JKQTPCADrawMode __value)
draw mode of the main (left/bottom) axis
bool doUpdateScaling
can be used to switch off calcPlotScaling() temporarily, while modifying some properties
Definition jkqtpcoordinateaxes.h:733
void setTickDateFormat(const QString &__value)
format string for date tick labels, see QDateTime::toString() documentation for details on format str...
void setMinorTickLabelFullNumber(bool __value)
indicates whether the minor tick labels should be full numbers, or just a number between 0....
QColor getAxisColor() const
color of the axis (labels, ticks, axis itself ...)
Definition jkqtpcoordinateaxes.h:338
void setMinorTicks(unsigned int __value)
number of minor grid lines per axis tick interval
bool inverted
indicates whether the axis is to be inverted or not
Definition jkqtpcoordinateaxes.h:792
double getUserLogTickSpacing() const
if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which ...
Definition jkqtpcoordinateaxes.h:306
void setLogAxis(bool __value)
indicates whether the y axis has a logarithmic scale
double width
calculated property: width of plot on axis (calculated by calcPlotScaling() )
Definition jkqtpcoordinateaxes.h:776
void setNoAbsoluteRange()
do not use an absolute range of plot axis
void setRange(double amin, double amax)
set range of plot axis
void saveCurrentAxisStyle(QSettings &settings, const QString &group="plot/axes/") const
store the current style properties for this JKQTBasePlotter with properties loaded from settings
double getLabelFontSize() const
fontsize of the axis labels
Definition jkqtpcoordinateaxes.h:318
JKQTPCADrawMode getDrawMode0() const
draw mode of the zero axis
Definition jkqtpcoordinateaxes.h:381
void setUserLogTickSpacing(double __value)
if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which ...
bool getNextLabel(double &x, QString &label, bool init=false)
calculates the next label from the given parameters.
double x2p(double x) const
return x-pixel coordinate from x coordinate
Definition jkqtpcoordinateaxes.h:202
void resetTickUnit()
resets tickUnitFactor and tickUnitName in one call
double p2x(double x) const
return x coordinate from x-pixel
Definition jkqtpcoordinateaxes.h:218
void setColor(QColor c)
sets all colors (line, ticks, label, ...) of the axis
double getNextLabelDistance(double x)
returns the distance from the current tick position (x before call) to the next tick position
double tickUnitFactor
tick values are the actual x/y-coordiniate, divided by this value (e.g. pu to have an axis with valu...
Definition jkqtpcoordinateaxes.h:835
double axismax
current view: maximum of axis
Definition jkqtpcoordinateaxes.h:755
virtual AxisElementsSizeDescription getSize1(JKQTPEnhancedPainter &painter)=0
returns the sizerequirement of the left/bottom axis in pixels
int getLabelDigits() const
digits used for tick labels
Definition jkqtpcoordinateaxes.h:292
void addAxisTickLabels(const double *x, const QStringList &label)
add a new tick label to the axis
double getMinorTickWidth() const
line width of minor ticks in pt
Definition jkqtpcoordinateaxes.h:387
double getArrowSizeFactor() const
factor used to calculate the size of line arrows
Definition jkqtpcoordinateaxes.h:334
void setMinorTickLabelFontSize(double __value)
fontsize of the minor axis tick labels
double tickSpacing
calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for l...
Definition jkqtpcoordinateaxes.h:823
double axismin
current view: minimum of axis
Definition jkqtpcoordinateaxes.h:753
void setTickUnitPi()
sets pi-scaling for tickUnitFactor and tickUnitName in one call
void setLabelPosition(JKQTPLabelPosition __value)
position of the axis label
double axisMinWidth
absolute minimum range width, feature switched off when <0
Definition jkqtpcoordinateaxes.h:770
double getLogAxisBase() const
the base for a logarithmic x axis
Definition jkqtpcoordinateaxes.h:302
void setDrawGrid(bool __value)
indicates whether to draw the major grid lines
double getTickLabelAngle() const
rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal)
Definition jkqtpcoordinateaxes.h:326
virtual bool isSecondaryAxis() const
figures out (possibly by probing the parent JKQTBasePloter), whether this axis is a secondary axis
JKQTPCALabelType getTickLabelType() const
indicates how to draw the labels
Definition jkqtpcoordinateaxes.h:308
void setTickTimeFormat(const QString &__value)
format string for time tick labels, see QDateTime::toString() documentation for details on format str...
double getMinorTickOutsideLength() const
length of a minor axis tick outside the plot border in pt
Definition jkqtpcoordinateaxes.h:336
bool getDrawMinorGrid() const
indicates whether to draw the major grid lines
Definition jkqtpcoordinateaxes.h:401
QColor getLabelColor() const
color of the axis label
Definition jkqtpcoordinateaxes.h:340
void setGridWidth(double __value)
width of the grid lines (in pixel)
QString getTickTimeFormat() const
format string for time tick labels, see QDateTime::toString() documentation for details on format str...
Definition jkqtpcoordinateaxes.h:364
double logAxisBase
the base for a logarithmic x axis
Definition jkqtpcoordinateaxes.h:809
void setTickUnitName(const QString &__value)
name of the factor tickUnitFactor. This string is used in tick-labels to write e.g....
QString floattolabel(double data, int past_comma) const
convert a float to a tick label string with a given precision
void setInverted(bool __value)
indicates whether the axis is to be inverted or not
void setAxisMinWidth(double __value)
absolute minimum range width, feature switched off when <0
JKQTBasePlotter * parent
parent plotter class
Definition jkqtpcoordinateaxes.h:751
JKQTPCADrawMode getDrawMode1() const
draw mode of the main (left/bottom) axis
Definition jkqtpcoordinateaxes.h:383
Qt::PenStyle getMinorGridStyle() const
line stye of the grid lines
Definition jkqtpcoordinateaxes.h:362
const JKQTMathText * getParentMathText() const
retun parents JKQTMathText* object
QString getTickPrintfFormat() const
format string for printf tick labels, see https://en.wikipedia.org/wiki/Printf_format_string document...
Definition jkqtpcoordinateaxes.h:370
bool getMinorTickLabelsEnabled() const
if true, the plotter displays minor axis labels as number between 1 and 10 in some cases
Definition jkqtpcoordinateaxes.h:296
void setLabelDistance(double __value)
distance between tick label and axis label in pt
Support Class for JKQTPCoordinateAxis, which summarizes all properties that define the visual styling...
Definition jkqtpcoordinateaxesstyle.h:87
this class extends the QPainter
Definition jkqtpenhancedpainter.h:33
base class for horizontal axes, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoo...
Definition jkqtpcoordinateaxes.h:1124
virtual void drawGrids(JKQTPEnhancedPainter &painter) override
virtual void drawAxes(JKQTPEnhancedPainter &painter, int move1=0, int move2=0) override
QSizeF getQSize1(JKQTPEnhancedPainter &painter)
virtual AxisElementsSizeDescription getSize1(JKQTPEnhancedPainter &painter) override
returns the size of the bottom axis in pixels
void drawTickLabel2(JKQTPEnhancedPainter &painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, double ascentMax, double descentMax, bool isMinor=false)
draw a tick label on the upper axis 2 with text label (with optional rotation) at ( xx ,...
QSizeF getQSize2(JKQTPEnhancedPainter &painter)
virtual Axis0ElementsSizeDescription getSize0(JKQTPEnhancedPainter &painter) override
void drawAxisLabel2(JKQTPEnhancedPainter &painter, double left, double top, QSizeF labelMax, JKQTPCADrawMode drawMode)
draw the axis label using painter for axis 2 at x= left and y= top. labelMax is the maximum Size of a...
void drawTickLabel1(JKQTPEnhancedPainter &painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, double ascentMax, double descentMax, bool isMinor=false)
draw a tick label on the lower axis 1 with text label (with optional rotation) at ( xx ,...
void drawAxisLabel1(JKQTPEnhancedPainter &painter, double left, double bottom, QSizeF labelMax, JKQTPCADrawMode drawMode)
draw the axis label using painter for axis 1 at x= left and y= bottom. labelMax is the maximum Size o...
virtual AxisElementsSizeDescription getSize2(JKQTPEnhancedPainter &painter) override
returns the size of the top axis in pixels
JKQTPHorizontalAxisBase(JKQTBasePlotter *parent)
class constructor
implements a horizontal axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoord...
Definition jkqtpcoordinateaxes.h:1191
JKQTPCoordinateAxisRef otherAxisRef
references the other axis fromm the JKQTPBasePLotter to use as "other" axis
Definition jkqtpcoordinateaxes.h:1218
virtual double getParentOtheraxisWidth() const override
JKQTPCoordinateAxisRef getOtherAxisRef() const
references the other axis fromm the JKQTPBasePLotter to use as "other" axis
virtual bool getParentOtheraxisInverted() const override
virtual double getParentPlotOffset() const override
JKQTPHorizontalAxis(JKQTBasePlotter *parent, JKQTPCoordinateAxisRef otherAxisRef_=JKQTPPrimaryAxis)
class constructor
virtual double getParentOtheraxisOffset() const override
const JKQTPCoordinateAxis * getOtherAxis() const
returns the "other" axis, refernced by otherAxisRef
virtual double parentOtherAxisX2P(double x) const override
virtual double getParentPlotWidth() const override
implements a position-indipendent horizontal axis, based on JKQTPCoordinateAxis (for most of document...
Definition jkqtpcoordinateaxes.h:1240
virtual double getParentPlotWidth() const override
bool otherAxisInverted
indicates whether the other axis is inverted
Definition jkqtpcoordinateaxes.h:1285
double otherAxisWidth
the width of the other axis
Definition jkqtpcoordinateaxes.h:1281
virtual double getParentOtheraxisOffset() const override
virtual void setAxisWidth(double __value)
set the axis width
virtual void setOtherAxisWidth(double __value)
set the other axis width
virtual void drawAxes(JKQTPEnhancedPainter &painter, int move1=0, int move2=0) override
virtual void setOtherAxisInverted(bool __value)
set whether the other axis is inverted
virtual double parentOtherAxisX2P(double x) const override
virtual double getParentOtheraxisWidth() const override
double axisOffset
the offset of the axis
Definition jkqtpcoordinateaxes.h:1277
double otherAxisOffset
the offset of the other axis
Definition jkqtpcoordinateaxes.h:1283
virtual void setAxisOffset(double __value)
set the axis offset
virtual void setOtherAxisOffset(double __value)
set the other axis offset
virtual double getParentPlotOffset() const override
virtual bool getParentOtheraxisInverted() const override
double axisWidth
the width of the axis
Definition jkqtpcoordinateaxes.h:1279
JKQTPHorizontalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter *parent)
class constructor
base class for vertical axes, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoord...
Definition jkqtpcoordinateaxes.h:937
QSizeF getQSize1(JKQTPEnhancedPainter &painter)
virtual void drawAxes(JKQTPEnhancedPainter &painter, int move1=0, int move2=0) override
virtual AxisElementsSizeDescription getSize1(JKQTPEnhancedPainter &painter) override
returns the size of the left axis in pixels
virtual AxisElementsSizeDescription getSize2(JKQTPEnhancedPainter &painter) override
returns the size of the right axis in pixels
void drawAxisLabel2(JKQTPEnhancedPainter &painter, double right, double bottom, QSizeF labelMax, JKQTPCADrawMode drawMode)
draw the axis label using painter for axis 2 at x= right and y= bottom. labelMax is the maximum Size ...
void drawTickLabel1(JKQTPEnhancedPainter &painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, bool isMinor=false)
draw a tick label on the left axis 1 with text label (with optional rotation) at ( xx ,...
QSizeF getQSize2(JKQTPEnhancedPainter &painter)
void drawAxisLabel1(JKQTPEnhancedPainter &painter, double left, double bottom, QSizeF labelMax, JKQTPCADrawMode drawMode)
draw the axis label using painter for axis 1 at x= left and y= bottom. labelMax is the maximum Size o...
virtual void drawGrids(JKQTPEnhancedPainter &painter) override
void drawTickLabel2(JKQTPEnhancedPainter &painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, bool isMinor=false)
draw a tick label on the right axis 2 with text label (with optional rotation) at ( xx ,...
virtual Axis0ElementsSizeDescription getSize0(JKQTPEnhancedPainter &painter) override
JKQTPVerticalAxisBase(JKQTBasePlotter *parent)
class constructor
implements a vertical axis for use as primary, secondary, ... axis of a JKQTPBasePlotter,...
Definition jkqtpcoordinateaxes.h:1002
JKQTPVerticalAxis(JKQTBasePlotter *parent, JKQTPCoordinateAxisRef otherAxisRef=JKQTPPrimaryAxis)
class constructor
JKQTPCoordinateAxisRef getOtherAxisRef() const
references the other axis fromm the JKQTPBasePLotter to use as "other" axis
virtual double getParentPlotWidth() const override
const JKQTPCoordinateAxis * getOtherAxis() const
returns the "other" axis, refernced by otherAxisRef
virtual double getParentPlotOffset() const override
virtual double getParentOtheraxisOffset() const override
virtual double parentOtherAxisX2P(double x) const override
virtual double getParentOtheraxisWidth() const override
JKQTPCoordinateAxisRef otherAxisRef
references the other axis fromm the JKQTPBasePLotter to use as "other" axis
Definition jkqtpcoordinateaxes.h:1030
virtual bool getParentOtheraxisInverted() const override
implements a position-indipendent vertical axis, based on JKQTPCoordinateAxis (for most of documentat...
Definition jkqtpcoordinateaxes.h:1053
virtual double parentOtherAxisX2P(double x) const override
virtual double getParentPlotOffset() const override
virtual void drawAxes(JKQTPEnhancedPainter &painter, int move1=0, int move2=0) override
virtual void setOtherAxisInverted(bool __value)
set whether the other axis is inverted
double axisWidth
the width of the axis
Definition jkqtpcoordinateaxes.h:1092
virtual void setAxisOffset(double __value)
set the axis offset
virtual double getParentOtheraxisOffset() const override
virtual void setOtherAxisWidth(double __value)
set the other axis width
JKQTPVerticalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter *parent)
class constructor
double axisOffset
the offset of the axis
Definition jkqtpcoordinateaxes.h:1090
virtual void setAxisWidth(double __value)
set the axis width
virtual double getParentOtheraxisWidth() const override
virtual double getParentPlotWidth() const override
double otherAxisOffset
the offset of the other axis
Definition jkqtpcoordinateaxes.h:1096
bool otherAxisInverted
indicates whether the other axis is inverted
Definition jkqtpcoordinateaxes.h:1098
double otherAxisWidth
the width of the other axis
Definition jkqtpcoordinateaxes.h:1094
virtual void setOtherAxisOffset(double __value)
set the other axis offset
virtual bool getParentOtheraxisInverted() const override
QFlags< JKQTPCADrawModeElements > JKQTPCADrawMode
drawing mode for a coordinate axis
Definition jkqtptools.h:430
JKQTPCoordinateAxes
named references for different oordinate axes in the plot
Definition jkqtpcoordinateaxes.h:42
JKQTPLabelPosition
position of the axis labels
Definition jkqtptools.h:508
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89
JKQTPCoordinateAxes JKQTPCoordinateAxisRef
type for indexing coordinate axes in a plot
Definition jkqtpcoordinateaxes.h:50
JKQTPCALabelType
display mode for the (axis) labels
Definition jkqtptools.h:449
JKQTPLabelTickMode
mode of the axis ticks
Definition jkqtptools.h:476
@ JKQTPPrimaryAxis
Definition jkqtpcoordinateaxes.h:43
@ JKQTPSecondaryAxis
Definition jkqtpcoordinateaxes.h:44
Definition jkqtpcoordinateaxes.h:714
Axis0ElementsSizeDescription(double _requiredSize=0.0, double _requiredSizeOpposite=0.0, double _elongateMin=0.0, double _elongateMax=0.0)
Definition jkqtpcoordinateaxes.h:715
double maxRequiredSize() const
Definition jkqtpcoordinateaxes.h:718
double requiredSizeOpposite
additional size, required for the axis, in the opposite direction as AxisElementsSizeDescription::req...
Definition jkqtpcoordinateaxes.h:717
return value type for getSize1() and getSize2()
Definition jkqtpcoordinateaxes.h:250
AxisElementsSizeDescription(double _requiredSize=0.0, double _elongateMin=0.0, double _elongateMax=0.0)
Definition jkqtpcoordinateaxes.h:251
double requiredSize
required space, starting at the axis line, in outward direction [pixels]
Definition jkqtpcoordinateaxes.h:254
double elongateMin
extra space on the min (horizontal: left, vertical: bottom) side BESIDE the axis, e....
Definition jkqtpcoordinateaxes.h:256
double elongateMax
extra space on the max (horizontal: right, vertical: top) side BESIDE the axis, e....
Definition jkqtpcoordinateaxes.h:258