KDChartWidget.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2011 Klaralvdalens Datakonsult AB.  All rights reserved.
00003 **
00004 ** This file is part of the KD Chart library.
00005 **
00006 ** Licensees holding valid commercial KD Chart licenses may use this file in
00007 ** accordance with the KD Chart Commercial License Agreement provided with
00008 ** the Software.
00009 **
00010 **
00011 ** This file may be distributed and/or modified under the terms of the
00012 ** GNU General Public License version 2 and version 3 as published by the
00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
00014 **
00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017 **
00018 ** Contact info@kdab.com if any conditions of this licensing are not
00019 ** clear to you.
00020 **
00021 **********************************************************************/
00022 
00023 #ifndef __KDCHARTWIDGET_H__
00024 #define __KDCHARTWIDGET_H__
00025 
00026 #include "KDChartGlobal.h"
00027 
00028 #include <QWidget>
00029 
00030 #include "KDChartEnums.h"
00031 #include "KDChartHeaderFooter.h"
00032 
00033 template <typename T> class QVector;
00034 template <typename T1, typename T2> struct QPair;
00035 
00036 namespace KDChart {
00037 
00038     // some forward declarations
00039     class AbstractDiagram;
00040     class Chart;
00041     class AbstractCoordinatePlane;
00042     class TableModel;
00043     class BarDiagram;
00044     class LineDiagram;
00045     class Plotter;
00046     class PieDiagram;
00047     class RingDiagram;
00048     class PolarDiagram;
00049     class Legend;
00050     class Position;
00051 
00058     class KDCHART_EXPORT Widget : public QWidget
00059     {
00060         Q_OBJECT
00061 
00062         Q_DISABLE_COPY( Widget )
00063         KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( Widget )
00064 
00065     public:
00073         explicit Widget( QWidget* parent = 0 );
00074 
00076         ~Widget();
00078         void setDataset( int column, const QVector< double > & data, const QString& title = QString()  );
00081         void setDataset( int column, const QVector< QPair< double, double > > &  data, const QString& title = QString() );
00083         void setDataCell( int row, int column, double data );
00085         void setDataCell( int row, int column, QPair< double, double > data );
00087         void resetData();
00088 
00089     public Q_SLOTS:
00091         void setGlobalLeading( int left, int top, int right, int bottom );
00093         void setGlobalLeadingLeft( int leading );
00095         void setGlobalLeadingTop( int leading );
00097         void setGlobalLeadingRight( int leading );
00099         void setGlobalLeadingBottom( int leading );
00100 
00101     public:
00103         int globalLeadingLeft() const;
00105         int globalLeadingTop() const;
00107         int globalLeadingRight() const;
00109         int globalLeadingBottom() const;
00110 
00112         HeaderFooter* firstHeaderFooter();
00114         QList<HeaderFooter*> allHeadersFooters();
00115 
00117         void addHeaderFooter( const QString& text,
00118                               HeaderFooter::HeaderFooterType type,
00119                               Position position );
00120 
00125         void addHeaderFooter( HeaderFooter* header );
00126 
00144         void replaceHeaderFooter( HeaderFooter* header,
00145                                   HeaderFooter* oldHeader = 0 );
00146 
00154         void takeHeaderFooter( HeaderFooter* header );
00155 
00157         Legend* legend();
00159         QList<Legend*> allLegends();
00160 
00162         void addLegend( Position position );
00164         void addLegend (Legend* legend );
00165 
00166         void replaceLegend( Legend* legend, Legend* oldLegend = 0 );
00167         void takeLegend( Legend* legend );
00168 
00169 
00171         AbstractDiagram* diagram();
00172 
00176         BarDiagram* barDiagram();
00180         LineDiagram* lineDiagram();
00188         Plotter* plotter();
00192         PieDiagram* pieDiagram();
00196         RingDiagram* ringDiagram();
00200         PolarDiagram* polarDiagram();
00201 
00203         AbstractCoordinatePlane* coordinatePlane();
00204 
00205 
00206         enum ChartType { NoType, Bar, Line, Plot, Pie, Ring, Polar };
00207 
00209         ChartType type() const;
00210 
00212         enum SubType { Normal, Stacked, Percent, Rows };
00213 
00215         SubType subType() const;
00216 
00217     public Q_SLOTS:
00219         void setType( ChartType chartType, SubType subType=Normal );
00230         void setSubType( SubType subType );
00231 
00232     private:
00234         void justifyModelSize( int rows, int columns );
00236         bool checkDatasetWidth( int width );
00237     };
00238 }
00239 
00240 #endif // KDChartWidget_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

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