KD Chart 2  [rev.2.5]
KDChartLineDiagram.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2012 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 KDCHARTLINEDIAGRAM_H
00024 #define KDCHARTLINEDIAGRAM_H
00025 
00026 #include "KDChartAbstractCartesianDiagram.h"
00027 #include "KDChartLineAttributes.h"
00028 #include "KDChartValueTrackerAttributes.h"
00029 
00030 QT_BEGIN_NAMESPACE
00031 class QPainter;
00032 class QPolygonF;
00033 QT_END_NAMESPACE
00034 
00035 namespace KDChart {
00036 
00037     class ThreeDLineAttributes;
00038 
00044 class KDCHART_EXPORT LineDiagram : public AbstractCartesianDiagram
00045 {
00046     Q_OBJECT
00047 
00048     Q_DISABLE_COPY( LineDiagram )
00049 //    KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( LineDiagram, CartesianCoordinatePlane * )
00050 
00051     KDCHART_DECLARE_DERIVED_DIAGRAM( LineDiagram, CartesianCoordinatePlane )
00052 
00053 
00054 public:
00055     class LineDiagramType;
00056     friend class LineDiagramType;
00057 
00058     explicit LineDiagram( QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
00059     virtual ~LineDiagram();
00060 
00061     virtual LineDiagram * clone() const;
00062 
00066     bool compare( const LineDiagram* other ) const;
00067 
00068     enum LineType {
00069         Normal =  0,
00070         Stacked = 1,
00071         Percent = 2
00072     };
00073 
00074 
00075     void setType( const LineType type );
00076     LineType type() const;
00077 
00084     void setCenterDataPoints( bool center );
00086     bool centerDataPoints() const;
00087 
00093     void setReverseDatasetOrder( bool reverse );
00095     bool reverseDatasetOrder() const;
00096 
00097     void setLineAttributes( const LineAttributes & a );
00098     void setLineAttributes( int column, const LineAttributes & a );
00099     void setLineAttributes( const QModelIndex & index, const LineAttributes & a );
00100     void resetLineAttributes( int column );
00101     void resetLineAttributes( const QModelIndex & index );
00102     LineAttributes lineAttributes() const;
00103     LineAttributes lineAttributes( int column ) const;
00104     LineAttributes lineAttributes( const QModelIndex & index ) const;
00105 
00106     void setThreeDLineAttributes( const ThreeDLineAttributes & a );
00107     void setThreeDLineAttributes( int column, const ThreeDLineAttributes & a );
00108     void setThreeDLineAttributes( const QModelIndex & index,
00109                                   const ThreeDLineAttributes & a );
00110 
00111     //FIXME(khz): big TODO(khz): add a lot of reset...Attributes() methods to all
00112     // appropriate places, for 2.1 (that is: after we have release 2.0.2)  :-)
00113 
00114     ThreeDLineAttributes threeDLineAttributes() const;
00115     ThreeDLineAttributes threeDLineAttributes( int column ) const;
00116     ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
00117 
00118     void setValueTrackerAttributes( const QModelIndex & index,
00119                                     const ValueTrackerAttributes & a );
00120     ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const;
00121 
00122 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
00123     // implement AbstractCartesianDiagram
00124     /* reimpl */
00125     const int numberOfAbscissaSegments () const;
00126     /* reimpl */
00127     const int numberOfOrdinateSegments () const;
00128 #else
00129     // implement AbstractCartesianDiagram
00130     /* reimpl */
00131     int numberOfAbscissaSegments () const;
00132     /* reimpl */
00133     int numberOfOrdinateSegments () const;
00134 #endif
00135 
00136 protected:
00137     void paint ( PaintContext* paintContext );
00138 
00139 public:
00140     void resize ( const QSizeF& area );
00141 
00142 protected:
00143     // FIXME what does that mean?
00144     qreal valueForCellTesting( int row, int column,
00145                                 bool& bOK,
00146                                 bool showHiddenCellsAsInvalid = false ) const;
00147     LineAttributes::MissingValuesPolicy getCellValues(
00148         int row, int column,
00149         bool shiftCountedXValuesByHalfSection,
00150         qreal& valueX, qreal& valueY ) const;
00151 
00152     virtual qreal threeDItemDepth( const QModelIndex & index ) const;
00153     virtual qreal threeDItemDepth( int column ) const;
00155     virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00156     void paintEvent ( QPaintEvent* );
00157     void resizeEvent ( QResizeEvent* );
00158 }; // End of class KDChartLineDiagram
00159 
00160 }
00161 
00162 #endif // KDCHARTLINEDIAGRAM_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/