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     explicit 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 
00089     void setCenterDataPoints( bool center );
00091     bool centerDataPoints() const;
00092 
00093     void setLineAttributes( const LineAttributes & a );
00094     void setLineAttributes( int column, const LineAttributes & a );
00095     void setLineAttributes( const QModelIndex & index, const LineAttributes & a );
00096     void resetLineAttributes( int column );
00097     void resetLineAttributes( const QModelIndex & index );
00098     LineAttributes lineAttributes() const;
00099     LineAttributes lineAttributes( int column ) const;
00100     LineAttributes lineAttributes( const QModelIndex & index ) const;
00101 
00102     void setThreeDLineAttributes( const ThreeDLineAttributes & a );
00103     void setThreeDLineAttributes( int column, const ThreeDLineAttributes & a );
00104     void setThreeDLineAttributes( const QModelIndex & index,
00105                                   const ThreeDLineAttributes & a );
00106 
00107     //FIXME(khz): big TODO(khz): add a lot of reset...Attributes() methods to all
00108     // appropriate places, for 2.1 (that is: after we have release 2.0.2)  :-)
00109 
00110     ThreeDLineAttributes threeDLineAttributes() const;
00111     ThreeDLineAttributes threeDLineAttributes( int column ) const;
00112     ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
00113 
00114     void setValueTrackerAttributes( const QModelIndex & index,
00115                                     const ValueTrackerAttributes & a );
00116     ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const;
00117 
00118 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
00119     // implement AbstractCartesianDiagram
00120     /* reimpl */
00121     const int numberOfAbscissaSegments () const;
00122     /* reimpl */
00123     const int numberOfOrdinateSegments () const;
00124 #else
00125     // implement AbstractCartesianDiagram
00126     /* reimpl */
00127     int numberOfAbscissaSegments () const;
00128     /* reimpl */
00129     int numberOfOrdinateSegments () const;
00130 #endif
00131 
00132 protected:
00133     void paint ( PaintContext* paintContext );
00134 
00135 public:
00136     void resize ( const QSizeF& area );
00137 
00138 protected:
00139     // FIXME what does that mean?
00140     double valueForCellTesting( int row, int column,
00141                                 bool& bOK,
00142                                 bool showHiddenCellsAsInvalid = false ) const;
00143     LineAttributes::MissingValuesPolicy getCellValues(
00144         int row, int column,
00145         bool shiftCountedXValuesByHalfSection,
00146         double& valueX, double& valueY ) const;
00147 
00148     virtual double threeDItemDepth( const QModelIndex & index ) const;
00149     virtual double threeDItemDepth( int column ) const;
00151     virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00152     void paintEvent ( QPaintEvent* );
00153     void resizeEvent ( QResizeEvent* );
00154 }; // End of class KDChartLineDiagram
00155 
00156 }
00157 
00158 #endif // KDCHARTLINEDIAGRAM_H

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