00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __KDCHARTWIDGET_H__
00030 #define __KDCHARTWIDGET_H__
00031
00032 #include "KDChartGlobal.h"
00033
00034 #include <QWidget>
00035
00036 #include "KDChartEnums.h"
00037 #include "KDChartHeaderFooter.h"
00038
00039 template <typename T> class QVector;
00040 template <typename T1, typename T2> struct QPair;
00041
00042 namespace KDChart {
00043
00044
00045 class AbstractDiagram;
00046 class Chart;
00047 class AbstractCoordinatePlane;
00048 class TableModel;
00049 class BarDiagram;
00050 class LineDiagram;
00051 class Plotter;
00052 class PieDiagram;
00053 class RingDiagram;
00054 class PolarDiagram;
00055 class Legend;
00056 class Position;
00057
00064 class KDCHART_EXPORT Widget : public QWidget
00065 {
00066 Q_OBJECT
00067
00068 Q_DISABLE_COPY( Widget )
00069 KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( Widget )
00070
00071 public:
00079 explicit Widget( QWidget* parent = 0 );
00080
00082 ~Widget();
00084 void setDataset( int column, const QVector< double > & data, const QString& title = QString() );
00087 void setDataset( int column, const QVector< QPair< double, double > > & data, const QString& title = QString() );
00089 void setDataCell( int row, int column, double data );
00091 void setDataCell( int row, int column, QPair< double, double > data );
00093 void resetData();
00094
00095 public Q_SLOTS:
00097 void setGlobalLeading( int left, int top, int right, int bottom );
00099 void setGlobalLeadingLeft( int leading );
00101 void setGlobalLeadingTop( int leading );
00103 void setGlobalLeadingRight( int leading );
00105 void setGlobalLeadingBottom( int leading );
00106
00107 public:
00109 int globalLeadingLeft() const;
00111 int globalLeadingTop() const;
00113 int globalLeadingRight() const;
00115 int globalLeadingBottom() const;
00116
00118 HeaderFooter* firstHeaderFooter();
00120 QList<HeaderFooter*> allHeadersFooters();
00121
00123 void addHeaderFooter( const QString& text,
00124 HeaderFooter::HeaderFooterType type,
00125 Position position );
00126
00131 void addHeaderFooter( HeaderFooter* header );
00132
00150 void replaceHeaderFooter( HeaderFooter* header,
00151 HeaderFooter* oldHeader = 0 );
00152
00160 void takeHeaderFooter( HeaderFooter* header );
00161
00163 Legend* legend();
00165 QList<Legend*> allLegends();
00166
00168 void addLegend( Position position );
00170 void addLegend (Legend* legend );
00171
00172 void replaceLegend( Legend* legend, Legend* oldLegend = 0 );
00173 void takeLegend( Legend* legend );
00174
00175
00177 AbstractDiagram* diagram();
00178
00182 BarDiagram* barDiagram();
00186 LineDiagram* lineDiagram();
00194 Plotter* plotter();
00198 PieDiagram* pieDiagram();
00202 RingDiagram* ringDiagram();
00206 PolarDiagram* polarDiagram();
00207
00209 AbstractCoordinatePlane* coordinatePlane();
00210
00211
00212 enum ChartType { NoType, Bar, Line, Plot, Pie, Ring, Polar };
00213
00215 ChartType type() const;
00216
00218 enum SubType { Normal, Stacked, Percent, Rows };
00219
00221 SubType subType() const;
00222
00223 public Q_SLOTS:
00225 void setType( ChartType chartType, SubType subType=Normal );
00236 void setSubType( SubType subType );
00237
00238 private:
00240 void justifyModelSize( int rows, int columns );
00242 bool checkDatasetWidth( int width );
00243 };
00244 }
00245
00246 #endif // KDChartWidget_H