KD Chart 2  [rev.2.7]
KDChartLineDiagram.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 KDCHARTLINEDIAGRAM_H
24 #define KDCHARTLINEDIAGRAM_H
25 
27 #include "KDChartLineAttributes.h"
29 
30 QT_BEGIN_NAMESPACE
31 class QPainter;
32 class QPolygonF;
33 QT_END_NAMESPACE
34 
35 namespace KDChart {
36 
37  class ThreeDLineAttributes;
38 
44 class KDCHART_EXPORT LineDiagram : public AbstractCartesianDiagram
45 {
46  Q_OBJECT
47 
48  Q_DISABLE_COPY( LineDiagram )
49 // KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( LineDiagram, CartesianCoordinatePlane * )
50 
52 
53 
54 public:
55  class LineDiagramType;
56  friend class LineDiagramType;
57 
58  explicit LineDiagram( QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
59  ~LineDiagram() override;
60 
61  virtual LineDiagram * clone() const;
62 
66  bool compare( const LineDiagram* other ) const;
67 
68  enum LineType {
69  Normal = 0,
70  Stacked = 1,
71  Percent = 2
72  };
73 
74 
75  void setType( const LineType type );
76  LineType type() const;
77 
84  void setCenterDataPoints( bool center );
86  bool centerDataPoints() const;
87 
93  void setReverseDatasetOrder( bool reverse );
95  bool reverseDatasetOrder() const;
96 
97  void setLineAttributes( const LineAttributes & a );
98  void setLineAttributes( int column, const LineAttributes & a );
99  void setLineAttributes( const QModelIndex & index, const LineAttributes & a );
100  void resetLineAttributes( int column );
101  void resetLineAttributes( const QModelIndex & index );
102  LineAttributes lineAttributes() const;
103  LineAttributes lineAttributes( int column ) const;
104  LineAttributes lineAttributes( const QModelIndex & index ) const;
105 
106  void setThreeDLineAttributes( const ThreeDLineAttributes & a );
107  void setThreeDLineAttributes( int column, const ThreeDLineAttributes & a );
108  void setThreeDLineAttributes( const QModelIndex & index,
109  const ThreeDLineAttributes & a );
110 
112  ThreeDLineAttributes threeDLineAttributes( int column ) const;
113  ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
114 
115  void setValueTrackerAttributes( const QModelIndex & index,
116  const ValueTrackerAttributes & a );
117  ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const;
118 
124  void setLineTension( qreal tenson );
125  qreal lineTension() const;
126 
127 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
128  // implement AbstractCartesianDiagram
129  /* reimpl */
130  const int numberOfAbscissaSegments () const;
131  /* reimpl */
132  const int numberOfOrdinateSegments () const;
133 #else
134  // implement AbstractCartesianDiagram
135  /* reimpl */
136  int numberOfAbscissaSegments () const override;
137  /* reimpl */
138  int numberOfOrdinateSegments () const override;
139 #endif
140 
141 protected:
142  void paint ( PaintContext* paintContext ) override;
143 
144 public:
145  void resize ( const QSizeF& area ) override;
146 
147 protected:
148 
149  qreal threeDItemDepth( const QModelIndex & index ) const override;
150  qreal threeDItemDepth( int column ) const override;
152  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
153  void paintEvent ( QPaintEvent* ) override;
154  void resizeEvent ( QResizeEvent* ) override;
155 }; // End of class KDChartLineDiagram
156 
157 }
158 
159 #endif // KDCHARTLINEDIAGRAM_H
static ValueTrackerAttributes valueTrackerAttributes(AbstractDiagram *diagram, const QModelIndex &index)
Set of attributes for changing the appearance of line charts.
LineDiagram defines a common line diagram.
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/