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
jkqtpgraphsbase.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3
4
5
6 This software is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License (LGPL) as published by
8 the Free Software Foundation, either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License (LGPL) for more details.
15
16 You should have received a copy of the GNU Lesser General Public License (LGPL)
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20
21#ifndef JKQTPGRAPHSBASE_H
22#define JKQTPGRAPHSBASE_H
23
24#include <QString>
25#include <QPainter>
26#include <QPair>
27#include "jkqtplotter/jkqtpbaseelements.h"
28#include "jkqtplotter/jkqtpbaseplotter.h"
29#include "jkqtplotter/jkqtptools.h"
30#include "jkqtplotter/jkqtplotter_imexport.h"
31#include "jkqtplotter/jkqtpimagetools.h"
32
33// forward declarations
34class JKQTPlotter;
35class JKQTPDatastore;
37
38/** \brief this virtual base class of every element, which is part of a JKQTPlotter plot and may appear in its key
39 * (basically any type of graph, except overlay elements!)
40 * \ingroup jkqtplotter_basegraphs
41 *
42 * Each possible graph is represented by a child of this class. So additional plots may be created by
43 * deriving new JKQTPGraph classes. To do so implement/overwrite these functions:
44 * - void draw(JKQTPEnhancedPainter& painter);
45 * - void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect);
46 * - bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
47 * - bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
48 * - QColor getKeyLabelColor() const=0;
49 * .
50 *
51 * Optionally you may also overwrite these functions to draw elements outside the actual plot area (like e.g. colorbars):
52 * - void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace);
53 * - void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace);
54 * .
55 *
56 * In addition this class provudes protected
57 * functions that do coordinate transforms based on the current coordinate system, of the paren
58 * JKQTPlotter (i.e. using the axes JKQTPLott:xAxis and JKQTPlotter::yAxis as basis for the plotting).
59 *
60 * \see \ref jkqtplotter_graphsgroup_classstructure
61 */
63 Q_OBJECT
64 public:
65
66 /** \brief class constructor */
67 explicit JKQTPPlotElement(JKQTBasePlotter* parent=nullptr);
68
69 /** \brief default wirtual destructor */
70 virtual ~JKQTPPlotElement() = default;
71
72 /** \brief plots the graph to the plotter object specified as parent */
73 virtual void draw(JKQTPEnhancedPainter& painter)=0;
74
75 /** \brief plots a key marker inside the specified rectangle \a rect */
76 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect)=0;
77
78 /** \brief returns an image with a key marker inside */
79 QImage generateKeyMarker(QSize size=QSize(16,16));
80
81 /** \brief get the maximum and minimum x-value of the graph
82 *
83 * The result is given in the two parameters which are call-by-reference parameters!
84 *
85 * \param[out] minx minimal x-value used in the graph
86 * \param[out] maxx maximal x-value used in the graph
87 * \param[out] smallestGreaterZero the smalles x-value in the graph, which is larger than 0 (this is used in auto-sizing for logarithmic axes)
88 * \return \c true on success, i.e. if there were datapoints in the plot, or \c false on failure (e.g. when the graph is empty)
89 */
90 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero)=0;
91 /** \brief get the maximum and minimum y-value of the graph
92 *
93 * The result is given in the two parameters which are call-by-reference parameters!
94 *
95 * \param[out] miny minimal y-value used in the graph
96 * \param[out] maxy maximal y-value used in the graph
97 * \param[out] smallestGreaterZero the smalles y-value in the graph, which is larger than 0 (this is used in auto-sizing for logarithmic axes)
98 * \return \c true on success, i.e. if there were datapoints in the plot, or \c false on failure (e.g. when the graph is empty)
99 */
100 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero)=0;
101 /** \brief returns the color to be used for the key label */
102 virtual QColor getKeyLabelColor() const=0;
103
104 /** \brief returns the the title of the plot */
105 QString getTitle() const;
106 /** \brief returns whether the graph is visible in the plot */
107 bool isVisible() const;
108 /** \brief returns whether the graph is shown in a highlighted style in the plot */
109 bool isHighlighted() const;
110
111 /** \brief returns the parent painter class */
112 inline const JKQTBasePlotter* getParent() const { return parent; }
113 /** \brief returns the parent painter class */
114 inline JKQTBasePlotter* getParent() { return parent; }
115 /** \brief sets the parent painter class */
116 virtual void setParent(JKQTBasePlotter* parent);
117 /** \brief sets the parent painter class */
118 virtual void setParent(JKQTPlotter* parent);
119
120 Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
121 Q_PROPERTY(QString title READ getTitle WRITE setTitle)
122 Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted)
123 public Q_SLOTS:
124 /** \brief sets whether the graph is visible in the plot */
125 void setVisible(bool __value);
126 /** \brief sets whether the graph is drawn in a highlighted style in the plot */
127 void setHighlighted(bool __value);
128 /** \brief sets the title of the plot (for display in key!).
129 *
130 * \note If no title is supplied, no key entry is drawn. */
131 virtual void setTitle(const QString & __value);
132
133 public:
134
135
136 /*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
137
138 \note If you want to draw outside, then you'll also have to implement drawOutside()
139 */
140 virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace);
141
142 /*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
143
144 \note If you want to draw outside, then you'll also have to implement getOutsideSize(), so enough space is reserved
145
146 The four value supplied tell the method where to draw (inside one of the rectangles).
147 */
148 virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace);
149
150 /** \brief modes of operation for the function hitTest() */
152 HitTestXY, /*!< \brief find closest point in x- and y-direction simulatneously (i.e. measure direct distance) */
153 HitTestXOnly, /*!< \brief find closest point in x-direction only */
154 HitTestYOnly, /*!< \brief find closest point in y-direction only */
155 };
156 Q_ENUM(HitTestMode)
157
158 /*! \brief returns the closest distance of the plot element to the (screen pixel) position \a pos, or \c NAN
159
160 This function is used to implement hit tests, i.e. to test whether a graph is close to a given position \a posSystem.
161 The function will then return the distance of the closes graph-point and a label for this point. An example of what
162 can be done with this function is the tooltip tool that JKQTPlotter provides via its context-menu/toolbar. This tool
163 uses just the information of the closest point and its label to display a tooltip for that datapoint:
164
165 \see jkqtpmdaToolTipForClosestDataPoint for details.
166
167
168 \param posSystem position to test in system coordinates
169 \param[out] closestSpotSystem optional output of the closest point found on the plot element in system coordinates
170 \param[out] label optional output of a label for the closest point (that might e.g. be used in a tooltip)
171 \param mode search mode, i.e. use sqrt(dx*dx+dy*dy) as distance, or just the absoulte values along one of the
172 two coordinate axes. Note that the returned distance depends on this parameter!
173 \return NAN if not implemented, or if \a pos is very far from the plot element, or the closest distance (in screen pixels)
174 of \a pos from the plot element. Note that the returned distance depends on the choosen \a mode !!!
175 You can use JKQTPIsOKFloat() to check whether a valid distance was returned!
176
177
178 Since the graph base class does not have any knowledge about how to perform a hit test on you specific graph, there is only a
179 very general implementation in this class, which does not actually search through the graph itself, but searches through
180 extra data that hs to be written during draw() and is stored in m_hitTestData. The implentation this base-class only searches this
181 list of points+metadata to implement a basic hit-test. If the list is empty, of no close-by points are found (default), then
182 hitTest() will simply return \a NAN.
183
184 When writing a new graph, you can therefore implement hitTest() in one of these ways:
185 <ol>
186 <li> You simply fill m_hitTestData with appropriate data and rely on the implementation in JKQTPPlotElement to do the work for you:
187 You then need to call clearHitTestData() at the start of your draw() function and whenever you draw a datapoint, you add
188 its location and metadata to the internal storage with addHitTestData()
189 <li> You derive from a graph class that already has an implementation. JKQTPXYGraph is an example of this. That class searches
190 through all x-/y-coordinates in the internally known columns and even takes into account possible graph errors in the label,
191 when the graph is also derived from JKQTPXGraphErrorData or JKQTPYGraphErrorData. This implementation therefore covers
192 most graph types pre-packaged with JKQTPlotter
193 <li> You implement the function from scratch
194 </ol>
195
196 \see addHitTestData(), clearHitTestData(), m_hitTestData, HitTestLocation
197
198 */
199 virtual double hitTest(const QPointF & posSystem, QPointF* closestSpotSystem=nullptr, QString* label=nullptr, HitTestMode mode=HitTestXY) const;
200
201 /** \brief Dataset for a single point on the graph, associated with its data-column index and a label that can be used by a basic implementation of hitTest()
202 *
203 * \see hitTest()
204 */
206 inline HitTestLocation(): pos(JKQTP_NAN, JKQTP_NAN), index(-1), label("") {}
207 inline HitTestLocation(double x_, double y_, const QString& label_): pos(x_,y_), index(-1), label(label_) {}
208 inline HitTestLocation(const QPointF& pos_, const QString& label_): pos(pos_), index(-1), label(label_) {}
209 inline HitTestLocation(double x_, double y_, int index_, const QString& label_): pos(x_,y_), index(index_), label(label_) {}
210 inline HitTestLocation(const QPointF& pos_, int index_, const QString& label_): pos(pos_), index(index_), label(label_) {}
211 /** \brief position of the hit-test point */
212 QPointF pos;
213 /** \brief index of the hit-test point in the linked data-columns (or -1) */
214 int index;
215 /** \brief label for that specific hit-test point */
216 QString label;
217 };
218
219
220
221 /** \brief tool routine that transforms an x-coordinate (plot coordinate --> pixels) for this plot element, uses the axis referenced in xAxisRef */
222 double transformX(double x) const;
223
224 /** \brief tool routine that transforms a y-coordinate (plot coordinate --> pixels) for this plot element, uses the axis referenced in yAxisRef */
225 double transformY(double y) const;
226
227 /** \brief tool routine that backtransforms an x-coordinate (pixels --> plot coordinate) for this plot element, uses the axis referenced in xAxisRef */
228 double backtransformX(double x) const;
229
230 /** \brief tool routine that backtransforms a y-coordinate (pixels --> plot coordinate) for this plot element, uses the axis referenced in yAxisRef */
231 double backtransformY(double y) const;
232
233
234 /** \brief tool routine that transforms a QPointF according to the parent's transformation rules (plot coordinate --> pixels) */
235 inline QPointF transform(const QPointF& x) const {
236 return QPointF(transformX(x.x()), transformY(x.y()));
237 }
238
239
240 /** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules (pixels --> plot coordinate) */
241 inline QPointF backTransform(const QPointF& x) const {
242 return QPointF(backtransformX(x.x()), backtransformY(x.y()));
243 }
244
245 /** \brief tool routine that transforms a QPointF according to the parent's transformation rules (plot coordinate --> pixels) */
246 inline QPointF transform(double x, double y) const {
247 return transform(QPointF(x,y));
248 }
249
250 /** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules (pixels --> plot coordinate) */
251 inline QPointF backTransform(double x, double y) const {
252 return backTransform(QPointF(x,y));
253 }
254 /** \brief tool routine that transforms a QPolygonF according to the parent's transformation rules (plot coordinate --> pixels) */
255 QPolygonF transform(const QPolygonF& x) const;
256
257 /** \brief tool routine that transforms a QPolygonF according to the parent's transformation rules
258 * and returns a (non-closed) path consisting of lines (plot coordinate --> pixels) */
259 QPainterPath transformToLinePath(const QPolygonF& x) const;
260
261
262 /** \brief transform all x-coordinates in a vector \a x */
263 QVector<double> transformX(const QVector<double>& x) const;
264 /** \brief transform all y-coordinates in a vector \a x */
265 QVector<double> transformY(const QVector<double>& x) const;
266
267 /** \copydoc xAxisRef */
269 /** \copydoc xAxisRef */
271 /** \copydoc yAxisRef */
273 /** \copydoc yAxisRef */
275 /** \brief returns the actual x-Axis-object from the parent plotter, referenced in xAxisRef */
276 /** \brief returns the actual x-Axis-object from the parent plotter, referenced in xAxisRef */
277 inline const JKQTPCoordinateAxis* getXAxis() const {
278 return parent->getXAxis(xAxisRef);
279 }
280 /** \brief returns the actual y-Axis-object from the parent plotter, referenced in yAxisRef */
281 inline const JKQTPCoordinateAxis* getYAxis() const {
282 return parent->getYAxis(yAxisRef);
283 }
284 /** \brief set the coordinate axes to use for this plot element
285 *
286 * \see xAxisRef, yAxisRef, transformX(), transformY()
287 */
289
290 Q_PROPERTY(JKQTPCoordinateAxisRef xAxisRef READ getXAxisRef WRITE setXAxis)
291 Q_PROPERTY(JKQTPCoordinateAxisRef yAxisRef READ getYAxisRef WRITE setYAxis)
292
293 protected:
294
295 /** \brief clear the internal datastore for hitTest()
296 *
297 * \note This function has to be called at the start of draw()
298 * \see hitTest(), addHitTestData(), m_hitTestData, HitTestLocation
299 */
300 inline void clearHitTestData() { m_hitTestData.clear(); }
301 /** \brief reserve list entries for up to \a points graph points in the internal datastore for hitTest()
302 *
303 * \note Call this after clearHitTestData() for improved speed of subsequent addHitTestData() calls!
304 * \see hitTest(), addHitTestData(), m_hitTestData, HitTestLocation
305 */
306 inline void reserveHitTestData(int points) { m_hitTestData.reserve(qMax(10, abs(points))); }
307 /** \brief clear the internal datastore for hitTest()
308 *
309 * \note This function has to be called at the start of draw()
310 * \see hitTest(), clearHitTestData(), m_hitTestData, HitTestLocation, reserveHitTestData()
311 */
312 inline void addHitTestData(const HitTestLocation& loc) { m_hitTestData<<loc; }
313 /** \brief add a new point on the graph to the internal datastore for hitTest()
314 *
315 * \param x_ x-position of the graph point in system coordinates
316 * \param y_ y-position of the graph point in system coordinates
317 * \param label_ a label for this datapoint, that can e.g. be displayed in a tooltip for this point
318 *
319 * \see hitTest(), clearHitTestData(), m_hitTestData, HitTestLocation, reserveHitTestData()
320 */
321 inline void addHitTestData(double x_, double y_, const QString& label_) { addHitTestData(HitTestLocation(x_,y_,label_)); }
322 /** \brief clear the internal datastore for hitTest()
323 *
324 * \param pos_ position of the graph point in system coordinates
325 * \param label_ a label for this datapoint, that can e.g. be displayed in a tooltip for this point
326 *
327 * \see hitTest(), clearHitTestData(), m_hitTestData, HitTestLocation, reserveHitTestData()
328 */
329 inline void addHitTestData(const QPointF& pos_, const QString& label_) { addHitTestData(HitTestLocation(pos_,label_)); }
330 /** \brief add a new point on the graph to the internal datastore for hitTest(),
331 * this variant uses formatHitTestDefaultLabel() to auto-generate the label
332 *
333 * \param x_ x-position of the graph point in system coordinates
334 * \param y_ y-position of the graph point in system coordinates
335 * \param index_ index of the graph point in the internal data columns, or -1
336 * \param datastore datastore for formatHitTestDefaultLabel()
337 *
338 * \see hitTest(), clearHitTestData(), m_hitTestData, HitTestLocation, reserveHitTestData()
339 */
340 inline void addHitTestData(double x_, double y_, int index_=-1, const JKQTPDatastore* datastore=nullptr) { addHitTestData(HitTestLocation(x_,y_,formatHitTestDefaultLabel(x_,y_, index_, datastore))); }
341 /** \brief clear the internal datastore for hitTest(),
342 * this variant uses formatHitTestDefaultLabel() to auto-generate the label
343 *
344 * \param pos_ position of the graph point in system coordinates
345 * \param index_ index of the graph point in the internal data columns, or -1
346 * \param datastore datastore for formatHitTestDefaultLabel()
347 *
348 * \see hitTest(), clearHitTestData(), m_hitTestData, HitTestLocation, reserveHitTestData()
349 */
350 inline void addHitTestData(const QPointF& pos_, int index_=-1, const JKQTPDatastore* datastore=nullptr) { addHitTestData(HitTestLocation(pos_,formatHitTestDefaultLabel(pos_.x(), pos_.y(), index_, datastore))); }
351 /** \brief clear the internal datastore for hitTest()
352 *
353 * \param x_ x-position of the graph point in system coordinates
354 * \param y_ y-position of the graph point in system coordinates
355 * \param index_ index of the graph point in the internal data columns
356 * \param label_ a label for this datapoint, that can e.g. be displayed in a tooltip for this point
357 *
358 * \see hitTest(), clearHitTestData(), m_hitTestData, HitTestLocation, reserveHitTestData()
359 */
360 inline void addHitTestData(double x_, double y_, int index_, const QString& label_) { addHitTestData(HitTestLocation(x_,y_,index_,label_)); }
361 /** \brief clear the internal datastore for hitTest()
362 *
363 * \param pos_ position of the graph point in system coordinates
364 * \param index_ index of the graph point in the internal data columns
365 * \param label_ a label for this datapoint, that can e.g. be displayed in a tooltip for this point
366 *
367 * \see hitTest(), clearHitTestData(), m_hitTestData, HitTestLocation, reserveHitTestData()
368 */
369 inline void addHitTestData(const QPointF& pos_, int index_, const QString& label_) { addHitTestData(HitTestLocation(pos_,index_,label_)); }
370
371 /** \brief tool-function for hitTest(), which formats a default label, taking into account the x- and y-position (both provided)
372 * and optionally the errors of these positions.
373 *
374 * \param x x-position of the datapoint in system coordinates
375 * \param y y-position of the datapoint in system coordinates
376 * \param index the index of the data point in the associated data column(s), or -1 (optional!)
377 * \param datastore The datastore to read error data from (optional!)
378 * \returns a LaTeX formatted label
379 */
380 virtual QString formatHitTestDefaultLabel(double x, double y, int index=-1, const JKQTPDatastore *datastore=nullptr) const;
381 /** \brief converts a x-value \a v into a string, taking into account the type of x-axis */
382 QString xFloatToString(double v, int past_comma=-1) const;
383 /** \brief converts a x-value \a v into a string, taking into account the type of x-axis */
384 QString yFloatToString(double v, int past_comma=-1) const;
385 /** \brief the plotter object this object belongs to */
387
388 /** \brief title of the plot (for display in key!). If no title is supplied, no key entry is drawn. */
389 QString title;
390
391 /** \brief indicates whether the graph is visible in the plot */
392 bool visible;
393 /** \brief indicates whether the graph is shown in a "highlghted" in the plot */
394 bool highlighted;
395 /** \brief internal storage for the used parent plot style */
397 /** \brief indicates which coordinate axis to use for coordinate transforms in x-direction */
398 JKQTPCoordinateAxisRef xAxisRef;
399 /** \brief indicates which coordinate axis to use for coordinate transforms in y-direction */
400 JKQTPCoordinateAxisRef yAxisRef;
401
402
403
404 /** \brief dataset with graph-points and associated data from the function hitTest()
405 * \see hitTest(), HitTestLocation
406 */
407 QVector<HitTestLocation> m_hitTestData;
408
409};
410
411/** \brief this virtual base class of the (data-column based) graphs,
412 * which are part of a JKQTPlotter plot and which use the coordinate system
413 * of the JKQTPlotter (i.e. the two coordinate axes getXAxis() and getYAxis())
414 * as basis for the graphs
415 * \ingroup jkqtplotter_basegraphs
416 *
417 * This class adds features to work with data columns.
418 * - There are two properties datarange_start and datarange_end. By default they are -1 and therefore ignored.
419 * if they are != -1 the plotter only displays the datapoints with the indexes [datarange_start .. datarange_end]
420 * although there might be more data points available (range [0 .. maxDataPoints]). The datarange is cut at the
421 * full range, i.e. if datarange_end>maxDataPoints the plotter displays [datarange_start .. maxDataPoints].
422 * - Also there is a virtual function usesColumn() which checks whether a given column is used by this graph.
423 * Override this function in your derived graphs to indicate to JKQTPlotter / JKQTBasePlotter , which columns
424 * from the internal JKQTPDatastore are actually used. This information can be used e.g. for graph-specific data-export.
425 * .
426 *
427 * \see \ref jkqtplotter_graphsgroup_classstructure
428 */
430 Q_OBJECT
431 public:
432 /** \brief class constructor */
433 explicit JKQTPGraph(JKQTBasePlotter* parent=nullptr);
434
435 /** \brief default wirtual destructor */
436 virtual ~JKQTPGraph() = default ;
437
438
439 /** \brief returns \c true if the given column is used by the graph
440 *
441 * This virtual function indicates whether a given column is used by this graph.
442 * Override this function in your derived graphs to indicate to JKQTPlotter / JKQTBasePlotter , which columns
443 * from the internal JKQTPDatastore are actually used. This information can be used e.g. for graph-specific data-export.
444 */
445 virtual bool usesColumn(int column) const;
446
447 protected:
448 /** \brief this function is used to plot error inidcators before plotting the graphs.
449 *
450 * By default this function does nothing. But children of this class may overwrite it to implement
451 * drawing error indicators.
452 */
453 virtual void drawErrorsBefore(JKQTPEnhancedPainter& /*painter*/);
454 /** \brief this function is used to plot error inidcators after plotting the graphs.
455 *
456 * By default this function does nothing. But children of this class may overwrite it to implement
457 * drawing error indicators.
458 */
459 virtual void drawErrorsAfter(JKQTPEnhancedPainter& /*painter*/);
460
461 /** \brief get the maximum and minimum value of the given column
462 *
463 * The result is given in the two parameters which are call-by-reference parameters!
464 */
465 bool getDataMinMax(int column, double& minx, double& maxx, double& smallestGreaterZero);
466
467
468
469 protected:
470
471
473
474};
475
476
477/** \brief this is the virtual base class of all JKQTPPlotElement's in a JKQTPlotter plot that
478 * represent geometric forms.
479 * \ingroup jkqtplotter_basegraphs
480 *
481 * \see \ref jkqtplotter_graphsgroup_classstructure, \ref JKQTPlotterGeometricGraphs
482 *
483 * \section JKQTPGeometricPlotElement_coordinates Coordinate Systems
484 * JKQTPGeometricPlotElement's have extended coordinate transform capabilities, because in addition to using
485 * the plot coordinates, you can also choose to use different other coordinate systems.
486 *
487 * \section JKQTPGeometricPlotElement_DrawMode Draw Modes
488 *
489 * \copydetails m_drawMode
490 */
492 Q_OBJECT
493public:
494
495 /** \brief indicates how to draw the geometric object */
496 enum DrawMode {
497 DrawAsGraphicElement, /*!< \brief draw lines as lines (i.e. graphic elements) \image html JKQTPGeometricPlotElement_DrawAsGraphicElement.png */
498 DrawAsMathematicalCurve /*!< \brief draw lines as the mathematically correct curve \image html JKQTPGeometricPlotElement_DrawAsMathematicalCurve.png */
499 };
500 Q_ENUM(DrawMode)
501
502 /** \brief class constructor */
503 explicit JKQTPGeometricPlotElement(DrawMode drawMode=DrawAsGraphicElement, JKQTBasePlotter* parent=nullptr);
504
505 /** \brief default wirtual destructor */
507 /** \copybrief m_drawMode
508 *
509 * \return the currently set DrawMode
510 * \see m_drawMode, DrawMode
511 */
512 DrawMode getDrawMode() const;
513
514 Q_PROPERTY(DrawMode drawMode READ getDrawMode WRITE setDrawMode)
515public Q_SLOTS:
516 /** \copybrief m_drawMode
517 *
518 * \param mode the DrawMode to use from now on
519 * \see m_drawMode, DrawMode
520 */
521 void setDrawMode(DrawMode mode);
522protected:
523 /** \brief indicated whether to draw lines as graphic elements (even on non-linear coordinate systems),
524 * or as mathematically correct curves
525 *
526 * It is possible to define in which ways the forms shall be treated/drawn into non-linear
527 * coordinate systems (e.g. semi-log or log-log plots). Imagine drawing a line from (x1,y1) to (x2,y2)
528 * In a linear coordinate system, this is always a line, but in a non-linear system, the line might
529 * have to be represented by a curve instead. Depending on how you want to use the JKQTPGeometricPlotElement you
530 * can choose to still draw it as a line connecting the points (x1,y1) and (x2,y2), or as the -
531 * mathematically correct - curve connecting these two points:
532 *
533 * \image html JKQTPGeometricPlotElement_DrawAsMathematicalCurve.png
534 *
535 * \image html JKQTPGeometricPlotElement_DrawAsGraphicElement.png
536 *
537 * \see DrawMode, setDrawMode(), getDrawMode()
538 */
539 DrawMode m_drawMode;
540
541};
542
543
544/** \brief this is the virtual base class of all JKQTPPlotElement's in a JKQTPlotter plot that
545 * represent annotations of a plot. It differs from JKQTPGeometricPlotElement by not providing a
546 * selection of drawModes, as annotations are always drawn as graphic elements.
547 * \ingroup jkqtplotter_basegraphs
548 *
549 */
551 Q_OBJECT
552public:
553
554 /** \brief class constructor */
556
557 /** \brief default wirtual destructor */
559
560public Q_SLOTS:
561
562protected:
563
564};
565
566
567
568/** \brief This virtual JKQTPGraph descendent may be used as base for all graphs that use at least two columns
569 * that specify x and y coordinates for the single plot points.
570 * \ingroup jkqtplotter_basegraphs
571 *
572 * This class implements basic management facilities for the data columns:
573 * - setXColumn(), setYColumn() to set the columns to be used for the graph data
574 * - setDataSortOrder() to specify whether and how the data should be sorted before drawing
575 * \image html jkqtplotter_unsorted.png "Unsorted Data"
576 * \image html jkqtplotter_sortedx.png "Data sorted along x-axis (DataSortOrder::SortedX)"
577 * .
578 *
579 * ... and overrides/implements the functions:
580 * - getXMinMax()
581 * - getYMinMax()
582 * - usesColumn()
583 * .
584 *
585 */
587 Q_OBJECT
588public:
589 /** \brief specifies how to sort the data in a JKQTPXYGraph before drawing
590 *
591 * \image html jkqtplotter_unsorted.png "Unsorted Data"
592 *
593 * \image html jkqtplotter_sortedx.png "Data sorted along x-axis (DataSortOrder::SortedX)"
594 */
596 Unsorted=0, /*!< \brief the data for a JKQTPXYGraph is not sorted before drawing */
597 SortedX=1, /*!< \brief the data for a JKQTPXYGraph is sorted so the x-values appear in ascending before drawing */
598 SortedY=2 /*!< \brief the data for a JKQTPXYGraph is sorted so the y-values appear in ascending before drawing */
599 };
600 Q_ENUM(DataSortOrder)
601
602
603 /** \brief class constructor */
605
606 /** \copydoc JKQTPPlotElement::getXMinMax() */
607 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
608 /** \copydoc JKQTPPlotElement::getYMinMax() */
609 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
610
611 /** \copydoc JKQTPGraph::usesColumn() */
612 virtual bool usesColumn(int column) const override;
613
614 /** \copydoc xColumn */
615 int getXColumn() const;
616 /** \copydoc yColumn */
617 int getYColumn() const;
618 /** \copydoc sortData */
619 DataSortOrder getDataSortOrder() const;
620 /** \brief returns the column used as "key" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
621 virtual int getKeyColumn() const;
622 /** \brief returns the column used as "value" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
623 virtual int getValueColumn() const;
624
625 Q_PROPERTY(DataSortOrder sortData READ getDataSortOrder WRITE setDataSortOrder)
626 Q_PROPERTY(int xColumn READ getXColumn WRITE setXColumn)
627 Q_PROPERTY(int yColumn READ getYColumn WRITE setYColumn)
628
629
630 /** \brief Implmentation of JKQTPPlotElement::hitTest(), which searches through all graph points defined by xColumn and yColumn
631 * and returns a general x/y-label, also taking into account possibly known errors to the graphs (if it is derived
632 * from JKQTPXGraphErrorData and/or JKQTPYGraphErrorData
633 *
634 * \note This function first checks whether JKQTPPlotElement::hitTest() returns any result, so you can use the basic implementation
635 * in JKQTPPlotElement to override the behaviour here, by simply calling addHitTestData() during your draw() implementation
636 *
637 * \see See JKQTPPlotElement::hitTest() for details on the function definition!
638 */
639 virtual double hitTest(const QPointF &posSystem, QPointF* closestSpotSystem=nullptr, QString* label=nullptr, HitTestMode mode=HitTestXY) const override;
640public Q_SLOTS:
641 /** \brief sets xColumn and yColumn at the same time */
642 void setXYColumns(size_t xCol, size_t yCol);
643 /** \brief sets xColumn and yColumn at the same time */
644 void setXYColumns(int xCol, int yCol);
645#if QT_VERSION<QT_VERSION_CHECK(6,0,0)
646 /** \brief sets xColumn and yColumn at the same time */
647 void setXYColumns(std::pair<int,int> xyColPair);
648 /** \brief sets xColumn and yColumn at the same time */
649 void setXYColumns(std::pair<size_t,size_t> xyColPair);
650#endif
651 /** \brief sets xColumn and yColumn at the same time */
652 void setXYColumns(QPair<int,int> xyColPair);
653 /** \brief sets xColumn and yColumn at the same time */
654 void setXYColumns(QPair<size_t,size_t> xyColPair);
655 /** \copydoc sortData */
656 void setDataSortOrder(int __value);
657 /** \copydoc sortData */
659 /** \copydoc xColumn */
660 void setXColumn(int __value);
661 /** \copydoc xColumn */
662 void setXColumn (size_t __value);
663 /** \copydoc yColumn */
664 void setYColumn(int __value);
665 /** \copydoc yColumn */
666 void setYColumn (size_t __value);
667 /** \brief sets the column used as "key" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
668 virtual void setKeyColumn(int __value);
669 /** \brief sets the column used as "value" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
670 virtual void setValueColumn(int __value);
671protected:
672
673 /** \brief the column that contains the x-component of the datapoints */
674 int xColumn;
675 /** \brief the column that contains the y-component of the datapoints */
676 int yColumn;
677
678 /** \brief if \c !=Unsorted, the data is sorted before plotting */
679 DataSortOrder sortData;
680 /** \brief this array contains the order of indices, in which to access the data in the data columns */
681 QVector<int> sortedIndices;
682 /** \brief sorts data according to the specified criterion in \a sortData ... The result is stored as a index-map in sorted Indices */
683 virtual void intSortData();
684 /** \brief returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
685 *
686 * This function can beu used to get the correct datapoint after sorting the datapoints,
687 * As sorting is done by sorting an index and not reordering the data in the columns themselves.
688 *
689 * \see setDataSortOrder(), getDataSortOrder()
690 * */
691 inline int getDataIndex(int i) const {
692 if (sortData==Unsorted) return i;
693 return sortedIndices.value(i,i);
694 }
695
696 /** \brief determines the range of row indexes available in the data columns of this graph
697 *
698 * \param[out] imin first usable row-index
699 * \param[out] imax last usable row-index
700 * \return \c true on success and \c false if the information is not available
701 */
702 virtual bool getIndexRange(int &imin, int &imax) const;
703};
704
705
706
707/** \brief This virtual JKQTPGraph descendent extends JKQTPXYGraph adds a baseline-property, which is necessary, e.g. for barcharts, filled graphs to indicate until where to draw the bar or fill the curve (default is 0).
708 * \ingroup jkqtplotter_basegraphs
709 *
710 * \see JKQTPSpecialLineHorizontalGraph, JKQTPBarVerticalGraph, JKQTPImpulsesHorizontalGraph, ...
711 */
713 Q_OBJECT
714public:
715
716 /** \brief class constructor */
718
719 /** \copydoc m_baseline */
720 double getBaseline() const;
721
722 Q_PROPERTY(double baseline READ getBaseline WRITE setBaseline)
723public Q_SLOTS:
724 /** \copydoc m_baseline */
725 void setBaseline(double __value);
726
727protected:
728 /** \brief can be called by JKQTPGraph::getXMinMax() or JKQTPGraph::getYMinMax() calculates min/max/... for data from the given column, including the baseline */
729 bool getMinMaxWithBaseline(int dataColumn, double &minv, double &maxv, double &smallestGreaterZero);
730 /** \brief can be called by JKQTPGraph::getXMinMax() or JKQTPGraph::getYMinMax() calculates min/max/... for data from the given column, including the baseline and an optional error */
731 bool getMinMaxWithErrorsAndBaseline(int dataColumn, int errorColumn, int errorColumnLower, bool errorSymmetric, double &minv, double &maxv, double &smallestGreaterZero);
732
733
734 /** \brief baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!)
735 *
736 * \image html impulsesplot_baseline.png
737 */
739
740private:
741 /** \brief returns the upper error for the i-th datapoint, read from datastore \a ds */
742 double getErrorU(int i, const JKQTPDatastore* ds, int xErrorColumn) const;
743 /** \brief returns the lower error for the i-th datapoint, read from datastore \a ds */
744 double getErrorL(int i, const JKQTPDatastore *ds, int xErrorColumn, int xErrorColumnLower, bool xErrorSymmetric) const;
745
746};
747
748
749/** \brief This virtual JKQTPGraph descendent extends JKQTPXYGraph to two columns for y-values (e.g. for filled range plots in JKQTPFilledVerticalRangeGraph).
750 * \ingroup jkqtplotter_basegraphs
751 *
752 * \see JKQTPXXYGraph and e.g. JKQTPFilledVerticalRangeGraph
753 */
755 Q_OBJECT
756public:
757
758 /** \brief class constructor */
760
761
762 /** \copydoc JKQTPPlotElement::getYMinMax() */
763 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
764
765 /** \copydoc JKQTPGraph::usesColumn() */
766 virtual bool usesColumn(int column) const override;
767
768 /** \copydoc yColumn2 */
769 int getYColumn2() const;
770 /** \brief returns the column used as secondary "value" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
771 virtual int getValue2Column() const;
772
773 /** \copydoc JKQTPXYGraph::hitTest() */
774 virtual double hitTest(const QPointF &posSystem, QPointF* closestSpotSystem=nullptr, QString* label=nullptr, HitTestMode mode=HitTestXY) const override;
775
776 Q_PROPERTY(int yColumn2 READ getYColumn2 WRITE setYColumn2)
777public Q_SLOTS:
778 /** \brief sets xColumn, yColumn and yColumn2 at the same time */
779 void setXYYColumns(size_t xCol, size_t yCol, size_t y2Col);
780 /** \brief sets xColumn, yColumn and yColumn2 at the same time */
781 void setXYYColumns(int xCol, int yCol, int y2Col);
782
783
784 /** \copydoc yColumn2 */
785 void setYColumn2(int __value);
786 /** \copydoc yColumn2 */
787 void setYColumn2(size_t __value);
788 /** \brief sets the column used as secondary "value" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
789 virtual void setValue2Column(int __value);
790protected:
791
792 /** \brief the column that contains the second y-component of the datapoints */
793 int yColumn2;
794
795
796 /** \brief determines the range of row indexes available in the data columns of this graph
797 *
798 * \param[out] imin first usable row-index
799 * \param[out] imax last usable row-index
800 * \return \c true on success and \c false if the information is not available
801 */
802 virtual bool getIndexRange(int &imin, int &imax) const override;
803};
804
805
806
807/** \brief This virtual JKQTPGraph descendent extends JKQTPXYGraph to two columns for x-values (e.g. for filled range plots).
808 * \ingroup jkqtplotter_basegraphs
809 *
810 * \see JKQTPXYYGraph and e.g. JKQTPFilledVerticalRangeGraph
811 */
813 Q_OBJECT
814public:
815
816 /** \brief class constructor */
818
819
820 /** \copydoc JKQTPPlotElement::getXMinMax() */
821 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
822
823 /** \copydoc JKQTPGraph::usesColumn() */
824 virtual bool usesColumn(int column) const override;
825
826 /** \copydoc xColumn2 */
827 int getXColumn2() const;
828 /** \brief returns the column used as "key" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
829 virtual int getKey2Column() const;
830
831 /** \copydoc JKQTPXYGraph::hitTest() */
832 virtual double hitTest(const QPointF &posSystem, QPointF* closestSpotSystem=nullptr, QString* label=nullptr, HitTestMode mode=HitTestXY) const override;
833
834 Q_PROPERTY(int xColumn2 READ getXColumn2 WRITE setXColumn2)
835public Q_SLOTS:
836 /** \brief sets xColumn, yColumn and xColumn2 at the same time */
837 void setXXYColumns(size_t xCol, size_t x2Col, size_t yCol);
838 /** \brief sets xColumn, yColumn and xColumn2 at the same time */
839 void setXXYColumns(int xCol, int x2Col, int yCol);
840
841
842 /** \copydoc xColumn2 */
843 void setXColumn2(int __value);
844 /** \copydoc xColumn2 */
845 void setXColumn2(size_t __value);
846 /** \brief sets the column used as "key" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
847 virtual void setKey2Column(int __value);
848protected:
849
850 /** \brief the column that contains the second y-component of the datapoints */
851 int xColumn2;
852
853
854 /** \brief determines the range of row indexes available in the data columns of this graph
855 *
856 * \param[out] imin first usable row-index
857 * \param[out] imax last usable row-index
858 * \return \c true on success and \c false if the information is not available
859 */
860 virtual bool getIndexRange(int &imin, int &imax) const override;
861};
862
863
864
865
866
867/** \brief This virtual JKQTPGraph descendent may be used as base for all graphs that use at least one column
868 * of data
869 * \ingroup jkqtplotter_basegraphs
870 *
871 *
872 * \see \ref jkqtplotter_graphsgroup_classstructure
873 *
874 */
876 Q_OBJECT
877 public:
878 /** \brief specifies how to sort the data for a JKQTPSingleColumnGraph before drawing
879 *
880 * \image html jkqtplotter_unsorted.png "Unsorted Data"
881 *
882 * \image html jkqtplotter_sortedx.png "Data sorted along x-axis (DataSortOrder::SortedX)"
883 */
885 Unsorted=0, /*!< \brief the data for a JKQTPSingleColumnGraph is not sorted before drawing */
886 Sorted=1 /*!< \brief the data for a JKQTPSingleColumnGraph is sorted (in ascending order) before drawing */
887 };
888 Q_ENUM(DataSortOrder)
889
890 /** \brief specifies whether the data for a JKQTPSingleColumnGraph represent x-axis or y-axis values */
891 enum class DataDirection {
892 X, /*!< \brief the data for a JKQTPSingleColumnGraph is data belonging to the x-axis of the plot */
893 Y /*!< \brief the data for a JKQTPSingleColumnGraph is data belonging to the y-axis of the plot */
894 };
895 Q_ENUM(DataDirection)
896
897 /** \brief class constructor */
899
900 /** \copydoc dataColumn */
901 int getDataColumn() const;
902
903 /** \copydoc sortData */
904 DataSortOrder getDataSortOrder() const;
905
906
907 /** \copydoc dataDirection */
908 DataDirection getDataDirection() const;
909
910 /** \copydoc JKQTPGraph::usesColumn() */
911 virtual bool usesColumn(int c) const override;
912
913 Q_PROPERTY(DataSortOrder sortData READ getDataSortOrder WRITE setDataSortOrder)
914 Q_PROPERTY(int dataColumn READ getDataColumn WRITE setDataColumn)
915 Q_PROPERTY(DataDirection dataDirection READ getDataDirection WRITE setDataDirection)
916
917 public Q_SLOTS:
918 /** \copydoc dataColumn */
919 void setDataColumn(int __value);
920 /** \copydoc dataColumn */
921 void setDataColumn (size_t __value);
922 /** \copydoc dataDirection */
923 void setDataDirection(DataDirection __value);
924 /** \copydoc sortData */
925 void setDataSortOrder(int __value);
926 /** \copydoc sortData */
927 void setDataSortOrder(DataSortOrder __value);
928
929 protected:
930 /** \brief the column that contains the datapoints */
931 int dataColumn;
932 /** \brief interpret the data from dataColumn either as X- or Y-data */
933 DataDirection dataDirection;
934
935
936 /** \brief if \c !=Unsorted, the data is sorted before plotting */
937 DataSortOrder sortData;
938 /** \brief this array contains the order of indices, in which to access the data in the data columns */
939 QVector<int> sortedIndices;
940 virtual void intSortData();
941 /** \brief returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
942 *
943 * This function can beu used to get the correct datapoint after sorting the datapoints,
944 * As sorting is done by sorting an index and not reordering the data in the columns themselves.
945 * */
946 inline int getDataIndex(int i) const {
947 if (sortData==Unsorted) return i;
948 return sortedIndices.value(i,i);
949 }
950
951 /** \brief determines the range of row indexes available in the data columns of this graph
952 *
953 * \param[out] imin first usable row-index
954 * \param[out] imax last usable row-index
955 * \return \c true on success and \c false if the information is not available
956 */
957 virtual bool getIndexRange(int &imin, int &imax) const;
958
959};
960
961
962
963/** \brief This virtual JKQTPGraph descendent extends JKQTPXYGraph with two additional columns that encode for a vector starting at (x,y), i.e. either two distances along the x- and y-axis (\f$ \Delta x, \Delta y \f$), or a rotation angle \f$ \alpha \f$ and a vector length \f$ \l \f$ .
964 * \ingroup jkqtplotter_basegraphs
965 *
966 * \see JKQTPVectorFieldGraph, JKQTPParametrizedVectorFieldGraph
967 */
969 Q_OBJECT
970public:
971 /** \brief values from this enum indicates how to interpret the data columns provided to this graph */
973 DeltaXDeltaYLayout, //!< \brief Data is given in the form of two vector components (along x- and y-axis)
974 AngleAndLengthLayout, //!< \brief Data is given in the form of an angle and a length that describe the vector together
975
976 DefaultVectorDataLayout=DeltaXDeltaYLayout,
977 };
978 Q_ENUM(VectorDataLayout)
979
980 /** \brief class constructor */
982
983
984 /** \copydoc JKQTPPlotElement::getXMinMax() */
985 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
986 /** \copydoc JKQTPPlotElement::getYMinMax() */
987 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
988
989 /** \copydoc JKQTPGraph::usesColumn() */
990 virtual bool usesColumn(int column) const override;
991
992 /** \copydoc dxColumn */
993 int getDxColumn() const;
994 /** \copydoc dyColumn */
995 int getDyColumn() const;
996 /** \copydoc angleColumn */
997 int getAngleColumn() const;
998 /** \copydoc lengthColumn */
999 int getLengthColumn() const;
1000 /** \copydoc vectorDataLayout */
1001 VectorDataLayout getVectorDataLayout() const;
1002
1003 /** \copydoc JKQTPXYGraph::hitTest() */
1004 virtual double hitTest(const QPointF &posSystem, QPointF* closestSpotSystem=nullptr, QString* label=nullptr, HitTestMode mode=HitTestXY) const override;
1005 /** \copydoc JKQTPXYGraph::formatHitTestDefaultLabel() */
1006 virtual QString formatHitTestDefaultLabel(double x, double y, int index=-1, const JKQTPDatastore *datastore=nullptr) const override;
1007
1008 Q_PROPERTY(VectorDataLayout vectorDataLayout READ getVectorDataLayout)
1009 Q_PROPERTY(int dxColumn READ getDxColumn WRITE setDxColumn)
1010 Q_PROPERTY(int dyColumn READ getDyColumn WRITE setDyColumn)
1011 Q_PROPERTY(int angleColumn READ getAngleColumn WRITE setAngleColumn)
1012 Q_PROPERTY(int lengthColumn READ getLengthColumn WRITE setLengthColumn)
1013public Q_SLOTS:
1014 /** \copydoc dxColumn */
1015 void setDxColumn(int col);
1016 /** \copydoc dyColumn */
1017 void setDyColumn(int col) ;
1018 /** \brief det dxColumn and dyColumn column at the same time! ALso ensures that vectorDataLayout is set accordingly.
1019 *
1020 * \see dxColumn, dyColumn
1021 */
1022 void setDxDyColumn(int colDx, int colDy) ;
1023 /** \copydoc angleColumn */
1024 void setAngleColumn(int col) ;
1025 /** \brief det angleColumn and lengthColumn column at the same time! ALso ensures that vectorDataLayout is set accordingly.
1026 *
1027 * \see angleColumn, lengthColumn
1028 */
1029 void setAngleAndLengthColumn(int colAngle, int colLength) ;
1030 /** \copydoc lengthColumn */
1031 void setLengthColumn(int col) ;
1032protected:
1033 /** \brief calculates the magnitude/length of a vector \a v */
1034 static inline double getVectorMagnitude(const QPointF& v) {
1035 return sqrt(jkqtp_sqr(v.x())+jkqtp_sqr(v.y()));
1036 }
1037 inline double getVectorMagnitude(int i) const {
1038 return getVectorMagnitude(getVectorDxDy(i));
1039 }
1040 /** \brief calculates the rotation angle (3 o'clock is 0) in radians \f$ [0...2\pi] \f$ of a vector \a v */
1041 static inline double getVectorAngle(const QPointF& v) {
1042 double colValue=atan2(v.y(),v.x());
1043 if (colValue<0) colValue=2.0*JKQTPSTATISTICS_PI+colValue;
1044 return colValue;
1045 }
1046 inline double getVectorAngle(int i) const {
1047 return getVectorAngle(getVectorDxDy(i));
1048 }
1049 /** \brief this function interprets vectorDataLayout together with (dxColumn, dyColumn) or (angleColumn, lengthColumn) or ... and returns the \a i -th vectors \f$ \Delta x, \Delta y \f$ */
1050 QPointF getVectorDxDy(int i) const;
1051
1052 /** \brief indicates, which column pairs to use (dxColumn, dyColumn), (angleColumn, lengthColumn), ... */
1053 VectorDataLayout vectorDataLayout;
1054 /** \brief the column that contains the delta along the x-axis.
1055 *
1056 * \note Note that this column is only used, when vectorDataLayout is set accordingly to DeltaXDeltaYLayout!
1057 * Also note that Setter-functions (e.g. setDxColumn() ) will ensure that vectorDataLayout is set accordingly.
1058 *
1059 * \see setDxColumn(), setDyColumn(), setDxDyColumn(), getDxColumn(), getDyColumn()
1060 */
1061 int dxColumn;
1062 /** \brief the column that contains the delta along the y-axis.
1063 *
1064 * \note Note that this column is only used, when vectorDataLayout is set accordingly to DeltaXDeltaYLayout!
1065 * Also note that Setter-functions (e.g. setDyColumn() ) will ensure that vectorDataLayout is set accordingly.
1066 *
1067 * \see setDxColumn(), setDyColumn(), setDxDyColumn(), getDxColumn(), getDyColumn()
1068 */
1069 int dyColumn;
1070 /** \brief the column that contains the rotation angle [in radian]
1071 *
1072 * An angle of 0 means a right-pointing vector and angle is measured count-clockwise,
1073 * so angle \f$ \alpha \f$ and length \f$ l \f$ can be converted to \f$ \Delta x, \Delta y \f$ via:
1074 * \f[ \Delta x = l\cdot \cos\alpha \f]
1075 * \f[ \Delta y = l\cdot \sin\alpha \f]
1076 * Note that these calculations are performed in the coordinate-axis-space, NOT in screen pixel space!
1077 *
1078 * \note Note that this column is only used, when vectorDataLayout is set accordingly to AngleAndLengthLayout!
1079 * Also note that Setter-functions (e.g. setAngleColumn() ) will ensure that vectorDataLayout is set accordingly.
1080 *
1081 * \see setAngleColumn(), setLengthColumn(), getAngleColumn(), getLengthColumn()
1082 */
1083 int angleColumn;
1084 /** \brief the column that contains the vector length
1085 *
1086 * \copydetails angleColumn
1087 */
1088 int lengthColumn;
1089
1090
1091 /** \brief determines the range of row indexes available in the data columns of this graph
1092 *
1093 * \param[out] imin first usable row-index
1094 * \param[out] imax last usable row-index
1095 * \return \c true on success and \c false if the information is not available
1096 */
1097 virtual bool getIndexRange(int &imin, int &imax) const override;
1098};
1099
1100
1101
1102/** \brief This virtual JKQTPGraph descendent may be used as base for all graphs that use at least one column
1103 * that specifies x coordinates for the single plot points.
1104 * \ingroup jkqtplotter_basegraphs
1105 *
1106 * This class implements basic management facilities for the data columns:
1107 * - setXColumn() to set the columns to be used for the graph data
1108 * - setDataSortOrder() to specify whether and how the data should be sorted before drawing
1109 * \image html jkqtplotter_unsorted.png "Unsorted Data"
1110 * \image html jkqtplotter_sortedx.png "Data sorted along x-axis (DataSortOrder::SortedX)"
1111 * .
1112 *
1113 * ... and overrides/implements the functions:
1114 * - getXMinMax()
1115 * - usesColumn()
1116 * .
1117 *
1118 */
1120 Q_OBJECT
1121public:
1122 /** \brief specifies how to sort the data in a JKQTPXGraph before drawing
1123 *
1124 * \image html jkqtplotter_unsorted.png "Unsorted Data"
1125 *
1126 * \image html jkqtplotter_sortedx.png "Data sorted along x-axis (DataSortOrder::SortedX)"
1127 */
1129 Unsorted=0, /*!< \brief the data for a JKQTPXYGraph is not sorted before drawing */
1130 SortedX=1, /*!< \brief the data for a JKQTPXYGraph is sorted so the x-values appear in ascending before drawing */
1131 };
1132 Q_ENUM(DataSortOrder)
1133
1134
1135 /** \brief class constructor */
1137
1138 /** \copydoc JKQTPGraph::getXMinMax() */
1139 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
1140
1141 /** \copydoc JKQTPGraph::usesColumn() */
1142 virtual bool usesColumn(int column) const override;
1143
1144 /** \copydoc xColumn */
1145 int getXColumn() const;
1146 /** \copydoc sortData */
1147 DataSortOrder getDataSortOrder() const;
1148 /** \brief returns the column used as "key" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
1149 virtual int getKeyColumn() const;
1150
1151 Q_PROPERTY(DataSortOrder sortData READ getDataSortOrder WRITE setDataSortOrder)
1152 Q_PROPERTY(int xColumn READ getXColumn WRITE setXColumn)
1153
1154
1155public Q_SLOTS:
1156 /** \copydoc sortData */
1157 void setDataSortOrder(int __value);
1158 /** \copydoc sortData */
1159 void setDataSortOrder(DataSortOrder __value);
1160 /** \copydoc xColumn */
1161 void setXColumn(int __value);
1162 /** \copydoc xColumn */
1163 void setXColumn (size_t __value);
1164 /** \brief sets the column used as "key" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
1165 virtual void setKeyColumn(int __value);
1166protected:
1167
1168 /** \brief the column that contains the x-component of the datapoints */
1169 int xColumn;
1170
1171 /** \brief if \c !=Unsorted, the data is sorted before plotting */
1172 DataSortOrder sortData;
1173 /** \brief this array contains the order of indices, in which to access the data in the data columns */
1174 QVector<int> sortedIndices;
1175 /** \brief sorts data according to the specified criterion in \a sortData ... The result is stored as a index-map in sorted Indices */
1176 virtual void intSortData();
1177 /** \brief returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
1178 *
1179 * This function can beu used to get the correct datapoint after sorting the datapoints,
1180 * As sorting is done by sorting an index and not reordering the data in the columns themselves.
1181 *
1182 * \see setDataSortOrder(), getDataSortOrder()
1183 * */
1184 inline int getDataIndex(int i) const {
1185 if (sortData==Unsorted) return i;
1186 return sortedIndices.value(i,i);
1187 }
1188
1189 /** \brief determines the range of row indexes available in the data columns of this graph
1190 *
1191 * \param[out] imin first usable row-index
1192 * \param[out] imax last usable row-index
1193 * \return \c true on success and \c false if the information is not available
1194 */
1195 virtual bool getIndexRange(int &imin, int &imax) const;
1196};
1197
1198#endif // JKQTPGRAPHSBASE_H
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter.
Definition jkqtpcoordinateaxes.h:181
This class manages data columns (with entries of type double ), used by JKQTPlotter/JKQTBasePlotter t...
Definition jkqtpdatastorage.h:282
this class extends the QPainter
Definition jkqtpenhancedpainter.h:33
this is the virtual base class of all JKQTPPlotElement's in a JKQTPlotter plot that represent geometr...
Definition jkqtpgraphsbase.h:491
DrawMode
indicates how to draw the geometric object
Definition jkqtpgraphsbase.h:496
@ DrawAsGraphicElement
draw lines as lines (i.e. graphic elements)
Definition jkqtpgraphsbase.h:497
This mix-in class assembles all styling properties applicable to error indicators.
Definition jkqtpgraphsbaseerrors.h:45
this virtual base class of the (data-column based) graphs, which are part of a JKQTPlotter plot and w...
Definition jkqtpgraphsbase.h:429
virtual bool usesColumn(int column) const
returns true if the given column is used by the graph
virtual ~JKQTPGraph()=default
default wirtual destructor
virtual void drawErrorsBefore(JKQTPEnhancedPainter &)
this function is used to plot error inidcators before plotting the graphs.
bool getDataMinMax(int column, double &minx, double &maxx, double &smallestGreaterZero)
get the maximum and minimum value of the given column
JKQTPGraph(JKQTBasePlotter *parent=nullptr)
class constructor
virtual void drawErrorsAfter(JKQTPEnhancedPainter &)
this function is used to plot error inidcators after plotting the graphs.
this is the virtual base class of all JKQTPPlotElement's in a JKQTPlotter plot that represent annotat...
Definition jkqtpgraphsbase.h:550
virtual ~JKQTPPlotAnnotationElement()
default wirtual destructor
JKQTPPlotAnnotationElement(JKQTBasePlotter *parent=nullptr)
class constructor
this virtual base class of every element, which is part of a JKQTPlotter plot and may appear in its k...
Definition jkqtpgraphsbase.h:62
void addHitTestData(const QPointF &pos_, int index_=-1, const JKQTPDatastore *datastore=nullptr)
clear the internal datastore for hitTest(), this variant uses formatHitTestDefaultLabel() to auto-gen...
Definition jkqtpgraphsbase.h:350
QPointF backTransform(const QPointF &x) const
tool routine that back-transforms a QPointF according to the parent's transformation rules (pixels --...
Definition jkqtpgraphsbase.h:241
int parentPlotStyle
internal storage for the used parent plot style
Definition jkqtpgraphsbase.h:396
QString yFloatToString(double v, int past_comma=-1) const
converts a x-value v into a string, taking into account the type of x-axis
void reserveHitTestData(int points)
reserve list entries for up to points graph points in the internal datastore for hitTest()
Definition jkqtpgraphsbase.h:306
double transformX(double x) const
tool routine that transforms an x-coordinate (plot coordinate --> pixels) for this plot element,...
void setYAxis(JKQTPCoordinateAxisRef ref)
indicates which coordinate axis to use for coordinate transforms in y-direction
JKQTBasePlotter * getParent()
returns the parent painter class
Definition jkqtpgraphsbase.h:114
const JKQTPCoordinateAxis * getYAxis() const
returns the actual y-Axis-object from the parent plotter, referenced in yAxisRef
Definition jkqtpgraphsbase.h:281
QPointF backTransform(double x, double y) const
tool routine that back-transforms a QPointF according to the parent's transformation rules (pixels --...
Definition jkqtpgraphsbase.h:251
virtual void drawKeyMarker(JKQTPEnhancedPainter &painter, const QRectF &rect)=0
plots a key marker inside the specified rectangle rect
QPainterPath transformToLinePath(const QPolygonF &x) const
tool routine that transforms a QPolygonF according to the parent's transformation rules and returns a...
virtual void setParent(JKQTPlotter *parent)
sets the parent painter class
virtual void draw(JKQTPEnhancedPainter &painter)=0
plots the graph to the plotter object specified as parent
QVector< double > transformY(const QVector< double > &x) const
transform all y-coordinates in a vector x
virtual QString formatHitTestDefaultLabel(double x, double y, int index=-1, const JKQTPDatastore *datastore=nullptr) const
tool-function for hitTest(), which formats a default label, taking into account the x- and y-position...
void addHitTestData(double x_, double y_, const QString &label_)
add a new point on the graph to the internal datastore for hitTest()
Definition jkqtpgraphsbase.h:321
QPointF transform(const QPointF &x) const
tool routine that transforms a QPointF according to the parent's transformation rules (plot coordinat...
Definition jkqtpgraphsbase.h:235
void setXAxis(JKQTPCoordinateAxisRef ref)
indicates which coordinate axis to use for coordinate transforms in x-direction
QString getTitle() const
returns the the title of the plot
virtual bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)=0
get the maximum and minimum x-value of the graph
void addHitTestData(const QPointF &pos_, int index_, const QString &label_)
clear the internal datastore for hitTest()
Definition jkqtpgraphsbase.h:369
void addHitTestData(double x_, double y_, int index_, const QString &label_)
clear the internal datastore for hitTest()
Definition jkqtpgraphsbase.h:360
void setAxes(JKQTPCoordinateAxisRef ref)
set the coordinate axes to use for this plot element
virtual QColor getKeyLabelColor() const =0
returns the color to be used for the key label
JKQTBasePlotter * parent
the plotter object this object belongs to
Definition jkqtpgraphsbase.h:386
QImage generateKeyMarker(QSize size=QSize(16, 16))
returns an image with a key marker inside
const JKQTPCoordinateAxis * getXAxis() const
returns the actual x-Axis-object from the parent plotter, referenced in xAxisRef
Definition jkqtpgraphsbase.h:277
bool isHighlighted() const
returns whether the graph is shown in a highlighted style in the plot
void addHitTestData(double x_, double y_, int index_=-1, const JKQTPDatastore *datastore=nullptr)
add a new point on the graph to the internal datastore for hitTest(), this variant uses formatHitTest...
Definition jkqtpgraphsbase.h:340
void addHitTestData(const QPointF &pos_, const QString &label_)
clear the internal datastore for hitTest()
Definition jkqtpgraphsbase.h:329
const JKQTBasePlotter * getParent() const
returns the parent painter class
Definition jkqtpgraphsbase.h:112
QVector< HitTestLocation > m_hitTestData
dataset with graph-points and associated data from the function hitTest()
Definition jkqtpgraphsbase.h:407
double backtransformY(double y) const
tool routine that backtransforms a y-coordinate (pixels --> plot coordinate) for this plot element,...
double transformY(double y) const
tool routine that transforms a y-coordinate (plot coordinate --> pixels) for this plot element,...
virtual ~JKQTPPlotElement()=default
default wirtual destructor
QPolygonF transform(const QPolygonF &x) const
tool routine that transforms a QPolygonF according to the parent's transformation rules (plot coordin...
QPointF transform(double x, double y) const
tool routine that transforms a QPointF according to the parent's transformation rules (plot coordinat...
Definition jkqtpgraphsbase.h:246
QVector< double > transformX(const QVector< double > &x) const
transform all x-coordinates in a vector x
void addHitTestData(const HitTestLocation &loc)
clear the internal datastore for hitTest()
Definition jkqtpgraphsbase.h:312
bool isVisible() const
returns whether the graph is visible in the plot
HitTestMode
modes of operation for the function hitTest()
Definition jkqtpgraphsbase.h:151
@ HitTestXOnly
find closest point in x-direction only
Definition jkqtpgraphsbase.h:153
@ HitTestXY
find closest point in x- and y-direction simulatneously (i.e. measure direct distance)
Definition jkqtpgraphsbase.h:152
@ HitTestYOnly
find closest point in y-direction only
Definition jkqtpgraphsbase.h:154
JKQTPCoordinateAxisRef getXAxisRef() const
indicates which coordinate axis to use for coordinate transforms in x-direction
virtual bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)=0
get the maximum and minimum y-value of the graph
JKQTPPlotElement(JKQTBasePlotter *parent=nullptr)
class constructor
virtual void setParent(JKQTBasePlotter *parent)
sets the parent painter class
QString xFloatToString(double v, int past_comma=-1) const
converts a x-value v into a string, taking into account the type of x-axis
double backtransformX(double x) const
tool routine that backtransforms an x-coordinate (pixels --> plot coordinate) for this plot element,...
JKQTPCoordinateAxisRef getYAxisRef() const
indicates which coordinate axis to use for coordinate transforms in y-direction
This virtual JKQTPGraph descendent may be used as base for all graphs that use at least one column of...
Definition jkqtpgraphsbase.h:875
virtual bool getIndexRange(int &imin, int &imax) const
determines the range of row indexes available in the data columns of this graph
DataSortOrder
specifies how to sort the data for a JKQTPSingleColumnGraph before drawing
Definition jkqtpgraphsbase.h:884
DataDirection
specifies whether the data for a JKQTPSingleColumnGraph represent x-axis or y-axis values
Definition jkqtpgraphsbase.h:891
This virtual JKQTPGraph descendent may be used as base for all graphs that use at least one column th...
Definition jkqtpgraphsbase.h:1119
DataSortOrder
specifies how to sort the data in a JKQTPXGraph before drawing
Definition jkqtpgraphsbase.h:1128
virtual bool getIndexRange(int &imin, int &imax) const
determines the range of row indexes available in the data columns of this graph
This virtual JKQTPGraph descendent extends JKQTPXYGraph to two columns for x-values (e....
Definition jkqtpgraphsbase.h:812
virtual int getKey2Column() const
returns the column used as "key" for the current graph (typically this call getXColumn(),...
void setXColumn2(int __value)
the column that contains the second y-component of the datapoints
virtual bool getIndexRange(int &imin, int &imax) const override
determines the range of row indexes available in the data columns of this graph
int getXColumn2() const
the column that contains the second y-component of the datapoints
virtual void setKey2Column(int __value)
sets the column used as "key" for the current graph (typically this call setXColumn(),...
virtual bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
void setXXYColumns(size_t xCol, size_t x2Col, size_t yCol)
sets xColumn, yColumn and xColumn2 at the same time
void setXColumn2(size_t __value)
the column that contains the second y-component of the datapoints
virtual double hitTest(const QPointF &posSystem, QPointF *closestSpotSystem=nullptr, QString *label=nullptr, HitTestMode mode=HitTestXY) const override
Implmentation of JKQTPPlotElement::hitTest(), which searches through all graph points defined by xCol...
JKQTPXXYGraph(JKQTBasePlotter *parent=nullptr)
class constructor
virtual bool usesColumn(int column) const override
returns true if the given column is used by the graph
void setXXYColumns(int xCol, int x2Col, int yCol)
sets xColumn, yColumn and xColumn2 at the same time
This virtual JKQTPGraph descendent extends JKQTPXYGraph with two additional columns that encode for a...
Definition jkqtpgraphsbase.h:968
double getVectorAngle(int i) const
Definition jkqtpgraphsbase.h:1046
static double getVectorAngle(const QPointF &v)
calculates the rotation angle (3 o'clock is 0) in radians of a vector v
Definition jkqtpgraphsbase.h:1041
VectorDataLayout
values from this enum indicates how to interpret the data columns provided to this graph
Definition jkqtpgraphsbase.h:972
@ AngleAndLengthLayout
Data is given in the form of an angle and a length that describe the vector together.
Definition jkqtpgraphsbase.h:974
@ DeltaXDeltaYLayout
Data is given in the form of two vector components (along x- and y-axis)
Definition jkqtpgraphsbase.h:973
virtual bool getIndexRange(int &imin, int &imax) const override
determines the range of row indexes available in the data columns of this graph
QPointF getVectorDxDy(int i) const
this function interprets vectorDataLayout together with (dxColumn, dyColumn) or (angleColumn,...
double getVectorMagnitude(int i) const
Definition jkqtpgraphsbase.h:1037
This virtual JKQTPGraph descendent extends JKQTPXYGraph adds a baseline-property, which is necessary,...
Definition jkqtpgraphsbase.h:712
bool getMinMaxWithErrorsAndBaseline(int dataColumn, int errorColumn, int errorColumnLower, bool errorSymmetric, double &minv, double &maxv, double &smallestGreaterZero)
can be called by JKQTPGraph::getXMinMax() or JKQTPGraph::getYMinMax() calculates min/max/....
double getBaseline() const
baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!)
double getErrorU(int i, const JKQTPDatastore *ds, int xErrorColumn) const
returns the upper error for the i-th datapoint, read from datastore ds
void setBaseline(double __value)
baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!)
double getErrorL(int i, const JKQTPDatastore *ds, int xErrorColumn, int xErrorColumnLower, bool xErrorSymmetric) const
returns the lower error for the i-th datapoint, read from datastore ds
JKQTPXYBaselineGraph(JKQTBasePlotter *parent=nullptr)
class constructor
double m_baseline
baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!)
Definition jkqtpgraphsbase.h:738
bool getMinMaxWithBaseline(int dataColumn, double &minv, double &maxv, double &smallestGreaterZero)
can be called by JKQTPGraph::getXMinMax() or JKQTPGraph::getYMinMax() calculates min/max/....
This virtual JKQTPGraph descendent may be used as base for all graphs that use at least two columns t...
Definition jkqtpgraphsbase.h:586
virtual void intSortData()
sorts data according to the specified criterion in sortData ... The result is stored as a index-map i...
void setXColumn(size_t __value)
the column that contains the x-component of the datapoints
void setXYColumns(QPair< size_t, size_t > xyColPair)
sets xColumn and yColumn at the same time
void setDataSortOrder(int __value)
if !=Unsorted, the data is sorted before plotting
QVector< int > sortedIndices
this array contains the order of indices, in which to access the data in the data columns
Definition jkqtpgraphsbase.h:681
void setYColumn(int __value)
the column that contains the y-component of the datapoints
void setXColumn(int __value)
the column that contains the x-component of the datapoints
int getDataIndex(int i) const
returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
Definition jkqtpgraphsbase.h:691
void setDataSortOrder(DataSortOrder __value)
if !=Unsorted, the data is sorted before plotting
DataSortOrder
specifies how to sort the data in a JKQTPXYGraph before drawing
Definition jkqtpgraphsbase.h:595
virtual bool getIndexRange(int &imin, int &imax) const
determines the range of row indexes available in the data columns of this graph
virtual void setValueColumn(int __value)
sets the column used as "value" for the current graph (typically this call setXColumn(),...
virtual void setKeyColumn(int __value)
sets the column used as "key" for the current graph (typically this call setXColumn(),...
void setYColumn(size_t __value)
the column that contains the y-component of the datapoints
void setXYColumns(QPair< int, int > xyColPair)
sets xColumn and yColumn at the same time
This virtual JKQTPGraph descendent extends JKQTPXYGraph to two columns for y-values (e....
Definition jkqtpgraphsbase.h:754
void setXYYColumns(size_t xCol, size_t yCol, size_t y2Col)
sets xColumn, yColumn and yColumn2 at the same time
void setYColumn2(size_t __value)
the column that contains the second y-component of the datapoints
virtual int getValue2Column() const
returns the column used as secondary "value" for the current graph (typically this call getXColumn(),...
virtual bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
virtual bool getIndexRange(int &imin, int &imax) const override
determines the range of row indexes available in the data columns of this graph
void setXYYColumns(int xCol, int yCol, int y2Col)
sets xColumn, yColumn and yColumn2 at the same time
int getYColumn2() const
the column that contains the second y-component of the datapoints
virtual double hitTest(const QPointF &posSystem, QPointF *closestSpotSystem=nullptr, QString *label=nullptr, HitTestMode mode=HitTestXY) const override
Implmentation of JKQTPPlotElement::hitTest(), which searches through all graph points defined by xCol...
virtual void setValue2Column(int __value)
sets the column used as secondary "value" for the current graph (typically this call setXColumn(),...
virtual bool usesColumn(int column) const override
returns true if the given column is used by the graph
void setYColumn2(int __value)
the column that contains the second y-component of the datapoints
JKQTPXYYGraph(JKQTBasePlotter *parent=nullptr)
class constructor
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
JKQTPCoordinateAxes
named references for different oordinate axes in the plot
Definition jkqtpcoordinateaxes.h:42
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89
#define JKQTP_NAN
double-value NotANumber
Definition jkqtpmathtools.h:87
T jkqtp_sqr(const T &v)
returns the quare of the value v, i.e. v*v
Definition jkqtpmathtools.h:327
#define JKQTPSTATISTICS_PI
Definition jkqtpmathtools.h:52
Dataset for a single point on the graph, associated with its data-column index and a label that can b...
Definition jkqtpgraphsbase.h:205
QPointF pos
position of the hit-test point
Definition jkqtpgraphsbase.h:212
HitTestLocation(double x_, double y_, const QString &label_)
Definition jkqtpgraphsbase.h:207
int index
index of the hit-test point in the linked data-columns (or -1)
Definition jkqtpgraphsbase.h:214
QString label
label for that specific hit-test point
Definition jkqtpgraphsbase.h:216
HitTestLocation(const QPointF &pos_, int index_, const QString &label_)
Definition jkqtpgraphsbase.h:210
HitTestLocation(double x_, double y_, int index_, const QString &label_)
Definition jkqtpgraphsbase.h:209
HitTestLocation()
Definition jkqtpgraphsbase.h:206
HitTestLocation(const QPointF &pos_, const QString &label_)
Definition jkqtpgraphsbase.h:208