KDChartLineDiagram.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002    KDChart - a multi-platform charting engine
00003    */
00004 
00005 /****************************************************************************
00006  ** Copyright (C) 2005-2007 Klaralvdalens 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 
00030 #ifndef KDCHARTLINEDIAGRAM_H
00031 #define KDCHARTLINEDIAGRAM_H
00032 
00033 #include "KDChartAbstractCartesianDiagram.h"
00034 #include "KDChartLineAttributes.h"
00035 #include "KDChartValueTrackerAttributes.h"
00036 
00037 class QPainter;
00038 class QPolygonF;
00039 
00040 namespace KDChart {
00041 
00042     class ThreeDLineAttributes;
00043 
00049 class KDCHART_EXPORT LineDiagram : public AbstractCartesianDiagram
00050 {
00051     Q_OBJECT
00052 
00053     Q_DISABLE_COPY( LineDiagram )
00054 //    KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( LineDiagram, CartesianCoordinatePlane * )
00055 
00056     KDCHART_DECLARE_DERIVED_DIAGRAM( LineDiagram, CartesianCoordinatePlane )
00057 
00058 
00059 public:
00060     class LineDiagramType;
00061     friend class LineDiagramType;
00062 
00063     LineDiagram( QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
00064     virtual ~LineDiagram();
00065 
00066     virtual LineDiagram * clone() const;
00067 
00071     bool compare( const LineDiagram* other ) const;
00072 
00073     enum LineType {
00074         Normal =  0,
00075         Stacked = 1,
00076         Percent = 2
00077     };
00078 
00079 
00080     void setType( const LineType type );
00081     LineType type() const;
00082 
00083     void setLineAttributes( const LineAttributes & a );
00084     void setLineAttributes( int column, const LineAttributes & a );
00085     void setLineAttributes( const QModelIndex & index, const LineAttributes & a );
00086     void resetLineAttributes( int column );
00087     void resetLineAttributes( const QModelIndex & index );
00088     LineAttributes lineAttributes() const;
00089     LineAttributes lineAttributes( int column ) const;
00090     LineAttributes lineAttributes( const QModelIndex & index ) const;
00091 
00092     void setThreeDLineAttributes( const ThreeDLineAttributes & a );
00093     void setThreeDLineAttributes( int column, const ThreeDLineAttributes & a );
00094     void setThreeDLineAttributes( const QModelIndex & index,
00095                                   const ThreeDLineAttributes & a );
00096 
00097     //FIXME(khz): big TODO(khz): add a lot of reset...Attributes() methods to all
00098     // appropriate places, for 2.1 (that is: after we have release 2.0.2)  :-)
00099 
00100     ThreeDLineAttributes threeDLineAttributes() const;
00101     ThreeDLineAttributes threeDLineAttributes( int column ) const;
00102     ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
00103 
00104     void setValueTrackerAttributes( const QModelIndex & index,
00105                                     const ValueTrackerAttributes & a );
00106     ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const;
00107 
00108     // implement AbstractCartesianDiagram
00109     /* reimpl */
00110     const int numberOfAbscissaSegments () const;
00111     /* reimpl */
00112     const int numberOfOrdinateSegments () const;
00113 
00114 protected:
00115     void paint ( PaintContext* paintContext );
00116 
00117 public:
00118     void resize ( const QSizeF& area );
00119 
00120 protected:
00121     // FIXME what does that mean?
00122     double valueForCellTesting( int row, int column,
00123                                 bool& bOK,
00124                                 bool showHiddenCellsAsInvalid = false ) const;
00125     LineAttributes::MissingValuesPolicy getCellValues(
00126         int row, int column,
00127         bool shiftCountedXValuesByHalfSection,
00128         double& valueX, double& valueY ) const;
00129 
00130     virtual double threeDItemDepth( const QModelIndex & index ) const;
00131     virtual double threeDItemDepth( int column ) const;
00133     virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00134     void paintEvent ( QPaintEvent* );
00135     void resizeEvent ( QResizeEvent* );
00136 }; // End of class KDChartLineDiagram
00137 
00138 }
00139 
00140 #endif // KDCHARTLINEDIAGRAM_H

Generated on Mon Sep 17 16:16:50 2007 for KD Chart 2 by  doxygen 1.5.1