KD Chart 2  [rev.2.7]
KDChartPlotter.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2020 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Chart library.
5 **
6 ** Licensees holding valid commercial KD Chart licenses may use this file in
7 ** accordance with the KD Chart Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 
23 #ifndef KDCHARTPLOTTER_H
24 #define KDCHARTPLOTTER_H
25 
27 
28 #include "KDChartLineAttributes.h"
30 
31 namespace KDChart {
32 
33  class ThreeDLineAttributes;
34 
38 class KDCHART_EXPORT Plotter : public AbstractCartesianDiagram
39 {
40  Q_OBJECT
41 
42  Q_DISABLE_COPY( Plotter )
43  Q_ENUMS( CompressionMode )
44 
46  Q_PROPERTY( CompressionMode useDataCompression READ useDataCompression WRITE setUseDataCompression )
47  Q_PROPERTY( qreal mergeRadiusPercentage READ mergeRadiusPercentage WRITE setMergeRadiusPercentage )
48 
49 public:
50  // SLOPE enables a compression based on minmal slope changes
51  // DISTANCE is still buggy and can fail, same for BOTH, NONE is the default mode
52  enum CompressionMode{ SLOPE, DISTANCE, BOTH, NONE };
53  class PlotterType;
54  friend class PlotterType;
55 
56  explicit Plotter( QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
57  ~Plotter() override;
58 
59  virtual Plotter* clone() const;
60 
64  bool compare( const Plotter* other ) const;
65 
66  enum PlotType {
67  Normal = 0,
68  Percent
69  };
70 
71 
72  void setType( const PlotType type );
73  PlotType type() const;
74 
75  void setLineAttributes( const LineAttributes & a );
76  void setLineAttributes( int column, const LineAttributes & a );
77  void setLineAttributes( const QModelIndex & index, const LineAttributes & a );
78  void resetLineAttributes( int column );
79  void resetLineAttributes( const QModelIndex & index );
80  LineAttributes lineAttributes() const;
81  LineAttributes lineAttributes( int column ) const;
82  LineAttributes lineAttributes( const QModelIndex & index ) const;
83 
84  void setThreeDLineAttributes( const ThreeDLineAttributes & a );
85  void setThreeDLineAttributes( int column, const ThreeDLineAttributes & a );
86  void setThreeDLineAttributes( const QModelIndex & index,
87  const ThreeDLineAttributes & a );
88 
90  ThreeDLineAttributes threeDLineAttributes( int column ) const;
91  ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
92 
93  void setValueTrackerAttributes( const QModelIndex & index,
94  const ValueTrackerAttributes & a );
95  ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const;
96 
97  CompressionMode useDataCompression() const;
98  void setUseDataCompression( CompressionMode value );
99 
100  qreal maxSlopeChange() const;
101  void setMaxSlopeChange( qreal value );
102 
103  qreal mergeRadiusPercentage() const;
104  void setMergeRadiusPercentage( qreal value );
105 
106 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
107  // implement AbstractCartesianDiagram
108  /* reimpl */
109  const int numberOfAbscissaSegments () const;
110  /* reimpl */
111  const int numberOfOrdinateSegments () const;
112 #else
113  // implement AbstractCartesianDiagram
114  /* reimpl */
115  int numberOfAbscissaSegments () const override;
116  /* reimpl */
117  int numberOfOrdinateSegments () const override;
118 #endif
119 
120 protected Q_SLOTS:
121  void connectAttributesModel( AttributesModel* );
122 
123 protected:
124  void paint ( PaintContext* paintContext ) override;
125 
126 public:
127  void resize ( const QSizeF& area ) override;
128 
129 protected:
130  qreal threeDItemDepth( const QModelIndex & index ) const override;
131  qreal threeDItemDepth( int column ) const override;
133  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
134  void paintEvent ( QPaintEvent* ) override;
135  void resizeEvent ( QResizeEvent* ) override;
136 protected Q_SLOTS:
137  void setDataBoundariesDirty();
138  void calcMergeRadius();
139 }; // End of class KDChart::Plotter
140 
141 }
142 
143 #endif // KDCHARTLINEDIAGRAM_H
static ValueTrackerAttributes valueTrackerAttributes(AbstractDiagram *diagram, const QModelIndex &index)
Plotter defines a diagram type plotting two-dimensional data.
Set of attributes for changing the appearance of line charts.
A proxy model used for decorating data with attributes.
Cell-specific attributes regarding value tracking.
Base class for diagrams based on a cartesian coordianate system.
Stores information about painting diagrams.
#define KDCHART_DECLARE_DERIVED_DIAGRAM(X, PLANE)
Class only listed here to document inheritance of some KDChart classes.
static ThreeDLineAttributes threeDLineAttributes(AbstractDiagram *diagram, const QModelIndex &index)
A set of 3D line attributes.

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/