KChart

KChartPlotter.h
1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (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 General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef KCHARTPLOTTER_H
21 #define KCHARTPLOTTER_H
22 
23 #include "KChartAbstractCartesianDiagram.h"
24 
25 #include "KChartLineAttributes.h"
26 #include "KChartValueTrackerAttributes.h"
27 
28 namespace KChart {
29 
30  class ThreeDLineAttributes;
31 
35 class KCHART_EXPORT Plotter : public AbstractCartesianDiagram
36 {
37  Q_OBJECT
38 
39  Q_DISABLE_COPY( Plotter )
40  Q_ENUMS( CompressionMode )
41 
42  KCHART_DECLARE_DERIVED_DIAGRAM( Plotter, CartesianCoordinatePlane )
43  Q_PROPERTY( CompressionMode useDataCompression READ useDataCompression WRITE setUseDataCompression )
44  Q_PROPERTY( qreal mergeRadiusPercentage READ mergeRadiusPercentage WRITE setMergeRadiusPercentage )
45 
46 public:
47  // SLOPE enables a compression based on minmal slope changes
48  // DISTANCE is still buggy and can fail, same for BOTH, NONE is the default mode
49  enum CompressionMode{ SLOPE, DISTANCE, BOTH, NONE };
50  class PlotterType;
51  friend class PlotterType;
52 
53  explicit Plotter( QWidget* parent = nullptr, CartesianCoordinatePlane* plane = nullptr );
54  virtual ~Plotter();
55 
56 
60  virtual Plotter* clone() const;
61 
65  bool compare( const Plotter* other ) const;
66 
67  enum PlotType {
68  Normal = 0,
69  Percent,
70  Stacked
71  };
72 
73 
74 
78  void setType( const PlotType type );
79 
83  PlotType type() const;
84 
88  void setLineAttributes( const LineAttributes & la );
89 
93  void setLineAttributes( int column, const LineAttributes &la );
94 
98  void setLineAttributes( const QModelIndex & index, const LineAttributes &la );
99 
103  void resetLineAttributes( int column );
104 
108  void resetLineAttributes( const QModelIndex & index );
109 
113  LineAttributes lineAttributes() const;
114 
118  LineAttributes lineAttributes( int column ) const;
119 
123  LineAttributes lineAttributes( const QModelIndex & index ) const;
124 
128  void setThreeDLineAttributes( const ThreeDLineAttributes & la );
129 
133  void setThreeDLineAttributes( int column, const ThreeDLineAttributes & la );
134 
138  void setThreeDLineAttributes( const QModelIndex & index,
139  const ThreeDLineAttributes & la );
140 
144  ThreeDLineAttributes threeDLineAttributes() const;
145 
149  ThreeDLineAttributes threeDLineAttributes( int column ) const;
150 
154  ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
155 
159  void setValueTrackerAttributes( const QModelIndex & index,
160  const ValueTrackerAttributes & va );
161 
165  ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const;
166 
167  CompressionMode useDataCompression() const;
168  void setUseDataCompression( CompressionMode value );
169 
170  qreal maxSlopeChange() const;
171  void setMaxSlopeChange( qreal value );
172 
173  qreal mergeRadiusPercentage() const;
174  void setMergeRadiusPercentage( qreal value );
175 
176 #if defined(Q_COMPILER_MANGLES_RETURN_TYPE)
177  // implement AbstractCartesianDiagram
178  /* reimpl */
179  const int numberOfAbscissaSegments () const;
180  /* reimpl */
181  const int numberOfOrdinateSegments () const;
182 #else
183  // implement AbstractCartesianDiagram
184  /* reimpl */
185  int numberOfAbscissaSegments () const override;
186  /* reimpl */
187  int numberOfOrdinateSegments () const override;
188 #endif
189 
190 protected Q_SLOTS:
191  void connectAttributesModel( AttributesModel* );
192 
193 protected:
194  void paint ( PaintContext* paintContext ) override;
195 
196 public:
197  void resize ( const QSizeF& area ) override;
198 
199 protected:
200  qreal threeDItemDepth( const QModelIndex & index ) const override;
201  qreal threeDItemDepth( int column ) const override;
203  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
204  void paintEvent ( QPaintEvent* ) override;
205  void resizeEvent ( QResizeEvent* ) override;
206 protected Q_SLOTS:
207  void setDataBoundariesDirty();
208  void calcMergeRadius();
209 }; // End of class KChart::Plotter
210 
211 }
212 
213 #endif // KCHARTLINEDIAGRAM_H
Class only listed here to document inheritance of some KChart classes.
A set of 3D line attributes.
Plotter defines a diagram type plotting two-dimensional data.
Definition: KChartPlotter.h:35
Set of attributes for changing the appearance of line charts.
Stores information about painting diagrams.
Base class for diagrams based on a cartesian coordianate system.
A proxy model used for decorating data with attributes.
Cell-specific attributes regarding value tracking.
Global namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Sep 22 2020 22:36:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.