KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
KDChartCartesianCoordinatePlane.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 KDCHARTCARTESIANCOORDINATEPLANE_H
12#define KDCHARTCARTESIANCOORDINATEPLANE_H
13
15
16namespace KDChart {
17
18class Chart;
19class PaintContext;
20class AbstractDiagram;
21class CartesianAxis;
22class CartesianGrid;
23
28{
29 Q_OBJECT
30
31 Q_DISABLE_COPY(CartesianCoordinatePlane)
33
34 friend class CartesianAxis;
35 friend class CartesianGrid;
36
37public:
38 explicit CartesianCoordinatePlane(Chart *parent = nullptr);
39 ~CartesianCoordinatePlane() override;
40
41 void addDiagram(AbstractDiagram *diagram) override;
42
48 void setIsometricScaling(bool onOff);
49
50 bool doesIsometricScaling() const;
51
52 const QPointF translate(const QPointF &diagramPoint) const override;
53
57 qreal zoomFactorX() const override;
61 qreal zoomFactorY() const override;
62
66 void setZoomFactors(qreal factorX, qreal factorY) override;
70 void setZoomFactorX(qreal factor) override;
74 void setZoomFactorY(qreal factor) override;
75
79 QPointF zoomCenter() const override;
80
84 void setZoomCenter(const QPointF &center) override;
85
95 void setFixedDataCoordinateSpaceRelation(bool fixed);
96 bool hasFixedDataCoordinateSpaceRelation() const;
97
105 void setXAxisStartAtZero(bool fixedStart);
106 bool xAxisStartAtZero() const;
107
143 void setHorizontalRange(const QPair<qreal, qreal> &range);
144
180 void setVerticalRange(const QPair<qreal, qreal> &range);
181
189 QPair<qreal, qreal> horizontalRange() const;
190
198 QPair<qreal, qreal> verticalRange() const;
199
220 void setAutoAdjustHorizontalRangeToData(unsigned int percentEmpty = 67);
221
242 void setAutoAdjustVerticalRangeToData(unsigned int percentEmpty = 67);
243
254 unsigned int autoAdjustHorizontalRangeToData() const;
255
266 unsigned int autoAdjustVerticalRangeToData() const;
267
289 void setGridAttributes(Qt::Orientation orientation, const GridAttributes &);
290
302 void resetGridAttributes(Qt::Orientation orientation);
303
318 const GridAttributes gridAttributes(Qt::Orientation orientation) const;
319
332 bool hasOwnGridAttributes(Qt::Orientation orientation) const;
333
341 void setAutoAdjustGridToZoom(bool autoAdjust);
342
348#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined(Q_COMPILER_MANGLES_RETURN_TYPE)
349 const bool autoAdjustGridToZoom() const;
350#else
351 bool autoAdjustGridToZoom() const;
352#endif
353
354 AxesCalcMode axesCalcModeY() const;
355 AxesCalcMode axesCalcModeX() const;
356
358 void setAxesCalcModes(AxesCalcMode mode);
360 void setAxesCalcModeY(AxesCalcMode mode);
362 void setAxesCalcModeX(AxesCalcMode mode);
363
365 void paint(QPainter *) override;
366
368 AbstractCoordinatePlane *sharedAxisMasterPlane(QPainter *p = nullptr) override;
369
374 QRectF visibleDataRange() const;
375
380 QRectF logicalArea() const;
381
389 QRectF diagramArea() const;
390
396 QRectF visibleDiagramArea() const;
397
404 void setHorizontalRangeReversed(bool reverse);
405
409 bool isHorizontalRangeReversed() const;
410
417 void setVerticalRangeReversed(bool reverse);
418
422 bool isVerticalRangeReversed() const;
423
427 void setGeometry(const QRect &r) override;
428
429 // reimplemented
430 Qt::Orientations expandingDirections() const override;
431
432public Q_SLOTS:
441 void adjustRangesToData();
442
447 void adjustHorizontalRangeToData();
448
453 void adjustVerticalRangeToData();
454
455protected:
456 QRectF getRawDataBoundingRectFromDiagrams() const;
457 QRectF adjustedToMaxEmptyInnerPercentage(
458 const QRectF &r, unsigned int percentX, unsigned int percentY) const;
459 virtual QRectF calculateRawDataBoundingRect() const;
460 DataDimensionsList getDataDimensionsList() const override;
461 // the whole drawing area, includes diagrams and axes, but maybe smaller
462 // than (width, height):
463 virtual QRectF drawingArea() const;
464
465public:
466 const QPointF translateBack(const QPointF &screenPoint) const;
467
468protected:
470 void layoutDiagrams() override;
471 // the following three return true if the new value is different from the old
472 bool doneSetZoomFactorX(qreal factor);
473 bool doneSetZoomFactorY(qreal factor);
474 bool doneSetZoomCenter(const QPointF &center);
475
476 void handleFixedDataCoordinateSpaceRelation(const QRectF &geometry);
477
478 // reimplemented from QLayoutItem, via AbstractLayoutItem, AbstractArea, AbstractCoordinatePlane
479 bool hasHeightForWidth() const override;
480 int heightForWidth(int w) const override;
481 QSize sizeHint() const override;
482
483protected Q_SLOTS:
484 void slotLayoutChanged(AbstractDiagram *);
485
486private:
487 void setHasOwnGridAttributes(
488 Qt::Orientation orientation, bool on);
489};
490}
491
492#endif
#define KDCHART_DECLARE_PRIVATE_DERIVED_PARENT(X, ParentType)
QPointF translate(const TernaryPoint &point)
Base class common for all coordinate planes, CartesianCoordinatePlane, PolarCoordinatePlane,...
AbstractDiagram defines the interface for diagram classes.
void paintEvent(QPaintEvent *)
A chart with one or more diagrams.
A set of attributes controlling the appearance of grids.
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