KD Chart API Documentation  3.1
KDChartPlotter.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 KDCHARTPLOTTER_H
12 #define KDCHARTPLOTTER_H
13 
15 
16 #include "KDChartLineAttributes.h"
18 
19 namespace KDChart {
20 
22 
26 class KDCHART_EXPORT Plotter : public AbstractCartesianDiagram
27 {
28  Q_OBJECT
29 
30  Q_DISABLE_COPY(Plotter)
31  Q_ENUMS(CompressionMode)
32 
34  Q_PROPERTY(CompressionMode useDataCompression READ useDataCompression WRITE setUseDataCompression)
35  Q_PROPERTY(qreal mergeRadiusPercentage READ mergeRadiusPercentage WRITE setMergeRadiusPercentage)
36 
37 public:
38  // SLOPE enables a compression based on minimal slope changes
39  // DISTANCE is still buggy and can fail, same for BOTH, NONE is the default mode
41  {
45  NONE
46  };
47  class PlotterType;
48  friend class PlotterType;
49 
50  explicit Plotter(QWidget *parent = nullptr, CartesianCoordinatePlane *plane = nullptr);
51  ~Plotter() override;
52 
53  virtual Plotter *clone() const;
54 
58  bool compare(const Plotter *other) const;
59 
60  enum PlotType
61  {
62  Normal = 0,
63  Percent
64  };
65 
66  void setType(const PlotType type);
67  PlotType type() const;
68 
69  void setLineAttributes(const LineAttributes &a);
70  void setLineAttributes(int column, const LineAttributes &a);
71  void setLineAttributes(const QModelIndex &index, const LineAttributes &a);
72  void resetLineAttributes(int column);
73  void resetLineAttributes(const QModelIndex &index);
74  LineAttributes lineAttributes() const;
75  LineAttributes lineAttributes(int column) const;
76  LineAttributes lineAttributes(const QModelIndex &index) const;
77 
78  void setThreeDLineAttributes(const ThreeDLineAttributes &a);
79  void setThreeDLineAttributes(int column, const ThreeDLineAttributes &a);
80  void setThreeDLineAttributes(const QModelIndex &index,
81  const ThreeDLineAttributes &a);
82 
83  ThreeDLineAttributes threeDLineAttributes() const;
84  ThreeDLineAttributes threeDLineAttributes(int column) const;
85  ThreeDLineAttributes threeDLineAttributes(const QModelIndex &index) const;
86 
87  void setValueTrackerAttributes(const QModelIndex &index,
88  const ValueTrackerAttributes &a);
89  ValueTrackerAttributes valueTrackerAttributes(const QModelIndex &index) const;
90 
91  CompressionMode useDataCompression() const;
92  void setUseDataCompression(CompressionMode value);
93 
94  qreal maxSlopeChange() const;
95  void setMaxSlopeChange(qreal value);
96 
97  qreal mergeRadiusPercentage() const;
98  void setMergeRadiusPercentage(qreal value);
99 
100 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined(Q_COMPILER_MANGLES_RETURN_TYPE)
101  // implement AbstractCartesianDiagram
102  /* reimp */
103  const int numberOfAbscissaSegments() const;
104  /* reimp */
105  const int numberOfOrdinateSegments() const;
106 #else
107  // implement AbstractCartesianDiagram
108  /* reimp */
109  int numberOfAbscissaSegments() const override;
110  /* reimp */
111  int numberOfOrdinateSegments() const override;
112 #endif
113 
114 protected Q_SLOTS:
115  void connectAttributesModel(AttributesModel *);
116 
117 protected:
118  void paint(PaintContext *paintContext) override;
119 
120 public:
121  void resize(const QSizeF &area) override;
122 
123 protected:
124  qreal threeDItemDepth(const QModelIndex &index) const override;
125  qreal threeDItemDepth(int column) const override;
127  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
128  void paintEvent(QPaintEvent *) override;
129  void resizeEvent(QResizeEvent *) override;
130 protected Q_SLOTS:
131  void setDataBoundariesDirty();
132  void calcMergeRadius();
133 }; // End of class KDChart::Plotter
134 }
135 
136 #endif // KDCHARTLINEDIAGRAM_H
#define KDCHART_DECLARE_DERIVED_DIAGRAM(X, PLANE)
Base class for diagrams based on a cartesian coordianate system.
A proxy model used for decorating data with attributes.
Set of attributes for changing the appearance of line charts.
Stores information about painting diagrams.
Plotter defines a diagram type plotting two-dimensional data.
Cell-specific attributes regarding value tracking.

© 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 by doxygen 1.9.1