KDChartWidget.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002    KDChart - a multi-platform charting engine
00003    */
00004 
00005 /****************************************************************************
00006  ** Copyright (C) 2001-2007 Klarälvdalens Datakonsult AB.  All rights reserved.
00007  **
00008  ** This file is part of the KD Chart library.
00009  **
00010  ** This file may be distributed and/or modified under the terms of the
00011  ** GNU General Public License version 2 as published by the Free Software
00012  ** Foundation and appearing in the file LICENSE.GPL included in the
00013  ** packaging of this file.
00014  **
00015  ** Licensees holding valid commercial KD Chart licenses may use this file in
00016  ** accordance with the KD Chart Commercial License Agreement provided with
00017  ** the Software.
00018  **
00019  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021  **
00022  ** See http://www.kdab.net/kdchart for
00023  **   information about KD Chart Commercial License Agreements.
00024  **
00025  ** Contact info@kdab.net if any conditions of this
00026  ** licensing are not clear to you.
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     // some forward declarations
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

Generated on Thu Mar 4 23:19:13 2010 for KD Chart 2 by  doxygen 1.5.4