KD Chart 2  [rev.2.5.1]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
KDChartLineDiagram.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2013 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  virtual ~LineDiagram();
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 
111  //FIXME(khz): big TODO(khz): add a lot of reset...Attributes() methods to all
112  // appropriate places, for 2.1 (that is: after we have release 2.0.2) :-)
113 
115  ThreeDLineAttributes threeDLineAttributes( int column ) const;
116  ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
117 
118  void setValueTrackerAttributes( const QModelIndex & index,
119  const ValueTrackerAttributes & a );
120  ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const;
121 
122 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
123  // implement AbstractCartesianDiagram
124  /* reimpl */
125  const int numberOfAbscissaSegments () const;
126  /* reimpl */
127  const int numberOfOrdinateSegments () const;
128 #else
129  // implement AbstractCartesianDiagram
130  /* reimpl */
131  int numberOfAbscissaSegments () const;
132  /* reimpl */
133  int numberOfOrdinateSegments () const;
134 #endif
135 
136 protected:
137  void paint ( PaintContext* paintContext );
138 
139 public:
140  void resize ( const QSizeF& area );
141 
142 protected:
143  // FIXME what does that mean?
144  qreal valueForCellTesting( int row, int column,
145  bool& bOK,
146  bool showHiddenCellsAsInvalid = false ) const;
148  int row, int column,
149  bool shiftCountedXValuesByHalfSection,
150  qreal& valueX, qreal& valueY ) const;
151 
152  virtual qreal threeDItemDepth( const QModelIndex & index ) const;
153  virtual qreal threeDItemDepth( int column ) const;
155  virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
156  void paintEvent ( QPaintEvent* );
157  void resizeEvent ( QResizeEvent* );
158 }; // End of class KDChartLineDiagram
159 
160 }
161 
162 #endif // KDCHARTLINEDIAGRAM_H

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/