KD Chart API Documentation  3.1
KDChartWidget.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Chart library.
4 **
5 ** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
11 #ifndef __KDCHARTWIDGET_H__
12 #define __KDCHARTWIDGET_H__
13 
14 #include "KDChartGlobal.h"
15 
16 #include <QWidget>
17 #include <QtContainerFwd>
18 
19 #include "KDChartEnums.h"
20 #include "KDChartHeaderFooter.h"
21 
22 namespace KDChart {
23 
24 // some forward declarations
25 class AbstractDiagram;
26 class Chart;
27 class AbstractCoordinatePlane;
28 class TableModel;
29 class BarDiagram;
30 class LineDiagram;
31 class Plotter;
32 class PieDiagram;
33 class RingDiagram;
34 class PolarDiagram;
35 class Legend;
36 class Position;
37 
44 class KDCHART_EXPORT Widget : public QWidget
45 {
46  Q_OBJECT
47 
48  Q_DISABLE_COPY(Widget)
50 
51 public:
59  explicit Widget(QWidget *parent = nullptr);
60 
62  ~Widget() override;
64  void setDataset(int column, const QVector<qreal> &data, const QString &title = QString());
67  void setDataset(int column, const QVector<QPair<qreal, qreal>> &data, const QString &title = QString());
69  void setDataCell(int row, int column, qreal data);
71  void setDataCell(int row, int column, QPair<qreal, qreal> data);
73  void resetData();
74 
75 public Q_SLOTS:
77  void setGlobalLeading(int left, int top, int right, int bottom);
79  void setGlobalLeadingLeft(int leading);
81  void setGlobalLeadingTop(int leading);
83  void setGlobalLeadingRight(int leading);
85  void setGlobalLeadingBottom(int leading);
86 
87 public:
89  int globalLeadingLeft() const;
91  int globalLeadingTop() const;
93  int globalLeadingRight() const;
95  int globalLeadingBottom() const;
96 
98  HeaderFooter *firstHeaderFooter();
100  QList<HeaderFooter *> allHeadersFooters();
101 
103  void addHeaderFooter(const QString &text,
105  Position position);
106 
111  void addHeaderFooter(HeaderFooter *header);
112 
130  void replaceHeaderFooter(HeaderFooter *header,
131  HeaderFooter *oldHeader = nullptr);
132 
140  void takeHeaderFooter(HeaderFooter *header);
141 
143  Legend *legend();
145  QList<Legend *> allLegends();
146 
148  void addLegend(Position position);
150  void addLegend(Legend *legend);
151 
152  void replaceLegend(Legend *legend, Legend *oldLegend = nullptr);
153  void takeLegend(Legend *legend);
154 
156  AbstractDiagram *diagram();
157 
161  BarDiagram *barDiagram();
165  LineDiagram *lineDiagram();
173  Plotter *plotter();
177  PieDiagram *pieDiagram();
181  RingDiagram *ringDiagram();
185  PolarDiagram *polarDiagram();
186 
188  AbstractCoordinatePlane *coordinatePlane();
189 
191  {
198  Polar
199  };
200 
202  ChartType type() const;
203 
205  enum SubType
206  {
210  Rows
211  };
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 // KDChartWidget_H
Definition of global enums.
Contains KDChart macros.
#define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET(X)
Base class common for all coordinate planes, CartesianCoordinatePlane, PolarCoordinatePlane,...
AbstractDiagram defines the interface for diagram classes.
BarDiagram defines a common bar diagram.
A header or footer displaying text above or below charts.
Legend defines the interface for the legend drawing class.
Definition: KDChartLegend.h:44
LineDiagram defines a common line diagram.
PieDiagram defines a common pie diagram.
Plotter defines a diagram type plotting two-dimensional data.
PolarDiagram defines a common polar diagram.
Defines a position, using compass terminology.
RingDiagram defines a common ring diagram.
The KD Chart widget for usage without Model/View.
Definition: KDChartWidget.h:45

© 2001 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/
Generated by doxygen 1.9.1