KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
KDChartAbstractCoordinatePlane.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of the KD Chart library.
4**
5** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6**
7** SPDX-License-Identifier: MIT
8**
9****************************************************************************/
10
11#ifndef KDCHARTABSTRACTCOORDINATEPLANE_H
12#define KDCHARTABSTRACTCOORDINATEPLANE_H
13
14#include <QList>
15#include <QObject>
16
17#include "KDChartAbstractArea.h"
19#include "KDChartEnums.h"
20
21namespace KDChart {
22
23class Chart;
24class GridAttributes;
25class DataDimension;
26
28
32class KDCHART_EXPORT AbstractCoordinatePlane : public AbstractArea
33{
34 Q_OBJECT
35
37
38 friend class AbstractGrid;
39
40public:
42 {
44 Logarithmic
45 };
46
47protected:
48 explicit AbstractCoordinatePlane(Chart *parent = nullptr);
49
50public:
51 ~AbstractCoordinatePlane() override;
52
59 virtual void addDiagram(AbstractDiagram *diagram);
60
78 virtual void replaceDiagram(AbstractDiagram *diagram, AbstractDiagram *oldDiagram = nullptr);
79
88 virtual void takeDiagram(AbstractDiagram *diagram);
89
93 AbstractDiagram *diagram();
94
98 AbstractDiagramList diagrams();
99
103 ConstAbstractDiagramList diagrams() const;
104
108 virtual void layoutDiagrams() = 0;
109
116 virtual const QPointF translate(const QPointF &diagramPoint) const = 0;
117
121 bool isRubberBandZoomingEnabled() const;
122
126 void setRubberBandZoomingEnabled(bool enable);
127
132 virtual qreal zoomFactorX() const
133 {
134 return 1.0;
135 }
136
141 virtual qreal zoomFactorY() const
142 {
143 return 1.0;
144 }
145
150 virtual void setZoomFactors(qreal factorX, qreal factorY)
151 {
152 Q_UNUSED(factorX);
153 Q_UNUSED(factorY);
154 }
155
161 virtual void setZoomFactorX(qreal factor)
162 {
163 Q_UNUSED(factor);
164 }
165
171 virtual void setZoomFactorY(qreal factor)
172 {
173 Q_UNUSED(factor);
174 }
175
180 virtual QPointF zoomCenter() const
181 {
182 return QPointF(0.0, 0.0);
183 }
184
190 virtual void setZoomCenter(const QPointF &center)
191 {
192 Q_UNUSED(center);
193 }
194
206 void setGlobalGridAttributes(const GridAttributes &);
207
213 GridAttributes globalGridAttributes() const;
214
233 DataDimensionsList gridDimensionsList();
234
242 void setReferenceCoordinatePlane(AbstractCoordinatePlane *plane);
243
259 AbstractCoordinatePlane *referenceCoordinatePlane() const;
260
265 bool isCornerSpacersEnabled() const;
266
270 void setCornerSpacersEnabled(bool enable);
271
272 virtual AbstractCoordinatePlane *sharedAxisMasterPlane(QPainter *p = nullptr); // KDChart 3: const method?
273
275 bool isEmpty() const override;
277 Qt::Orientations expandingDirections() const override;
279 QSize maximumSize() const override;
281 QSize minimumSize() const override;
283 QSize sizeHint() const override;
290 void setGeometry(const QRect &r) override;
292 QRect geometry() const override;
293
294 virtual void mousePressEvent(QMouseEvent *event);
295 virtual void mouseDoubleClickEvent(QMouseEvent *event);
296 virtual void mouseMoveEvent(QMouseEvent *event);
297 virtual void mouseReleaseEvent(QMouseEvent *event);
298
302 void setParent(Chart *parent);
303 Chart *parent();
304 const Chart *parent() const;
305
311#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined(Q_COMPILER_MANGLES_RETURN_TYPE)
312 const bool isVisiblePoint(const QPointF &point) const;
313#else
314 bool isVisiblePoint(const QPointF &point) const;
315#endif
316
317public Q_SLOTS:
321 void update();
325 void relayout();
329 void layoutPlanes();
333 void setGridNeedsRecalculate();
334
335Q_SIGNALS:
338
341
344
347
350
352
359
360private:
361Q_SIGNALS:
362 // Emitted from inside the setGeometry()
363 // This is connected via QueuedConnection to the geometryChanged() Signal
364 // that users can connect to safely then.
368
369protected:
371
372 // KDCHART_DECLARE_PRIVATE_DERIVED( AbstractCoordinatePlane )
373};
374
392{
393public:
395 {
396 }
397 DataDimension(qreal start_,
398 qreal end_,
399 bool isCalculated_,
402 qreal stepWidth_ = 0.0,
403 qreal subStepWidth_ = 0.0)
404 : start(start_)
405 , end(end_)
406 , isCalculated(isCalculated_)
407 , calcMode(calcMode_)
408 , sequence(sequence_)
409 , stepWidth(stepWidth_)
410 , subStepWidth(subStepWidth_)
411 {
412 }
420 qreal distance() const
421 {
422 return end - start;
423 }
424
425 bool operator==(const DataDimension &r) const
426 {
427 return (start == r.start) && (end == r.end) && (sequence == r.sequence) && (isCalculated == r.isCalculated) && (calcMode == r.calcMode) && (stepWidth == r.stepWidth) && (subStepWidth == r.subStepWidth);
428 }
429
430 bool operator!=(const DataDimension &other) const
431 {
432 return !operator==(other);
433 }
434
435 qreal start = 1.0;
436 qreal end = 10.0;
437 bool isCalculated = false;
440 qreal stepWidth = 1.0;
441 qreal subStepWidth = 0.0;
442};
443
444#if !defined(QT_NO_DEBUG_STREAM)
445QDebug operator<<(QDebug stream, const DataDimension &r);
446#endif
447}
448#endif
Definition of global enums.
#define KDCHART_DECLARE_PRIVATE_DERIVED_PARENT(X, ParentType)
@ GranularitySequence_10_20
An area in the chart with a background, a frame, etc.
Base class common for all coordinate planes, CartesianCoordinatePlane, PolarCoordinatePlane,...
virtual const QPointF translate(const QPointF &diagramPoint) const =0
void destroyedCoordinatePlane(AbstractCoordinatePlane *)
virtual void setZoomFactors(qreal factorX, qreal factorY)
virtual void setZoomCenter(const QPointF &center)
void internal_geometryChanged(QRect, QRect)
virtual DataDimensionsList getDataDimensionsList() const =0
void geometryChanged(QRect, QRect)
AbstractDiagram defines the interface for diagram classes.
A chart with one or more diagrams.
Helper class for one dimension of data, e.g. for the rows in a data model, or for the labels of an ax...
bool operator!=(const DataDimension &other) const
DataDimension(qreal start_, qreal end_, bool isCalculated_, AbstractCoordinatePlane::AxesCalcMode calcMode_, KDChartEnums::GranularitySequence sequence_, qreal stepWidth_=0.0, qreal subStepWidth_=0.0)
AbstractCoordinatePlane::AxesCalcMode calcMode
bool operator==(const DataDimension &r) const
KDChartEnums::GranularitySequence sequence
A set of attributes controlling the appearance of grids.
QDebug operator<<(QDebug stream, const DataDimension &r)
QList< DataDimension > DataDimensionsList
typedef Orientations

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated on Wed May 1 2024 00:01:10 for KD Chart API Documentation by doxygen 1.9.8