KChart

KChartWidget.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 __KCHARTWIDGET_H__
21 #define __KCHARTWIDGET_H__
22 
23 #include "KChartGlobal.h"
24 
25 #include <QWidget>
26 
27 #include "KChartEnums.h"
28 #include "KChartHeaderFooter.h"
29 
30 QT_BEGIN_NAMESPACE
31 template <typename T> class QVector;
32 template <typename T1, typename T2> struct QPair;
33 QT_END_NAMESPACE
34 
35 namespace KChart {
36 
37  // some forward declarations
38  class AbstractDiagram;
39  class Chart;
40  class AbstractCoordinatePlane;
41  class TableModel;
42  class BarDiagram;
43  class LineDiagram;
44  class Plotter;
45  class PieDiagram;
46  class RingDiagram;
47  class PolarDiagram;
48  class Legend;
49  class Position;
50 
57  class KCHART_EXPORT Widget : public QWidget
58  {
59  Q_OBJECT
60 
61  Q_DISABLE_COPY( Widget )
62  KCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( Widget )
63 
64  public:
72  explicit Widget( QWidget* parent = nullptr );
73 
75  ~Widget();
77  void setDataset( int column, const QVector< qreal > & data, const QString& title = QString() );
80  void setDataset( int column, const QVector< QPair< qreal, qreal > > & data, const QString& title = QString() );
82  void setDataCell( int row, int column, qreal data );
84  void setDataCell( int row, int column, QPair< qreal, qreal > data );
86  void resetData();
87 
88  public Q_SLOTS:
90  void setGlobalLeading( int left, int top, int right, int bottom );
92  void setGlobalLeadingLeft( int leading );
94  void setGlobalLeadingTop( int leading );
96  void setGlobalLeadingRight( int leading );
98  void setGlobalLeadingBottom( int leading );
99 
100  public:
102  int globalLeadingLeft() const;
104  int globalLeadingTop() const;
106  int globalLeadingRight() const;
108  int globalLeadingBottom() const;
109 
111  HeaderFooter* firstHeaderFooter();
113  QList<HeaderFooter*> allHeadersFooters();
114 
116  void addHeaderFooter( const QString& text,
117  HeaderFooter::HeaderFooterType type,
118  Position position );
119 
124  void addHeaderFooter( HeaderFooter* header );
125 
143  void replaceHeaderFooter( HeaderFooter* header,
144  HeaderFooter* oldHeader = nullptr );
145 
153  void takeHeaderFooter( HeaderFooter* header );
154 
156  Legend* legend();
158  QList<Legend*> allLegends();
159 
161  void addLegend( Position position );
163  void addLegend (Legend* legend );
164 
165  void replaceLegend( Legend* legend, Legend* oldLegend = nullptr );
166  void takeLegend( Legend* legend );
167 
168 
170  AbstractDiagram* diagram();
171 
175  BarDiagram* barDiagram();
179  LineDiagram* lineDiagram();
187  Plotter* plotter();
191  PieDiagram* pieDiagram();
195  RingDiagram* ringDiagram();
199  PolarDiagram* polarDiagram();
200 
202  AbstractCoordinatePlane* coordinatePlane();
203 
204 
205  enum ChartType { NoType, Bar, Line, Plot, Pie, Ring, Polar };
206 
208  ChartType type() const;
209 
211  enum SubType { Normal, Stacked, Percent, Rows };
212 
214  SubType subType() const;
215 
216  public Q_SLOTS:
218  void setType( ChartType chartType, SubType subType=Normal );
229  void setSubType( SubType subType );
230 
231  private:
233  void justifyModelSize( int rows, int columns );
235  bool checkDatasetWidth( int width );
236  };
237 }
238 
239 #endif // KChartWidget_H
Class only listed here to document inheritance of some KChart classes.
PieDiagram defines a common pie diagram.
Legend defines the interface for the legend drawing class.
Definition: KChartLegend.h:52
AbstractDiagram defines the interface for diagram classes.
Plotter defines a diagram type plotting two-dimensional data.
Definition: KChartPlotter.h:35
The KChart widget for usage without Interwiev.
Definition: KChartWidget.h:57
Defines a position, using compass terminology.
Contains KChart macros.
Base class common for all coordinate planes, CartesianCoordinatePlane, PolarCoordinatePlane, TernaryCoordinatePlane.
RingDiagram defines a common ring diagram.
SubType
Sub type values, matching the values defines for the respective Diagram classes.
Definition: KChartWidget.h:211
Definition of global enums.
BarDiagram defines a common bar diagram.
A header or footer displaying text above or below charts.
LineDiagram defines a common line diagram.
Global namespace.
PolarDiagram defines a common polar diagram.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Sep 18 2020 22:36:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.