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 KDCHARTPLOTTER_H 00031 #define KDCHARTPLOTTER_H 00032 00033 #include "KDChartAbstractCartesianDiagram.h" 00034 00035 #include "KDChartLineAttributes.h" 00036 #include "KDChartValueTrackerAttributes.h" 00037 00038 namespace KDChart { 00039 00040 class ThreeDLineAttributes; 00041 00045 class KDCHART_EXPORT Plotter : public AbstractCartesianDiagram 00046 { 00047 Q_OBJECT 00048 00049 Q_DISABLE_COPY( Plotter ) 00050 00051 KDCHART_DECLARE_DERIVED_DIAGRAM( Plotter, CartesianCoordinatePlane ) 00052 00053 00054 public: 00055 class PlotterType; 00056 friend class PlotterType; 00057 00058 explicit Plotter( QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 ); 00059 virtual ~Plotter(); 00060 00061 virtual Plotter* clone() const; 00062 00066 bool compare( const Plotter* other ) const; 00067 00068 enum PlotType { 00069 Normal = 0, 00070 Percent 00071 }; 00072 00073 00074 void setType( const PlotType type ); 00075 PlotType type() const; 00076 00077 void setLineAttributes( const LineAttributes & a ); 00078 void setLineAttributes( int column, const LineAttributes & a ); 00079 void setLineAttributes( const QModelIndex & index, const LineAttributes & a ); 00080 void resetLineAttributes( int column ); 00081 void resetLineAttributes( const QModelIndex & index ); 00082 LineAttributes lineAttributes() const; 00083 LineAttributes lineAttributes( int column ) const; 00084 LineAttributes lineAttributes( const QModelIndex & index ) const; 00085 00086 void setThreeDLineAttributes( const ThreeDLineAttributes & a ); 00087 void setThreeDLineAttributes( int column, const ThreeDLineAttributes & a ); 00088 void setThreeDLineAttributes( const QModelIndex & index, 00089 const ThreeDLineAttributes & a ); 00090 00091 //FIXME(khz): big TODO(khz): add a lot of reset...Attributes() methods to all 00092 // appropriate places, for 2.1 (that is: after we have release 2.0.2) :-) 00093 00094 ThreeDLineAttributes threeDLineAttributes() const; 00095 ThreeDLineAttributes threeDLineAttributes( int column ) const; 00096 ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const; 00097 00098 void setValueTrackerAttributes( const QModelIndex & index, 00099 const ValueTrackerAttributes & a ); 00100 ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const; 00101 00102 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE) 00103 // implement AbstractCartesianDiagram 00104 /* reimpl */ 00105 const int numberOfAbscissaSegments () const; 00106 /* reimpl */ 00107 const int numberOfOrdinateSegments () const; 00108 #else 00109 // implement AbstractCartesianDiagram 00110 /* reimpl */ 00111 int numberOfAbscissaSegments () const; 00112 /* reimpl */ 00113 int numberOfOrdinateSegments () const; 00114 #endif 00115 00116 protected: 00117 void paint ( PaintContext* paintContext ); 00118 00119 public: 00120 void resize ( const QSizeF& area ); 00121 00122 protected: 00123 virtual double threeDItemDepth( const QModelIndex & index ) const; 00124 virtual double threeDItemDepth( int column ) const; 00126 virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const; 00127 void paintEvent ( QPaintEvent* ); 00128 void resizeEvent ( QResizeEvent* ); 00129 }; // End of class KDChart::Plotter 00130 00131 } 00132 00133 #endif // KDCHARTLINEDIAGRAM_H