kchart

KDChartParams.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-2003 Klarälvdalens Datakonsult AB.  All rights reserved.
00007  **
00008  ** This file is part of the KDChart 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 KDChart licenses may use this file in
00016  ** accordance with the KDChart 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.klaralvdalens-datakonsult.se/?page=products for
00023  **   information about KDChart Commercial License Agreements.
00024  **
00025  ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
00026  ** licensing are not clear to you.
00027  **
00028  **********************************************************************/
00029 #ifndef __KDCHARTPARAMS_H__
00030 #define __KDCHARTPARAMS_H__
00031 
00032 #include <qapplication.h>
00033 #include <qfont.h>
00034 #include <qcolor.h>
00035 #include <qpen.h>
00036 #include <qmap.h>
00037 #include <qdict.h>
00038 #include <qintdict.h>
00039 #include <qobject.h>
00040 #include <qtextstream.h>
00041 #include <qsimplerichtext.h>
00042 #include <qdom.h>
00043 #include <limits.h>
00044 
00045 #include <math.h>
00046 #ifdef Q_WS_WIN
00047 #define M_PI 3.14159265358979323846
00048 #endif
00049 
00050 #include "KDChartGlobal.h"
00051 #include "KDChartEnums.h"
00052 #include "KDChartCustomBox.h"
00053 #include "KDFrame.h"
00054 #include "KDChartAxisParams.h"
00055 #include "KDChartPropertySet.h"
00056 
00057 #if COMPAT_QT_VERSION >= 0x030000
00058 #include <qvaluevector.h>
00059 #else
00060 #include <qarray.h>
00061 #endif
00062 
00073 typedef QIntDict<KDChartPropertySet> KDChartPropertySetList;
00074 
00075 #define KDCHART_ALL_AXES UINT_MAX-1
00076 
00077 // PENDING(blackie) KHZ, please clean up here. I guess this defined can be removed now.
00078 // Note: The following specification matches the UINT_MAX value used
00079 //       in KDChartAxisParams::KDChartAxisParams() to initialize the
00080 //       axis' _axisIsoRefAxis member.
00081 //       OK, this is a dirty hack but is avoids circular dependency
00082 //       between KDChartParams and KDChartAxisParams
00083 #define KDCHART_NO_AXIS UINT_MAX
00084 #define KDCHART_ALL_DATASETS UINT_MAX - 1
00085 
00086 #define KDCHART_NO_DATASET UINT_MAX
00087 #define KDCHART_UNKNOWN_CHART UINT_MAX - 2
00088 #define KDCHART_ALL_CHARTS UINT_MAX - 1
00089 #define KDCHART_NO_CHART UINT_MAX
00090 #define KDCHART_GLOBAL_LINE_STYLE UINT_MAX
00091 #define KDCHART_AUTO_SIZE INT_MAX
00092 #define KDCHART_DATA_VALUE_AUTO_DIGITS INT_MAX
00093 #define KDCHART_SAGITTAL_ROTATION INT_MAX
00094 #define KDCHART_TANGENTIAL_ROTATION INT_MAX - 1
00095 #define KDCHART_PROPSET_NORMAL_DATA 0
00096 #define KDCHART_PROPSET_TRANSPARENT_DATA 1
00097 #define KDCHART_PROPSET_HORI_LINE  2
00098 #define KDCHART_PROPSET_VERT_LINE  3
00099 
00100 // #define KDCHART_DATA_VALUE_AUTO_COLOR KDChartAutoColor::instance()->color()
00101 
00102 // PENDING(blackie) Can we delete this now?
00103 /* we must keep this wrongly spelled value for backward compatibility reasons */
00104 #define KDCHART_SAGGITAL_ROTATION INT_MAX
00105 
00110 #define KDCHART_CNT_ORDINATES 4
00111 
00112 #define KDCHART_MAX_POLAR_DELIMS_AND_LABELS_POS 8
00113 #define KDCHART_MAX_AXES 12
00114 
00115 
00116 #define KDCHART_DATA_VALUE_AUTO_COLOR (KDChartAutoColor::instance()->color())
00117 
00118 class KDCHART_EXPORT KDChartAutoColor {
00119 public:
00120     static const KDChartAutoColor* instance();
00121     static void freeInstance();
00122     const QColor* color() const
00123     {
00124         return &mColor;
00125     }
00126 private:
00127     KDChartAutoColor();
00128     KDChartAutoColor( KDChartAutoColor const& );
00129     ~KDChartAutoColor();
00130     QColor mColor;
00131     static KDChartAutoColor *mInstance;
00132 };
00133 
00134 /*
00135 // #define KDCHART_DATA_VALUE_AUTO_COLOR KDChartParams_KDChartAutoColor
00136 */
00137 
00138 
00139 class KDCHART_EXPORT KDChartParams : public QObject
00140 {
00141     Q_OBJECT
00142     Q_ENUMS(ChartType)
00143     Q_ENUMS(SourceMode)
00144     Q_ENUMS(BarChartSubType)
00145     Q_ENUMS(LineChartSubType)
00146     Q_ENUMS(LineMarkerStyle)
00147     Q_ENUMS(AreaChartSubType)
00148     Q_ENUMS(AreaLocation)
00149     Q_ENUMS(PolarChartSubType)
00150     Q_ENUMS(PolarMarkerStyle)
00151     Q_ENUMS(HiLoChartSubType)
00152     Q_ENUMS(BWChartSubType)
00153     Q_ENUMS(BWStatVal)
00154     Q_ENUMS(LegendPosition)
00155     Q_ENUMS(LegendSource)
00156     Q_ENUMS(HdFtPos)
00157 
00158     // Needed for QSA
00159     Q_ENUMS( BrushStyle )
00160     Q_ENUMS( PenStyle )
00161     Q_ENUMS( Orientation )
00162 
00163 public slots: // PENDING(blackie) merge public slots into one section.
00164     void setOptimizeOutputForScreen( bool screenOutput )
00165         {
00166             _optimizeOutputForScreen = screenOutput;
00167         }
00168 
00169 
00170     bool optimizeOutputForScreen() const
00171         {
00172             return _optimizeOutputForScreen;
00173         }
00174 
00175     void setGlobalLeading( int left, int top, int right, int bottom );
00176 
00177     void setGlobalLeadingLeft( int leading )
00178         {
00179             _globalLeadingLeft = leading;
00180             emit changed();
00181         }
00182     void setGlobalLeadingTop( int leading )
00183         {
00184             _globalLeadingTop = leading;
00185             emit changed();
00186         }
00187     void setGlobalLeadingRight( int leading )
00188         {
00189             _globalLeadingRight = leading;
00190             emit changed();
00191         }
00192     void setGlobalLeadingBottom( int leading )
00193         {
00194             _globalLeadingBottom = leading;
00195             emit changed();
00196         }
00197     int globalLeadingLeft() const
00198         {
00199             return _globalLeadingLeft;
00200         }
00201     int globalLeadingTop() const
00202         {
00203             return _globalLeadingTop;
00204         }
00205     int globalLeadingRight() const
00206         {
00207             return _globalLeadingRight;
00208         }
00209     int globalLeadingBottom() const
00210         {
00211             return _globalLeadingBottom;
00212         }
00213 
00214     int registerProperties( KDChartPropertySet& rSet );
00215     void setProperties( int id, KDChartPropertySet& rSet );
00216     bool removeProperties( int id );
00217     bool properties( int id, KDChartPropertySet& rSet ) const;
00218     KDChartPropertySet* properties( int id );
00219     bool calculateProperties( int startId, KDChartPropertySet& rSet ) const;
00220 
00221 public:
00222 
00223 // MOC_SKIP_BEGIN
00224     class KDCHART_EXPORT KDChartFrameSettings
00225     {
00226         // Q_OBJECT
00227     public:
00228         KDChartFrameSettings();
00229         KDChartFrameSettings( uint           dataRow,
00230                               uint           dataCol,
00231                               uint           data3rd,
00232                               const KDFrame& frame,
00233                               int            outerGapX,
00234                               int            outerGapY,
00235                               int            innerGapX,
00236                               int            innerGapY,
00237                               bool           addFrameWidthToLayout  = true,
00238                               bool           addFrameHeightToLayout = true );
00239 
00240         // public slots:
00241         uint dataRow() const
00242             {
00243                 return _dataRow;
00244             }
00245         uint dataCol() const
00246             {
00247                 return _dataCol;
00248             }
00249         uint data3rd() const
00250             {
00251                 return _data3rd;
00252             }
00253 
00254         void setDataRow( uint dataRow )
00255             {
00256                 _dataRow = dataRow;
00257             }
00258         void setDataCol( uint dataCol )
00259             {
00260                 _dataCol = dataCol;
00261             }
00262         void setData3rd( uint data3rd )
00263             {
00264                 _data3rd = data3rd;
00265             }
00266 
00267 
00268         void resetFrame()
00269         {
00270             if( _frame )
00271                 delete _frame;
00272             _frame = new KDFrame();
00273         }
00274 
00275 
00276         const KDFrame* framePtr() const
00277             {
00278                 return _frame;
00279             }
00280 
00281 
00282         const KDFrame& frame() const
00283             {
00284                 return *_frame;
00285             }
00286 
00287 
00288         int innerGapX() const
00289             {
00290                 return _innerGapX;
00291             }
00292 
00293 
00294         int innerGapY() const
00295             {
00296                 return _innerGapY;
00297             }
00298 
00299 
00300         int outerGapX() const
00301             {
00302                 return _outerGapX;
00303             }
00304 
00305 
00306         int outerGapY() const
00307             {
00308                 return _outerGapY;
00309             }
00310 
00311 
00312         bool addFrameWidthToLayout() const
00313             {
00314                 return _addFrameWidthToLayout;
00315             }
00316 
00317 
00318         bool addFrameHeightToLayout() const
00319             {
00320                 return _addFrameHeightToLayout;
00321             }
00322 
00323         // public:
00324         virtual ~KDChartFrameSettings();
00325 
00326 
00327         static void createFrameSettingsNode( QDomDocument& document,
00328                                              QDomNode& parent,
00329                                              const QString& elementName,
00330                                              const KDChartFrameSettings* settings,
00331                                              uint areaId );
00332 
00333         static bool readFrameSettingsNode( const QDomElement& element,
00334                                            KDChartFrameSettings& settings,
00335                                            uint& areaId );
00336 
00337 
00338         static void deepCopy( KDChartFrameSettings& D, const KDChartFrameSettings& R ) {
00339             D._dataRow = R._dataRow;
00340             D._dataCol = R._dataCol;
00341             D._data3rd = R._data3rd;
00342 
00343             delete D._frame;
00344             if( R._frame ){
00345                 D._frame = new KDFrame();
00346                 KDFrame::deepCopy(*D._frame, *R._frame);
00347             }else{
00348                 D._frame = 0;
00349             }
00350 
00351             D._outerGapX = R._outerGapX;
00352             D._outerGapY = R._outerGapY;
00353             D._innerGapX = R._innerGapX;
00354             D._innerGapY = R._innerGapY;
00355             D._addFrameWidthToLayout = R._addFrameWidthToLayout;
00356             D._addFrameHeightToLayout = R._addFrameHeightToLayout;
00357         }
00358 
00359     private:
00360         // KDChartFrameSettings( const KDChartFrameSettings& other ) :QObject( 0 ) {
00361         KDChartFrameSettings( const KDChartFrameSettings& ) {}
00362         KDChartFrameSettings& operator=( const KDChartFrameSettings& ){return *this;}
00363 
00364 
00365     private:
00366         uint    _dataRow;
00367         uint    _dataCol;
00368         uint    _data3rd;
00369         KDFrame* _frame;
00370         int     _outerGapX;
00371         int     _outerGapY;
00372         int     _innerGapX;
00373         int     _innerGapY;
00374         bool    _addFrameWidthToLayout;
00375         bool    _addFrameHeightToLayout;
00376     };
00377 
00378 // MOC_SKIP_END
00379 
00380 public slots:
00381 
00382     void setFrame( uint           area,
00383                    const KDFrame& frame,
00384                    int            outerGapX,
00385                    int            outerGapY,
00386                    int            innerGapX,
00387                    int            innerGapY,
00388                    bool           addFrameWidthToLayout = true,
00389                    bool           addFrameHeightToLayout = true )
00390         {
00391             _areaDict.setAutoDelete( TRUE );
00392             _areaDict.insert( QString( "%1/-----/-----/-----" ).arg( area, 5 ),
00393                               new KDChartFrameSettings(0,0,0,
00394                                                        frame,
00395                                                        outerGapX,
00396                                                        outerGapY,
00397                                                        innerGapX,
00398                                                        innerGapY,
00399                                                        addFrameWidthToLayout,
00400                                                        addFrameHeightToLayout ) );
00401             emit changed();
00402         }
00403 
00404 
00405     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
00406     void setSimpleFrame( uint        area,
00407                          int         outerGapX = 0,
00408                          int         outerGapY = 0,
00409                          int         innerGapX = 0,
00410                          int         innerGapY = 0,
00411                          bool        addFrameWidthToLayout      = true,
00412                          bool        addFrameHeightToLayout     = true,
00413                          KDFrame::SimpleFrame    simpleFrame    = KDFrame::FrameFlat,
00414                          int                     lineWidth      = 1,
00415                          int                     midLineWidth   = 0,
00416                          QPen                    pen            = QPen(),
00417                          QBrush                  background     = QBrush( Qt::NoBrush ),
00418                          const QPixmap*          backPixmap     = 0, // no pixmap
00419                          KDFrame::BackPixmapMode backPixmapMode = KDFrame::PixStretched,
00420                          int                     shadowWidth    = 0,
00421                          KDFrame::CornerName     sunPos         = KDFrame::CornerTopLeft )
00422         {
00423             _areaDict.setAutoDelete( TRUE );
00424             KDFrame frame( QRect(0,0,0,0),
00425                      simpleFrame,
00426                      lineWidth,
00427                      midLineWidth,
00428                      pen,
00429                      background,
00430                      backPixmap,
00431                      backPixmapMode,
00432                      shadowWidth,
00433                            sunPos );
00434 
00435             _areaDict.insert( QString( "%1/-----/-----/-----" ).arg( area, 5 ),
00436                               new KDChartFrameSettings( 0,0,0, frame,
00437                                                         outerGapX,
00438                                                         outerGapY,
00439                                                         innerGapX,
00440                                                         innerGapY,
00441                                                         addFrameWidthToLayout,
00442                                                         addFrameHeightToLayout ) );
00443             emit changed();
00444         }
00445 
00446 
00447     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
00448     void setDataRegionFrame( uint dataRow,
00449                              uint dataCol,
00450                              uint, // important: we ignore the data3rd parameter for now!
00451                              int  innerGapX = 0,
00452                              int  innerGapY = 0,
00453                              bool addFrameWidthToLayout      = true,
00454                              bool addFrameHeightToLayout     = true,
00455                              KDFrame::SimpleFrame    simpleFrame    = KDFrame::FrameFlat,
00456                              int                     lineWidth      = 1,
00457                              int                     midLineWidth   = 0,
00458                              QPen                    pen            = QPen(),
00459                              int                     shadowWidth    = 0,
00460                              KDFrame::CornerName     sunPos         = KDFrame::CornerTopLeft )
00461         {
00462             _areaDict.setAutoDelete( TRUE );
00463             KDFrame frame( QRect(0,0,0,0),
00464                            simpleFrame,
00465                            lineWidth,
00466                            midLineWidth,
00467                            pen,
00468                            QBrush( Qt::NoBrush ),
00469                            0,
00470                            KDFrame::PixStretched,
00471                            shadowWidth,
00472                            sunPos );
00473 
00474             _areaDict.insert(
00475                 dataRegionFrameAreaName( dataRow, dataCol, 0 ), //data3rd 5 ),
00476                 new KDChartFrameSettings( dataRow,
00477                                           dataCol,
00478                                           0, // important: we ignore the data3rd parameter for now!
00479                                           frame,
00480                                           0,
00481                                           0,
00482                                           innerGapX,
00483                                           innerGapY,
00484                                           addFrameWidthToLayout,
00485                                           addFrameHeightToLayout ) );
00486             emit changed();
00487         }
00488 
00489 
00490     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
00491     bool moveDataRegionFrame( uint oldDataRow,
00492                              uint oldDataCol,
00493                              uint, // important: we ignore the data3rd parameter for now!
00494                              uint newDataRow,
00495                              uint newDataCol,
00496                              uint // important: we ignore the data3rd parameter for now!
00497                              );
00498 
00499 
00500     const KDChartFrameSettings* frameSettings( uint area,
00501                                                bool& bFound,
00502                                                int* pIterIdx=0 ) const;
00503 
00504     const KDChartFrameSettings* nextFrameSettings( bool& bFound,
00505                                                    int* pIterIdx ) const;
00506 
00507 
00508 public:
00509     typedef QIntDict <KDChartCustomBox > CustomBoxDict;
00510 
00511 public slots:
00512     uint insertCustomBox( const KDChartCustomBox & box );
00513     bool removeCustomBox( const uint & idx );
00514 
00515     void removeAllCustomBoxes()
00516     {
00517         emit changed();
00518         _customBoxDict.setAutoDelete( true );
00519         _customBoxDict.clear();
00520     }
00521 
00522     KDChartCustomBox* customBoxRef( uint box );
00523     const KDChartCustomBox* customBox( uint box ) const;
00524     uint maxCustomBoxIdx() const;
00525 
00526 
00527 public:
00528     enum ChartType { NoType, Bar, Line, Area, Pie, HiLo, Ring, Polar, BoxWhisker };
00529 
00530 public slots:
00531     void setChartType( ChartType chartType );
00532     ChartType chartType() const
00533         {
00534             return _chartType;
00535         }
00536 
00537 
00538     static QString chartTypeToString( ChartType type );
00539     static ChartType stringToChartType( const QString& string );
00540 
00541     void setAdditionalChartType( ChartType chartType );
00542     ChartType additionalChartType() const
00543         {
00544             return _additionalChartType;
00545         }
00546 public:
00547 
00548     enum SourceMode {
00549         UnknownMode      = 0,
00550         DontUse          = 1,
00551         DataEntry        = 2,
00552         AxisLabel        = 3,
00553         LegendText       = 4,
00554         ExtraLinesAnchor = 5,
00555         Last_SourceMode  = ExtraLinesAnchor };
00556 
00557 public slots:
00558     void setChartSourceMode( SourceMode mode,
00559                              uint dataset,
00560                              uint dataset2 = KDCHART_NO_DATASET,
00561                              uint chart = 0 );
00562 
00563     static QString chartSourceModeToString( const SourceMode& mode );
00564     static SourceMode stringToChartSourceMode( const QString& string );
00565 
00566 
00567     bool neverUsedSetChartSourceMode() const
00568         {
00569             return !_setChartSourceModeWasUsed;
00570         }
00571 
00572     SourceMode chartSourceMode( uint dataset,
00573                                 uint dataset2 = KDCHART_NO_DATASET,
00574                                 uint* chart = 0 ) const;
00575 
00576     bool findDataset( SourceMode mode,
00577                       uint& dataset,
00578                       uint& dataset2,
00579                       uint chart = 0 ) const;
00580 
00581     bool findDatasets( SourceMode mode1,
00582                        SourceMode mode2,
00583                        uint& dataset,
00584                        uint& dataset2,
00585                        uint chart = 0 ) const;
00586 
00587     uint maxDatasetSourceMode() const
00588         {
00589             return _maxDatasetSourceMode;
00590         }
00591 
00592 
00593     void setDefaultAxesTypes();
00594     void activateDefaultAxes();
00595 
00596 
00597     void setNumValues( uint numValues )
00598         {
00599             _numValues = numValues;
00600             emit changed();
00601         }
00602 
00603 
00604     int numValues() const
00605         {
00606             return _numValues;
00607         }
00608 
00609 
00610     void calculateShadowColors( QColor color,
00611                                 QColor& shadow1,
00612                                 QColor& shadow2 ) const;
00613 
00614     void setDataColor( uint dataset, QColor color );
00615     QColor dataColor( uint dataset ) const;
00616 
00617     void setDataDefaultColors();
00618     void setDataRainbowColors();
00619     void setDataSubduedColors( bool ordered = false );
00620 
00621 
00622     void setShadowBrightnessFactor( double factor )
00623         {
00624             _shadowBrightnessFactor = factor;
00625             recomputeShadowColors();
00626             emit changed();
00627         }
00628 
00629     double shadowBrightnessFactor() const
00630         {
00631             return _shadowBrightnessFactor;
00632         }
00633 
00634 
00635     void setShadowPattern( BrushStyle style ) {
00636         _shadowPattern = style;
00637         emit changed();
00638     }
00639 
00640     Qt::BrushStyle shadowPattern() const {
00641         return _shadowPattern;
00642     }
00643 
00644 
00645     void setOutlineDataColor( QColor color )
00646         {
00647             _outlineDataColor = color;
00648             emit changed();
00649         }
00650 
00651 
00652     QColor outlineDataColor() const
00653         {
00654             return _outlineDataColor;
00655         }
00656 
00657 
00658     void setOutlineDataLineWidth( uint width )
00659         {
00660             _outlineDataLineWidth = width;
00661             emit changed();
00662         }
00663 
00664     uint outlineDataLineWidth() const
00665         {
00666             return _outlineDataLineWidth;
00667         }
00668 
00669 
00670     void setOutlineDataLineStyle( PenStyle style )
00671         {
00672             _outlineDataLineStyle = style;
00673             emit changed();
00674         }
00675 
00676     PenStyle outlineDataLineStyle() const
00677         {
00678             return _outlineDataLineStyle;
00679         }
00680 
00681 
00682     uint maxDataColor() const
00683         {
00684             return _maxDatasetColor;
00685         }
00686 
00687 
00688     void setThreeDShadowColors( bool shadow )
00689         {
00690             _threeDShadowColors = shadow;
00691             emit changed();
00692         }
00693 
00694 
00695     bool threeDShadowColors() const
00696         {
00697             return _threeDShadowColors;
00698         }
00699 
00700 
00701     static int roundVal( double d )
00702         {
00703             double fr;
00704             double i=0.0; // initialization necessary for Borland C++
00705             fr = modf( d, &i );
00706             int ret = static_cast < int > ( i );
00707             if( 0.49999 <= fabs( fr ) )
00708                 ret += ( 0.0 < d ) ? 1 : -1;
00709             return ret;
00710         }
00711 
00712     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
00713     void setPrintDataValues( bool active,
00714                              uint chart = KDCHART_ALL_CHARTS,
00715                              int divPow10 = 0,
00716                              int digitsBehindComma = KDCHART_DATA_VALUE_AUTO_DIGITS,
00717                              QFont* font   = 0,
00718                              uint size     = UINT_MAX, //  <-- makes us use the *default* font params
00719                              //                                by IGNORING settings of
00720                              //                                the following parameters!
00721                              const QColor* color = KDCHART_DATA_VALUE_AUTO_COLOR,
00722                              KDChartEnums::PositionFlag negativePosition = KDChartEnums::PosCenter,
00723                              uint negativeAlign    = Qt::AlignCenter,
00724                              int  negativeDeltaX   =    0,
00725                              int  negativeDeltaY   =    0,
00726                              int  negativeRotation =    0,
00727                              KDChartEnums::PositionFlag positivePosition = KDChartEnums::PosCenter,
00728                              uint positiveAlign    = Qt::AlignCenter,
00729                              int  positiveDeltaX   =    0,
00730                              int  positiveDeltaY   =    0,
00731                              int  positiveRotation =    0,
00732                              KDChartEnums::TextLayoutPolicy policy = KDChartEnums::LayoutPolicyRotate );
00733 
00734     void setDataValuesCalc( int divPow10 = 0,
00735                             int digitsBehindComma = KDCHART_DATA_VALUE_AUTO_DIGITS,
00736                             uint chart = KDCHART_ALL_CHARTS );
00737     void setDataValuesFont( QFont* font,
00738                             uint size  = UINT_MAX,
00739                             uint chart = KDCHART_ALL_CHARTS );
00740 
00741     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
00742     void setDataValuesPlacing( KDChartEnums::PositionFlag position,
00743                                uint align,
00744                                int  deltaX,
00745                                int  deltaY,
00746                                int  rotation,
00747                                bool specifyingPositiveValues = true,
00748                                uint chart = KDCHART_ALL_CHARTS );
00749 
00750     void setDataValuesColors( const QColor* color = KDCHART_DATA_VALUE_AUTO_COLOR,
00751                               const QBrush& background = Qt::NoBrush,
00752                               uint chart = KDCHART_ALL_CHARTS );
00753 
00754     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
00755     void setDataValuesPolicy( KDChartEnums::TextLayoutPolicy policy = KDChartEnums::LayoutPolicyRotate,
00756                               uint chart = KDCHART_ALL_CHARTS );
00757 
00758     void setDataValuesShowInfinite( bool dataValuesShowInfinite = true,
00759                                     uint chart = KDCHART_ALL_CHARTS );
00760 
00761     void setPrintDataValuesWithDefaultFontParams( uint chart = KDCHART_ALL_CHARTS,
00762                                                   bool callSetPrintDataValues = true );
00763 
00764     void setAllowOverlappingDataValueTexts( bool allow )
00765         {
00766             _allowOverlappingDataValueTexts = allow;
00767         }
00768 
00769 
00770     bool allowOverlappingDataValueTexts() const
00771         {
00772             return _allowOverlappingDataValueTexts;
00773         }
00774 
00775     bool printDataValuesWithDefaultFontParams( uint chart ) const
00776         {
00777             return chart ? _printDataValuesSettings2._useDefaultFontParams
00778                 : _printDataValuesSettings._useDefaultFontParams;
00779         }
00780 
00781     bool printDataValues( uint chart ) const
00782         {
00783             return chart ? _printDataValuesSettings2._printDataValues
00784                 : _printDataValuesSettings._printDataValues;
00785         }
00786 
00787 
00788     int dataValuesDivPow10( uint chart ) const
00789         {
00790             return chart ? _printDataValuesSettings2._divPow10
00791                 : _printDataValuesSettings._divPow10;
00792         }
00793 
00794 
00795     int dataValuesDigitsBehindComma( uint chart ) const
00796         {
00797             return chart ? _printDataValuesSettings2._digitsBehindComma
00798                 : _printDataValuesSettings._digitsBehindComma;
00799         }
00800 
00801 
00802     QFont dataValuesFont( uint chart ) const
00803         {
00804             return chart ? _printDataValuesSettings2._dataValuesFont
00805                 : _printDataValuesSettings._dataValuesFont;
00806         }
00807 
00808 
00809     bool dataValuesUseFontRelSize( uint chart ) const
00810         {     
00811             return chart ? _printDataValuesSettings2._dataValuesUseFontRelSize
00812                 : _printDataValuesSettings._dataValuesUseFontRelSize;
00813         }
00814 
00815 
00816     int dataValuesFontRelSize( uint chart ) const
00817         {
00818             return chart ? _printDataValuesSettings2._dataValuesFontRelSize
00819                 : _printDataValuesSettings._dataValuesFontRelSize;
00820         }
00821 
00822 
00823     QColor dataValuesColor( uint chart ) const
00824         {
00825             return chart ? _printDataValuesSettings2._dataValuesColor
00826                 : _printDataValuesSettings._dataValuesColor;
00827         }
00828 
00829 
00830     QBrush dataValuesBackground( uint chart ) const
00831         {
00832             return chart ? _printDataValuesSettings2._dataValuesBrush
00833                 : _printDataValuesSettings._dataValuesBrush;
00834         }
00835 
00836 
00837     bool dataValuesAutoColor( uint chart ) const
00838         {
00839             return chart ? _printDataValuesSettings2._dataValuesAutoColor
00840                 : _printDataValuesSettings._dataValuesAutoColor;
00841         }
00842 
00843 
00844     KDChartEnums::PositionFlag dataValuesAnchorPosition( uint chart,
00845                                                          bool negative ) const;
00846     uint dataValuesAnchorAlign( uint chart, bool negative ) const;
00847     int dataValuesAnchorDeltaX( uint chart, bool negative ) const;
00848     int dataValuesAnchorDeltaY( uint chart, bool negative ) const;
00849     int dataValuesRotation( uint chart, bool negative ) const;
00850 
00851     KDChartEnums::TextLayoutPolicy dataValuesLayoutPolicy( uint chart ) const
00852         {
00853             return chart ? _printDataValuesSettings2._dataValuesLayoutPolicy
00854                 : _printDataValuesSettings._dataValuesLayoutPolicy;
00855         }
00856 
00857 
00858     bool dataValuesShowInfinite( uint chart ) const
00859         {
00860             return chart ? _printDataValuesSettings2._dataValuesShowInfinite
00861                 : _printDataValuesSettings._dataValuesShowInfinite;
00862         }
00863 
00864 
00865     // for backward compatibility we may NOT remove these functions:
00866     void setPrintDataValuesColor( uint chart = KDCHART_ALL_CHARTS,
00867                                   const QColor* color = KDCHART_DATA_VALUE_AUTO_COLOR );
00868     void setPrintDataValuesFontRelSize( uint chart, uint size );
00869 
00870 
00871     static QString markerStyleToString(   int style );
00872     static QString markerStyleToStringTr( int style );
00873     static int stringToMarkerStyle(   const QString& string );
00874     static int stringToMarkerStyleTr( const QString& string );
00875 
00876     // END GENERAL
00877 
00878 
00879 public:
00880 
00881     // BAR CHART-SPECIFIC
00882     enum BarChartSubType { BarNormal, BarStacked, BarPercent, BarMultiRows };
00883 
00884 public slots:
00885     void setBarChartSubType( BarChartSubType barChartSubType )
00886         {
00887             _barChartSubType = barChartSubType;
00888             emit changed();
00889         }
00890 
00891     BarChartSubType barChartSubType() const
00892         {
00893             return _barChartSubType;
00894         }
00895 
00896 
00897 
00898 
00899 
00900     static QString barChartSubTypeToString( BarChartSubType type );
00901     static BarChartSubType stringToBarChartSubType( const QString& string );
00902 
00903 
00904     void setThreeDBars( bool threeDBars )
00905         {
00906             _threeDBars = threeDBars;
00907             emit changed();
00908         }
00909 
00910     bool threeDBars() const
00911         {
00912             return _threeDBars;
00913         }
00914 
00915 
00916     void setThreeDBarsShadowColors( bool shadow )
00917         {
00918             _threeDShadowColors = shadow;
00919             emit changed();
00920         }
00921 
00922 
00923     bool threeDBarsShadowColors() const
00924         {
00925             return _threeDShadowColors;
00926         }
00927 
00928 
00929     QColor dataShadow1Color( uint dataset ) const;
00930     QColor dataShadow2Color( uint dataset ) const;
00931 
00932 
00933     void setThreeDBarAngle( uint angle );
00934     uint threeDBarAngle() const
00935         {
00936             return _threeDBarAngle;
00937         }
00938 
00939 
00940     double cosThreeDBarAngle() const
00941         {
00942             return _cosThreeDBarAngle;
00943         }
00944 
00945 
00946     void setThreeDBarDepth( double depth )
00947         {
00948             _threeDBarDepth = depth;
00949             emit changed();
00950         }
00951 
00952 
00953     double threeDBarDepth() const
00954         {
00955             return _threeDBarDepth;
00956         }
00957 
00958 
00959     void setDatasetGap( int gap )
00960         {
00961             _datasetGap = gap;
00962             emit changed();
00963         }
00964 
00965     int datasetGap() const
00966         {
00967             return _datasetGap;
00968         }
00969 
00970 
00971     void setDatasetGapIsRelative( bool gapIsRelative )
00972         {
00973             _datasetGapIsRelative = gapIsRelative;
00974             emit changed();
00975         }
00976 
00977     bool datasetGapIsRelative() const
00978         {
00979             return _datasetGapIsRelative;
00980         }
00981 
00982 
00983     void setValueBlockGap( int gap )
00984         {
00985             _valueBlockGap = gap;
00986             emit changed();
00987         }
00988 
00989     int valueBlockGap() const
00990         {
00991             return _valueBlockGap;
00992         }
00993 
00994 
00995     void setValueBlockGapIsRelative( bool gapIsRelative )
00996         {
00997             _valueBlockGapIsRelative = gapIsRelative;
00998             emit changed();
00999         }
01000 
01001     bool valueBlockGapIsRelative() const
01002         {
01003             return _valueBlockGapIsRelative;
01004         }
01005 
01006 
01007     void setBarWidth( int width = KDCHART_AUTO_SIZE )
01008         { 
01009           if ( width == KDCHART_AUTO_SIZE ) {
01010         _barWidth = width;
01011             _userWidth = 0;
01012       }
01013           else 
01014       _userWidth = width;
01015 
01016           emit changed();
01017         }
01018  
01019 
01020     int barWidth() const
01021         {
01022             return _barWidth;
01023         }
01024 
01025   int userWidth() const
01026         {
01027       return _userWidth;
01028         }
01029 
01030     int numBarsDisplayed() const
01031         {
01032             return _barsDisplayed;
01033         }
01034 
01035     int numBarsLeft() const
01036         {
01037             return _barsLeft;
01038         }
01039 
01040     void setDrawSolidExcessArrows( bool solidArrows ) {
01041         _solidExcessArrows = solidArrows;
01042         emit changed();
01043     }
01044 
01045     bool drawSolidExcessArrows() const
01046         {
01047             return _solidExcessArrows;
01048         }
01049 
01050     // END BAR CHART-SPECIFIC
01051 
01052 public:
01053     // LINE/AREA CHART-SPECIFIC
01054     enum LineChartSubType { LineNormal, LineStacked, LinePercent };
01055 
01056 public slots:
01057     void setLineChartSubType( LineChartSubType lineChartSubType )
01058         {
01059             _lineChartSubType = lineChartSubType;
01060             emit changed();
01061         }
01062 
01063     LineChartSubType lineChartSubType() const
01064         {
01065             return _lineChartSubType;
01066         }
01067 
01068 
01069     static LineChartSubType stringToLineChartSubType( const QString& string );
01070     static QString lineChartSubTypeToString( LineChartSubType type );
01071 
01072 
01073     void setLineMarker( bool marker )
01074         {
01075             _lineMarker = marker;
01076             emit changed();
01077         }
01078 
01079     bool lineMarker() const
01080         {
01081             return _lineMarker;
01082         }
01083 
01084 public:
01085     enum LineMarkerStyle { LineMarkerCircle  = 0,
01086             LineMarkerSquare  = 1,
01087             LineMarkerDiamond = 2,
01088             LineMarker1Pixel  = 3,
01089             LineMarker4Pixels = 4,
01090             LineMarkerRing    = 5,
01091             LineMarkerCross   = 6,
01092             LineMarkerFastCross = 7 };
01093 
01094     // PENDING(blackie) Add a wrapper for this
01095     typedef QMap<uint,LineMarkerStyle> LineMarkerStyleMap;
01096 public slots:
01097 
01098         void setLineMarkerStyle( uint dataset, LineMarkerStyle style );
01099     void setLineMarkerStyles( LineMarkerStyleMap map );
01100     LineMarkerStyle lineMarkerStyle( uint dataset ) const;
01101 
01102     static QString lineMarkerStyleToString( LineMarkerStyle style );
01103     static QString lineMarkerStyleToStringTr( LineMarkerStyle style );
01104     static LineMarkerStyle stringToLineMarkerStyle( const QString& string );
01105     static LineMarkerStyle stringToLineMarkerStyleTr( const QString& string );
01106 
01107     LineMarkerStyleMap lineMarkerStyles() const {
01108         return _lineMarkerStyles;
01109     }
01110 
01111 
01112     uint maxDatasetLineMarkerStyle() const
01113         {
01114             return _maxDatasetLineMarkerStyle;
01115         }
01116 
01117 
01118     void setLineMarkerSize( QSize size )
01119         {
01120             _lineMarkerSize = size;
01121             emit changed();
01122         }
01123 
01124     QSize lineMarkerSize() const
01125         {
01126             return _lineMarkerSize;
01127         }
01128 
01129     void setLineWidth( int width )
01130         {
01131             _lineWidth = width;
01132             emit changed();
01133         }
01134 
01135     int lineWidth() const
01136         {
01137             return _lineWidth;
01138         }
01139 
01140 
01141     void setLineColor( QColor color = QColor() )
01142         {
01143             _lineColor = color;
01144             emit changed();
01145         }
01146 
01147     QColor lineColor() const
01148         {
01149             return _lineColor;
01150         }
01151 
01152     void setLineStyle( PenStyle style, uint dataset=KDCHART_GLOBAL_LINE_STYLE );
01153 
01154     PenStyle lineStyle( uint dataset=KDCHART_GLOBAL_LINE_STYLE ) const;
01155 
01156 
01157     void setThreeDLines( bool threeD ) {
01158         _threeDLines = threeD;
01159         emit changed();
01160     }
01161 
01162 
01163     bool threeDLines() const {
01164         return _threeDLines;
01165     }
01166 
01167 
01168     void setThreeDLineDepth( int depth ) {
01169         _threeDLineDepth = depth;
01170         emit changed();
01171     }
01172 
01173 
01174     int threeDLineDepth() const {
01175         return _threeDLineDepth;
01176     }
01177 
01178 
01179     // NOTE: documentation of this function is temporary disabled.
01180     // Feature is currently not supported, will be implemented
01181     // by future versions of KDChart
01182     void setThreeDLineXRotation( int degrees ) {
01183         _threeDLineXRotation = degrees;
01184         emit changed();
01185     }
01186 
01187 
01188     // NOTE: documentation of this function is temporary disabled.
01189     // Feature is currently not supported, will be implemented
01190     // by future versions of KDChart
01191     int threeDLineXRotation() const {
01192         return _threeDLineXRotation;
01193     }
01194 
01195 
01196     // NOTE: documentation of this function is temporary disabled.
01197     // Feature is currently not supported, will be implemented
01198     // by future versions of KDChart
01199     void setThreeDLineYRotation( int degrees ) {
01200         _threeDLineYRotation = degrees;
01201         emit changed();
01202     }
01203 
01204 
01205     // NOTE: documentation of this function is temporary disabled.
01206     // Feature is currently not supported, will be implemented
01207     // by future versions of KDChart
01208     int threeDLineYRotation() const {
01209         return _threeDLineYRotation;
01210     }
01211 
01212 public:
01213     enum AreaChartSubType { AreaNormal, AreaStacked, AreaPercent };
01214 
01215 public slots:
01216     void setAreaChartSubType( AreaChartSubType areaChartSubType )
01217         {
01218             _areaChartSubType = areaChartSubType;
01219             // activate default data value text settings for this chart type
01220             if(    printDataValues( 0 )
01221                    && printDataValuesWithDefaultFontParams( 0 ) )
01222                 setPrintDataValues( true, 0 );
01223             emit changed();
01224         }
01225 
01226 
01227     AreaChartSubType areaChartSubType() const
01228         {
01229             return _areaChartSubType;
01230         }
01231 
01232 
01233     static QString areaChartSubTypeToString( AreaChartSubType type );
01234     static AreaChartSubType stringToAreaChartSubType( const QString& string );
01235 
01236 public:
01237     enum AreaLocation { AreaAbove, AreaBelow };
01238 public slots:
01239 
01240     void setAreaLocation( AreaLocation location )
01241         {
01242             _areaLocation = location;
01243             emit changed();
01244         }
01245 
01246     AreaLocation areaLocation() const
01247         {
01248             return _areaLocation;
01249         }
01250 
01251 
01252     static QString areaLocationToString( AreaLocation type );
01253     static AreaLocation stringToAreaLocation( const QString& string );
01254 
01255     // END LINE/AREA CHART-SPECIFIC
01256 
01257 public:
01258     // POLAR CHART-SPECIFIC
01259     enum PolarChartSubType { PolarNormal, PolarStacked, PolarPercent };
01260 
01261 public slots:
01262     void setPolarChartSubType( PolarChartSubType polarChartSubType )
01263         {
01264             _polarChartSubType = polarChartSubType;
01265             emit changed();
01266         }
01267 
01268     PolarChartSubType polarChartSubType() const
01269         {
01270             return _polarChartSubType;
01271         }
01272 
01273 
01274     static PolarChartSubType stringToPolarChartSubType( const QString& string );
01275     static QString polarChartSubTypeToString( PolarChartSubType type );
01276 
01277     void setPolarMarker( bool marker )
01278         {
01279             _polarMarker = marker;
01280             emit changed();
01281         }
01282 
01283     bool polarMarker() const
01284         {
01285             return _polarMarker;
01286         }
01287 
01288 public:
01289     enum PolarMarkerStyle { PolarMarkerCircle  = 0,
01290                             PolarMarkerSquare  = 1,
01291                             PolarMarkerDiamond = 2,
01292                             PolarMarker1Pixel  = 3,
01293                             PolarMarker4Pixels = 4,
01294                             PolarMarkerRing    = 5,
01295                             PolarMarkerCross   = 6 };
01296 
01297 public slots:
01298     void setPolarMarkerStyle( uint dataset, PolarMarkerStyle style );
01299     PolarMarkerStyle polarMarkerStyle( uint dataset ) const;
01300     static QString polarMarkerStyleToString( PolarMarkerStyle style );
01301     static QString polarMarkerStyleToStringTr( PolarMarkerStyle style );
01302     static PolarMarkerStyle stringToPolarMarkerStyle( const QString& string );
01303     static PolarMarkerStyle stringToPolarMarkerStyleTr( const QString& string );
01304 
01305 public:
01306     typedef QMap<uint,PolarMarkerStyle> PolarMarkerStyleMap;
01307 
01308 public slots:
01309     void setPolarMarkerStyles( PolarMarkerStyleMap map );
01310 
01311     PolarMarkerStyleMap polarMarkerStyles() const {
01312         return _polarMarkerStyles;
01313     }
01314 
01315     uint maxDatasetPolarMarkerStyle() const
01316         {
01317             return _maxDatasetPolarMarkerStyle;
01318         }
01319 
01320     void setPolarMarkerSize( QSize size = QSize( -40, -40 ) )
01321         {
01322             _polarMarkerSize = size;
01323             emit changed();
01324         }
01325 
01326     QSize polarMarkerSize() const
01327         {
01328             return _polarMarkerSize;
01329         }
01330 
01331     void setPolarLineWidth( int width = -3 )
01332         {
01333             _polarLineWidth = width;
01334             emit changed();
01335         }
01336 
01337     int polarLineWidth() const
01338         {
01339             return _polarLineWidth;
01340         }
01341 
01342 
01343     void setPolarZeroDegreePos( int degrees )
01344         {
01345             _polarZeroDegreePos = degrees;
01346         }
01347 
01348     int polarZeroDegreePos() const
01349         {
01350             return _polarZeroDegreePos;
01351         }
01352 
01353 
01354     void setPolarRotateCircularLabels( bool rotateCircularLabels )
01355         {
01356             _polarRotateCircularLabels = rotateCircularLabels;
01357         }
01358 
01359     bool polarRotateCircularLabels() const
01360         {
01361             return _polarRotateCircularLabels;
01362         }
01363 
01364 
01365     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
01366     void setPolarDelimsAndLabelsAtPos( KDChartEnums::PositionFlag pos,
01367                                        bool showDelimiters,
01368                                        bool showLabels );
01369 
01370     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
01371     bool polarDelimAtPos( KDChartEnums::PositionFlag pos ) const;
01372 
01373     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
01374     bool polarLabelsAtPos( KDChartEnums::PositionFlag pos ) const;
01375 
01376     // END POLAR CHART-SPECIFIC
01377 
01378 
01379     // PIE/RING CHART-SPECIFIC
01380 
01381     void setExplode( bool explode )
01382         {
01383             _explode = explode;
01384             emit changed();
01385         }
01386 
01387     bool explode() const
01388         {
01389             return _explode;
01390         }
01391 
01392 
01393     void setExplodeValues( QValueList<int> explodeList ) {
01394         _explodeList = explodeList;
01395         emit changed();
01396     }
01397 
01398 
01399     // Unfortunately this is not avaialble from QSA-
01400     QValueList<int> explodeValues() const {
01401         return _explodeList;
01402     }
01403 
01404 public:
01405     typedef QMap<int,double> ExplodeFactorsMap;
01406 
01407 public slots:
01408     void setExplodeFactors( ExplodeFactorsMap factors ) {
01409         _explodeFactors = factors;
01410         emit changed();
01411     }
01412 
01413 
01414     ExplodeFactorsMap explodeFactors() const {
01415         return _explodeFactors;
01416     }
01417 
01418 
01419     void setExplodeFactor( double factor )
01420         {
01421             _explodeFactor = factor;
01422             emit changed();
01423         }
01424 
01425     double explodeFactor() const
01426         {
01427             return _explodeFactor;
01428         }
01429 
01430 
01431     void setThreeDPies( bool threeDPies )
01432         {
01433             _threeDPies = threeDPies;
01434             emit changed();
01435         }
01436 
01437     bool threeDPies() const
01438         {
01439             return _threeDPies;
01440         }
01441 
01442 
01443     void setThreeDPieHeight( int pixels )
01444         {
01445             _threeDPieHeight = pixels;
01446             emit changed();
01447         }
01448 
01449     int threeDPieHeight() const
01450         {
01451             return _threeDPieHeight;
01452         }
01453 
01454     void setPieStart( int degrees )
01455         {
01456             while ( degrees < 0 )
01457                 degrees += 360;
01458             while ( degrees >= 360 )
01459                 degrees -= 360;
01460             _pieStart = degrees;
01461 
01462             emit changed();
01463         }
01464 
01465 
01466     int pieStart() const
01467         {
01468             return _pieStart;
01469         }
01470 
01471     void setRingStart( int degrees )
01472         {
01473             while ( degrees < 0 )
01474                 degrees += 360;
01475             while ( degrees >= 360 )
01476                 degrees -= 360;
01477             _ringStart = degrees;
01478 
01479             emit changed();
01480         }
01481 
01482 
01483     int ringStart() const
01484         {
01485             return _ringStart;
01486         }
01487 
01488     void setRelativeRingThickness( bool relativeThickness ) {
01489         _relativeRingThickness = relativeThickness;
01490 
01491         emit changed();
01492     }
01493 
01494 
01495     bool relativeRingThickness() const {
01496         return _relativeRingThickness;
01497     }
01498 
01499     // END PIE/RING CHART-SPECIFIC
01500 
01501 public:
01502     // HI/LO CHART-SPECIFIC
01503     enum HiLoChartSubType { HiLoNormal, HiLoSimple = HiLoNormal,
01504                             HiLoClose, HiLoOpenClose };
01505 
01506 public slots:
01507     void setHiLoChartSubType( HiLoChartSubType hiLoChartSubType )
01508         {
01509             _hiLoChartSubType = hiLoChartSubType;
01510             emit changed();
01511         }
01512 
01513     HiLoChartSubType hiLoChartSubType() const
01514         {
01515             return _hiLoChartSubType;
01516         }
01517 
01518     static QString hiLoChartSubTypeToString( HiLoChartSubType type );
01519     static HiLoChartSubType stringToHiLoChartSubType( const QString& string );
01520     void setHiLoChartPrintLowValues( bool active,
01521                                      QFont* font = 0,
01522                                      int size = 14,
01523                                      QColor* color = 0 );
01524 
01525     bool hiLoChartPrintLowValues() const
01526         {
01527             return _hiLoChartPrintLowValues;
01528         }
01529 
01530 
01531     QFont hiLoChartLowValuesFont() const
01532         {
01533             return _hiLoChartLowValuesFont;
01534         }
01535 
01536 
01537     bool hiLoChartLowValuesUseFontRelSize() const
01538         {
01539             return _hiLoChartLowValuesUseFontRelSize;
01540         }
01541 
01542 
01543     int hiLoChartLowValuesFontRelSize() const
01544         {
01545             return _hiLoChartLowValuesFontRelSize;
01546         }
01547 
01548 
01549     QColor hiLoChartLowValuesColor() const
01550         {
01551             return _hiLoChartLowValuesColor;
01552         }
01553 
01554     void setHiLoChartPrintHighValues( bool active,
01555                                       QFont* font = 0,
01556                                       int size = 14,
01557                                       QColor* color = 0 );
01558 
01559 
01560     bool hiLoChartPrintHighValues() const
01561         {
01562             return _hiLoChartPrintHighValues;
01563         }
01564 
01565 
01566     QFont hiLoChartHighValuesFont() const
01567         {
01568             return _hiLoChartHighValuesFont;
01569         }
01570 
01571 
01572     bool hiLoChartHighValuesUseFontRelSize() const
01573         {
01574             return _hiLoChartHighValuesUseFontRelSize;
01575         }
01576 
01577 
01578     int hiLoChartHighValuesFontRelSize() const
01579         {
01580             return _hiLoChartHighValuesFontRelSize;
01581         }
01582 
01583 
01584     QColor hiLoChartHighValuesColor() const
01585         {
01586             return _hiLoChartHighValuesColor;
01587         }
01588 
01589     void setHiLoChartPrintOpenValues( bool active,
01590                                       QFont* font = 0,
01591                                       uint size = 14,
01592                                       QColor* color = 0 );
01593 
01594     bool hiLoChartPrintOpenValues() const
01595         {
01596             return _hiLoChartPrintOpenValues;
01597         }
01598 
01599 
01600     QFont hiLoChartOpenValuesFont() const
01601         {
01602             return _hiLoChartOpenValuesFont;
01603         }
01604 
01605 
01606     bool hiLoChartOpenValuesUseFontRelSize() const
01607         {
01608             return _hiLoChartOpenValuesUseFontRelSize;
01609         }
01610 
01611 
01612     int hiLoChartOpenValuesFontRelSize() const
01613         {
01614             return _hiLoChartOpenValuesFontRelSize;
01615         }
01616 
01617 
01618     QColor hiLoChartOpenValuesColor() const
01619         {
01620             return _hiLoChartOpenValuesColor;
01621         }
01622 
01623     void setHiLoChartPrintCloseValues( bool active,
01624                                        QFont* font = 0,
01625                                        int size = 14,
01626                                        QColor* color = 0 );
01627 
01628     bool hiLoChartPrintCloseValues() const
01629         {
01630             return _hiLoChartPrintCloseValues;
01631         }
01632 
01633 
01634     QFont hiLoChartCloseValuesFont() const
01635         {
01636             return _hiLoChartCloseValuesFont;
01637         }
01638 
01639 
01640     bool hiLoChartCloseValuesUseFontRelSize() const
01641         {
01642             return _hiLoChartCloseValuesUseFontRelSize;
01643         }
01644 
01645 
01646     int hiLoChartCloseValuesFontRelSize() const
01647         {
01648             return _hiLoChartCloseValuesFontRelSize;
01649         }
01650 
01651 
01652     QColor hiLoChartCloseValuesColor() const
01653         {
01654             return _hiLoChartCloseValuesColor;
01655         }
01656 
01657 
01658     void setHiLoChartPrintFirstValues( bool active,
01659                                        QFont* font = 0,
01660                                        uint size = 14,
01661                                        QColor* color = 0 )
01662         {
01663             setHiLoChartPrintOpenValues( active, font, size, color );
01664         }
01665 
01666     bool hiLoChartPrintFirstValues() const
01667         {
01668             return hiLoChartPrintOpenValues();
01669         }
01670 
01671 
01672     QFont hiLoChartFirstValuesFont() const
01673         {
01674             return hiLoChartOpenValuesFont();
01675         }
01676 
01677 
01678     bool hiLoChartFirstValuesUseFontRelSize() const
01679         {
01680             return hiLoChartOpenValuesUseFontRelSize();
01681         }
01682 
01683     int hiLoChartFirstValuesFontRelSize() const
01684         {
01685             return hiLoChartOpenValuesFontRelSize();
01686         }
01687 
01688     QColor hiLoChartFirstValuesColor() const
01689         {
01690             return hiLoChartOpenValuesColor();
01691         }
01692 
01693     void setHiLoChartPrintLastValues( bool active,
01694                                       QFont* font = 0,
01695                                       int size = 14,
01696                                       QColor* color = 0 )
01697         {
01698             setHiLoChartPrintCloseValues( active, font, size, color );
01699         }
01700 
01701     bool hiLoChartPrintLastValues() const
01702         {
01703             return hiLoChartPrintCloseValues();
01704         }
01705 
01706     QFont hiLoChartLastValuesFont() const
01707         {
01708             return hiLoChartCloseValuesFont();
01709         }
01710 
01711     bool hiLoChartLastValuesUseFontRelSize() const
01712         {
01713             return hiLoChartCloseValuesUseFontRelSize();
01714         }
01715 
01716     int hiLoChartLastValuesFontRelSize() const
01717         {
01718             return hiLoChartCloseValuesFontRelSize();
01719         }
01720 
01721     QColor hiLoChartLastValuesColor() const
01722         {
01723             return hiLoChartCloseValuesColor();
01724         }
01725 
01726 
01727     // END HI/LO CHART-SPECIFIC
01728 
01729 
01730 public:
01731     // BOX WHISKER CHART-SPECIFIC
01732     enum BWChartSubType { BWNormal, BWSimple = BWNormal };
01733 
01734     enum BWStatVal {                  BWStatValSTART,
01735                                       UpperOuterFence = BWStatValSTART,  // first value stored in array
01736                                       UpperInnerFence,
01737                                       Quartile3,
01738                                       Median,
01739                                       Quartile1,
01740                                       LowerInnerFence,
01741                                       LowerOuterFence,
01742                                       MaxValue,
01743                                       MeanValue,
01744                                       MinValue,
01745                                       BWStatValEND = MinValue,          // last value stored in array
01746                                       //  extra values - not stored in the array:
01747                                       BWStatValOffEndValue,  // the number of array values
01748                                       BWStatValALL,          // special flag reprsenting *all* array values
01749                                       BWStatValUNKNOWN };    // to be returned when value is undefined
01750 public slots:
01751 
01752     void setBWChartSubType( BWChartSubType bWChartSubType )
01753         {
01754             _BWChartSubType = bWChartSubType;
01755             emit changed();
01756         }
01757 
01758     BWChartSubType bWChartSubType() const
01759         {
01760             return _BWChartSubType;
01761         }
01762 
01763     static QString bWChartSubTypeToString( BWChartSubType type );
01764     static BWChartSubType stringToBWChartSubType( const QString& string );
01765     static QString bWChartStatValToString( BWStatVal type );
01766     static BWStatVal stringToBWChartStatVal( const QString& string );
01767 
01768     void setBWChartFences( double upperInner, double lowerInner,
01769                            double upperOuter, double lowerOuter );
01770     void bWChartFences( double& upperInner, double& lowerInner,
01771                         double& upperOuter, double& lowerOuter ) const;
01772 
01773     void setBWChartBrush( const QBrush& bWChartBrush )
01774         {
01775             _BWChartBrush = bWChartBrush;
01776             emit changed();
01777         }
01778 
01779     QBrush bWChartBrush() const
01780         {
01781             return _BWChartBrush;
01782         }
01783 
01784     void setBWChartOutValMarkerSize( int size )
01785         {
01786             _BWChartOutValMarkerSize = size;
01787         }
01788 
01789 
01790     int bWChartOutValMarkerSize() const
01791         {
01792             return _BWChartOutValMarkerSize;
01793         }
01794 
01795     void setBWChartPrintStatistics( BWStatVal statValue,
01796                                     bool active,
01797                                     QFont* font = 0,
01798                                     int size = 24,
01799                                     QColor* color = 0,
01800                                     QBrush* brush = 0 );
01801 
01802     bool bWChartPrintStatistics( BWStatVal statValue ) const
01803         {
01804             return _BWChartStatistics[ statValue ].active;
01805         }
01806 
01807 
01808     QFont bWChartStatisticsFont( BWStatVal statValue ) const
01809         {
01810             return _BWChartStatistics[ statValue ].font;
01811         }
01812 
01813 
01814     bool bWChartStatisticsUseRelSize( BWStatVal statValue ) const
01815         {
01816             return _BWChartStatistics[ statValue ].useRelSize;
01817         }
01818 
01819 
01820     int bWChartStatisticsFontRelSize( BWStatVal statValue ) const
01821         {
01822             return _BWChartStatistics[ statValue ].relSize;
01823         }
01824 
01825 
01826     QColor bWChartStatisticsColor( BWStatVal statValue ) const
01827         {
01828             return _BWChartStatistics[ statValue ].color;
01829         }
01830 
01831     QBrush bWChartStatisticsBrush( BWStatVal statValue ) const
01832         {
01833             return _BWChartStatistics[ statValue ].brush;
01834         }
01835 
01836 
01837 public:
01838     // LEGENDS
01839 
01840     enum LegendPosition { NoLegend, LegendTop, LegendBottom,
01841                           LegendLeft, LegendRight,
01842                           LegendTopLeft,
01843                           LegendTopLeftTop,
01844                           LegendTopLeftLeft,
01845                           LegendTopRight,
01846                           LegendTopRightTop,
01847                           LegendTopRightRight,
01848                           LegendBottomLeft,
01849                           LegendBottomLeftBottom,
01850                           LegendBottomLeftLeft,
01851                           LegendBottomRight,
01852                           LegendBottomRightBottom,
01853                           LegendBottomRightRight
01854     };
01855 
01856 public slots:
01857     void setLegendPosition( LegendPosition position )
01858         {
01859             _legendPosition = position;
01860             emit changed();
01861         }
01862 
01863     LegendPosition legendPosition() const
01864         {
01865             return _legendPosition;
01866         }
01867 
01868     void setLegendOrientation( Orientation orientation )
01869         {
01870             _legendOrientation = orientation;
01871             emit changed();
01872         }
01873 
01874     Orientation legendOrientation() const
01875         {
01876             return _legendOrientation;
01877         }
01878 
01879 
01880     void setLegendShowLines( bool legendShowLines )
01881         {
01882             _legendShowLines = legendShowLines;
01883             emit changed();
01884         }
01885 
01886     bool legendShowLines() const
01887         {
01888             return _legendShowLines;
01889         }
01890 
01891 
01892     static QString legendPositionToString( LegendPosition pos );
01893     static LegendPosition stringToLegendPosition( const QString& string );
01894 
01895 public:
01896     enum LegendSource { LegendManual, LegendFirstColumn, LegendAutomatic };
01897 
01898 public slots:
01899     void setLegendSource( LegendSource source )
01900         {
01901             _legendSource = source;
01902             emit changed();
01903         }
01904 
01905     LegendSource legendSource() const
01906         {
01907             return _legendSource;
01908         }
01909 
01910     static QString legendSourceToString( LegendSource source );
01911     static LegendSource stringToLegendSource( const QString& string );
01912 
01913     void setLegendText( uint dataset, const QString& text )
01914         {
01915             _legendText[ dataset ] = text;
01916             emit changed();
01917         }
01918 
01919     QString legendText( uint dataset ) const
01920         {
01921             if( _legendText.find( dataset ) != _legendText.end() )
01922                 return _legendText[ dataset ];
01923             else
01924                 return QString::null;
01925         }
01926 
01927 
01928     void setLegendTextColor( const QColor& color )
01929         {
01930             _legendTextColor = color;
01931             emit changed();
01932         }
01933 
01934 
01935     QColor legendTextColor() const
01936         {
01937             return _legendTextColor;
01938         }
01939 
01940 
01941     void setLegendFont( const QFont& font, bool useFontSize )
01942         {
01943             _legendFont = font;
01944             _legendFontUseRelSize = ! useFontSize;
01945             emit changed();
01946         }
01947 
01948     QFont legendFont() const
01949         {
01950             return _legendFont;
01951         }
01952 
01953 
01954     void setLegendFontUseRelSize( bool legendFontUseRelSize )
01955         {
01956             _legendFontUseRelSize = legendFontUseRelSize;
01957             emit changed();
01958         }
01959 
01960     bool legendFontUseRelSize() const
01961         {
01962             return _legendFontUseRelSize;
01963         }
01964 
01965     void setLegendFontRelSize( int legendFontRelSize )
01966         {
01967             _legendFontRelSize = legendFontRelSize;
01968             emit changed();
01969         }
01970 
01971     int legendFontRelSize() const
01972         {
01973             return _legendFontRelSize;
01974         }
01975 
01976 
01977     void setLegendTitleText( const QString& text )
01978         {
01979             _legendTitleText = text;
01980             emit changed();
01981         }
01982 
01983 
01984     QString legendTitleText() const
01985         {
01986             return _legendTitleText;
01987         }
01988 
01989 
01990     void setLegendTitleTextColor( const QColor& color )
01991         {
01992             _legendTitleTextColor = color;
01993             emit changed();
01994         }
01995 
01996 
01997     QColor legendTitleTextColor() const
01998         {
01999             return _legendTitleTextColor;
02000         }
02001 
02002 
02003 
02004     void setLegendTitleFont( const QFont& font, bool useFontSize )
02005         {
02006             _legendTitleFont = font;
02007             _legendTitleFontUseRelSize = ! useFontSize;
02008             emit changed();
02009         }
02010 
02011     QFont legendTitleFont() const
02012         {
02013             return _legendTitleFont;
02014         }
02015 
02016 
02017     void setLegendTitleFontUseRelSize( bool legendTitleFontUseRelSize )
02018         {
02019             _legendTitleFontUseRelSize = legendTitleFontUseRelSize;
02020             emit changed();
02021         }
02022 
02023     bool legendTitleFontUseRelSize() const
02024         {
02025             return _legendTitleFontUseRelSize;
02026         }
02027 
02028     void setLegendTitleFontRelSize( int legendTitleFontRelSize )
02029         {
02030             _legendTitleFontRelSize = legendTitleFontRelSize;
02031             emit changed();
02032         }
02033 
02034     int legendTitleFontRelSize() const
02035         {
02036             return _legendTitleFontRelSize;
02037         }
02038 
02039 
02040     void setLegendSpacing( uint space )
02041         {
02042             _legendSpacing = space;
02043         }
02044 
02045 
02046     uint legendSpacing() const
02047         {
02048             return _legendSpacing;
02049         }
02050 
02051     // END LEGENDS
02052 
02053 
02054 
02055     // AXES
02056 
02057     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
02058     void setAxisType( uint n, const KDChartAxisParams::AxisType axisType )
02059         {
02060             if ( n < KDCHART_MAX_AXES ) {
02061                 _axisSettings[ n ].params.setAxisType( axisType );
02062                 emit changed();
02063             }
02064         }
02065 
02066     void setAxisVisible( uint n,
02067                          const bool axisVisible )
02068         {
02069             if ( n < KDCHART_MAX_AXES ) {
02070                 _axisSettings[ n ].params.setAxisVisible( axisVisible );
02071                 emit changed();
02072             }
02073         }
02074 
02075     bool axisVisible( uint n ) const
02076         {
02077             return n < KDCHART_MAX_AXES ? _axisSettings[ n ].params.axisVisible()
02078                 : false;
02079         }
02080 
02081     void setAxisShowGrid( uint n,
02082                           bool axisShowGrid );
02083     bool showGrid() const;
02084     void setAxisDatasets( uint n,
02085                           uint dataset,
02086                           uint dataset2 = KDCHART_NO_DATASET,
02087                           uint chart = 0 );
02088     bool axisDatasets( uint n,
02089                        uint& dataset,
02090                        uint& dataset2,
02091                        uint& chart ) const;
02092 
02093 public:
02094 #if COMPAT_QT_VERSION >= 0x030000
02095     typedef QValueVector<uint> AxesArray;
02096 #else
02097     typedef QArray<uint> AxesArray;
02098 #endif
02099 
02100 public slots:
02101     bool chartAxes( uint chart, uint& cnt, AxesArray& axes ) const;
02102 
02103     void setAxisArea( const uint n, const QRect& areaRect )
02104         {
02105             if ( n < KDCHART_MAX_AXES ) {
02106                 _axisSettings[ n ].params.setAxisTrueAreaRect( areaRect );
02107                 // Do not do emit changed() here!
02108             }
02109         }
02110 
02111     void setAxisLabelsTouchEdges( uint n, bool axisLabelsTouchEdges )
02112         {
02113             _axisSettings[ n ].params.setAxisLabelsTouchEdges(
02114                 axisLabelsTouchEdges );
02115             emit changed();
02116         }
02117 
02118     void setAxisLabelsVisible( uint n,
02119                                bool axisLabelsVisible )
02120         {
02121             if ( n < KDCHART_MAX_AXES )
02122                 _axisSettings[ n ].params.setAxisLabelsVisible( axisLabelsVisible );
02123         }
02124 
02125     void setAxisLabelsFont( uint n,
02126                             QFont axisLabelsFont,
02127                             int axisLabelsFontSize = 0,
02128                             QColor axisLabelsColor = Qt::black );
02129 
02130     // Note if you change the parameters here, then you must also change them in wrappers/KDChartParametersWrapper.h
02131     void setAxisLabelTextParams( uint n,
02132                                  bool axisSteadyValueCalc   = true,
02133                                  QVariant axisValueStart = KDCHART_AXIS_LABELS_AUTO_LIMIT,
02134                                  QVariant axisValueEnd   = KDCHART_AXIS_LABELS_AUTO_LIMIT,
02135                                  double axisValueDelta      = KDCHART_AXIS_LABELS_AUTO_DELTA,
02136                                  int axisDigitsBehindComma  = KDCHART_AXIS_LABELS_AUTO_DIGITS,
02137                                  int axisMaxEmptyInnerSpan  = 67,
02138                                  KDChartAxisParams::LabelsFromDataRow takeLabelsFromDataRow
02139                                  = KDChartAxisParams::LabelsFromDataRowNo,
02140                                  int labelTextsDataRow      = 0,
02141                                  QStringList* axisLabelStringList = 0,
02142                                  QStringList* axisShortLabelsStringList = 0,
02143                                  int axisValueLeaveOut      = KDCHART_AXIS_LABELS_AUTO_LEAVEOUT,
02144                                  KDChartAxisParams::ValueScale axisValueDeltaScale = KDChartAxisParams::ValueScaleNumerical )
02145         {
02146             _axisSettings[ n ].params.setAxisValues(
02147                 axisSteadyValueCalc,
02148                 axisValueStart,
02149                 axisValueEnd,
02150                 axisValueDelta,
02151                 axisDigitsBehindComma,
02152                 axisMaxEmptyInnerSpan,
02153                 takeLabelsFromDataRow,
02154                 labelTextsDataRow,
02155                 axisLabelStringList,
02156                 axisShortLabelsStringList,
02157                 axisValueLeaveOut,
02158                 axisValueDeltaScale );
02159             emit changed();
02160         }
02161 
02162 
02163     void setAxisLabelStringParams( uint n,
02164                                    QStringList* axisLabelStringList,
02165                                    QStringList* axisShortLabelStringList,
02166                                    const QString& valueStart = QString::null,
02167                                    const QString& valueEnd   = QString::null );
02168 
02169 
02170     void setAxisParams( uint n,
02171                         const KDChartAxisParams& axisParams );
02172 
02173     const KDChartAxisParams& axisParams( uint n ) const
02174         {
02175             return n < KDCHART_MAX_AXES ? _axisSettings[ n ].params
02176                 : _axisSettings[ KDCHART_MAX_AXES ].params;
02177         }
02178 
02179     // some convenience functions refering to the first KDChartCustomBox
02180     // that is anchored to the axis n.
02181     bool findFirstAxisCustomBoxID(   uint n, uint& boxID ) const;
02182     void setAxisTitle(               uint n, const QString& axisTitle );
02183     
02184     QString axisTitle(               uint n ) const;
02185     void setAxisTitleColor(          uint n, QColor axisTitleColor );
02186     QColor axisTitleColor(           uint n ) const;
02187     void setAxisTitleFont(           uint n, QFont axisTitleFont );
02188     void setAxisTitleFont(           uint n, QFont axisTitleFont, bool useFixedFontSize );
02189     QFont axisTitleFont(             uint n ) const;
02190     void setAxisTitleFontUseRelSize( uint n, bool useRelSize );
02191     bool axisTitleFontUseRelSize(    uint n ) const;
02192     void setAxisTitleFontRelSize(    uint n, int axisTitleFontRelSize );
02193     int axisTitleFontRelSize(        uint n ) const;
02194 
02195     QRect axisArea( const uint n ) const
02196         {
02197             if ( n < KDCHART_MAX_AXES ) {
02198                 return _axisSettings[ n ].params.axisTrueAreaRect();
02199                 // Do not do emit changed() here!
02200             }else{
02201                 return QRect(QPoint(0,0),QSize(0,0));
02202             }
02203         }
02204     // END AXES
02205 
02206 
02207 
02208     QRect dataArea()   const { return _dataAreaRect; }
02209     QRect legendArea() const { return _legendAreaRect; }
02210 
02211 
02212 
02213     // HEADERS/FOOTERS
02214 
02215 public:
02216 
02217     /*
02218       READ before changing/enhancing the following enum
02219       =================================================
02220 
02221       Please note: The following enum is made in a way that
02222       sections with smaller Y values come first.
02223       Thus one can construct a loop itterating over theHdFtPos values
02224       and so going from the top of the screen toiwards the bottom...
02225 
02226       Also please note that extending this enum shound NOT break the
02227       tripple groups (numbers 0/1/2, 3/4/5, and 6/7/8) since the
02228       algorithms in
02229       KDChartPainter::setupGeometry() and
02230       KDChartPainter::paintHeaderFooter() rely on this schema.
02231       Also don't forget to always update the auxiliary values
02232       HdFtPosSTART, HdFtPosHeadersSTART,
02233       HdFtPosHeadersEND, HdFtPosFootersSTART,
02234       HdFtPosFootersEND, and HdFtPosEND muessen - these are used
02235       fpr other itarators...
02236     */
02237     enum HdFtPos{ // start of all sections
02238         HdFtPosSTART = 0,
02239 
02240         // headers:
02241         HdFtPosHeadersSTART  = 0,
02242         // top-most headers
02243         HdFtPosHeaders0START = 0,
02244         HdFtPosHeader0       = 0,
02245         HdFtPosHeader0L = 1,
02246         HdFtPosHeader0R      = 2,
02247         HdFtPosHeaders0END   = 2,
02248         // normal ( == middle ) headers
02249         HdFtPosHeaders1START = 3,
02250         HdFtPosHeader        = 3,        // center
02251         HdFtPosHeaderL = 4,              // left
02252         HdFtPosHeaderR       = 5,        // right
02253         HdFtPosHeaders1END   = 5,
02254         // bottom headers
02255         HdFtPosHeaders2START = 6,
02256         HdFtPosHeader2       = 6,
02257         HdFtPosHeader2L = 7,
02258         HdFtPosHeader2R      = 8,
02259         HdFtPosHeaders2END   = 8,
02260 
02261         HdFtPosHeadersEND = 8,
02262 
02263         // footers:
02264         HdFtPosFootersSTART = 9,
02265         // normal ( == middle ) footers
02266         HdFtPosFooters1START =  9,
02267         HdFtPosFooter        =  9,
02268         HdFtPosFooterL = 10,
02269         HdFtPosFooterR       = 11,
02270         HdFtPosFooters1END   = 11,
02271         // bottom footers
02272         HdFtPosFooters2START = 12,
02273         HdFtPosFooter2       = 12,
02274         HdFtPosFooter2L = 13,
02275         HdFtPosFooter2R      = 14,
02276         HdFtPosFooters2END   = 14,
02277         // top-most footers
02278         HdFtPosFooters0START = 15,
02279         HdFtPosFooter0       = 15,
02280         HdFtPosFooter0L = 16,
02281         HdFtPosFooter0R      = 17,
02282         HdFtPosFooters0END   = 17,
02283 
02284         HdFtPosFootersEND = 17,
02285 
02286         HdFtPosEND = 17 };
02287 
02288 public slots:
02289 
02290     void setHeaderFooterText( uint pos, const QString& text );
02291     QString headerFooterText( uint pos ) const;
02292     const QRect& headerFooterRect( uint pos ) const;
02293     void setHeaderFooterColor( uint pos, const QColor color );
02294     QColor headerFooterColor( uint pos ) const;
02295     void setHeaderFooterFont( uint pos, const QFont& font,
02296                               bool fontUseRelSize,
02297                               int fontRelSize );
02298     QFont headerFooterFont( uint pos ) const;
02299     bool headerFooterFontUseRelSize( uint pos ) const;
02300     int headerFooterFontRelSize( uint pos ) const;
02301 
02302 
02303     // quick&dirty functions: access Header, Header2 and Footer
02304     //                        without having to specify the HdFtPos
02305     //
02306     // This may be convenient for specifying simple charts with
02307     // up to two centered header(s) and up to one centered footer.
02308 
02309 
02310     void setHeader1Text( const QString& text )
02311         {
02312             _hdFtParams[ HdFtPosHeader ]._text = text;
02313             emit changed();
02314         }
02315 
02316 
02317     QString header1Text() const
02318         {
02319             return _hdFtParams[ HdFtPosHeader ]._text;
02320         }
02321 
02322     void setHeader1Font( const QFont& font )
02323         {
02324             _hdFtParams[ HdFtPosHeader ]._font = font;
02325             emit changed();
02326         }
02327 
02328 
02329     QFont header1Font() const
02330         {
02331             return _hdFtParams[ HdFtPosHeader ]._font;
02332         }
02333 
02334     void setHeader2Text( const QString& text )
02335         {
02336             _hdFtParams[ HdFtPosHeader2 ]._text = text;
02337             emit changed();
02338         }
02339 
02340 
02341     QString header2Text() const
02342         {
02343             return _hdFtParams[ HdFtPosHeader2 ]._text;
02344         }
02345 
02346     void setHeader2Font( const QFont& font )
02347         {
02348             _hdFtParams[ HdFtPosHeader2 ]._font = font;
02349             emit changed();
02350         }
02351 
02352 
02353     QFont header2Font() const
02354         {
02355             return _hdFtParams[ HdFtPosHeader2 ]._font;
02356         }
02357 
02358 
02359 
02360     void setFooterText( const QString& text )
02361         {
02362             _hdFtParams[ HdFtPosFooter ]._text = text;
02363             emit changed();
02364         }
02365 
02366 
02367     QString footerText() const
02368         {
02369             return _hdFtParams[ HdFtPosFooter ]._text;
02370         }
02371 
02372     void setFooterFont( const QFont& font )
02373         {
02374             _hdFtParams[ HdFtPosFooter ]._font = font;
02375             emit changed();
02376         }
02377 
02378 
02379     QFont footerFont() const
02380         {
02381             return _hdFtParams[ HdFtPosFooter ]._font;
02382         }
02383 
02384 
02388     void __internalStoreHdFtRect( int pos, QRect rect )
02389         {
02390             if ( 0 <= pos && HdFtPosEND >= pos )
02391                 _hdFtParams[ pos ].setRect( rect );
02392         }
02393 
02394 
02395     // END HEADERS/FOOTERS
02396 
02397 
02398 
02399 public:
02400     KDChartParams();
02401     virtual ~KDChartParams();
02402 
02403 public slots:
02404     void loadAxesFormXML(int& curAxisSettings, QDomElement& element);
02405     bool loadXML( const QDomDocument& doc );
02406 
02407     void saveAxesToXML(QDomDocument& doc, QDomElement& docRoot) const;
02408     QDomDocument saveXML( bool withPI = true ) const;
02409 
02410 public:
02411     friend QTextStream& operator<<( QTextStream& s, const KDChartParams& p );
02412     friend QTextStream& operator>>( QTextStream& s, KDChartParams& p );
02413 
02414 public slots:
02415     static void createChartValueNode( QDomDocument& doc, QDomNode& parent,
02416                                       const QString& elementName,
02417                                       const QVariant& valY,
02418                                       const QVariant& valX,
02419                                       const int& propID  );
02420     static void createColorMapNode( QDomDocument& doc, QDomNode& parent,
02421                                     const QString& elementName,
02422                                     const QMap< uint, QColor >& map );
02423     static void createDoubleMapNode( QDomDocument& doc, QDomNode& parent,
02424                                      const QString& elementName,
02425                                      const QMap< int, double >& map );
02426     static void createChartFontNode( QDomDocument& doc, QDomNode& parent,
02427                                      const QString& elementName,
02428                                      const QFont& font, bool useRelFont,
02429                                      int relFont,
02430                                      int minFont=-1 );
02431     static bool readColorMapNode( const QDomElement& element,
02432                                   QMap<uint,QColor>* map );
02433     static bool readDoubleMapNode( const QDomElement& element,
02434                                    QMap<int,double>* map );
02435     static bool readChartFontNode( const QDomElement& element, QFont& font,
02436                                    bool& useRelFont, int& relFontSize,
02437                                    int* minFontSize=0 );
02438     static bool readChartValueNode( const QDomElement& element,
02439                                     QVariant& valY,
02440                                     QVariant& valX,
02441                                     int& propID );
02442 
02443 
02444     // do *not* call this function manually: it is used by KDChartPainter::setupGeometry()
02445     void setDataArea( const QRect& areaRect )
02446         {
02447             _dataAreaRect = areaRect;
02448             // Do not do emit changed() here!
02449         }
02450     // do *not* call this function manually: it is used by KDChartPainter::setupGeometry()
02451     void setLegendArea( const QRect& areaRect )
02452         {
02453             _legendAreaRect = areaRect;
02454             // Do not do emit changed() here!
02455         }
02456 
02457 
02458 signals:
02459     void changed();
02460 
02461 
02462 protected:
02463     void setBarsDisplayed( int barsDisplayed )
02464         {
02465             _barsDisplayed = barsDisplayed;
02466         }
02467     void setBarsLeft( int barsLeft )
02468         {
02469             _barsLeft = barsLeft;
02470         }
02471 
02472 
02473 private:
02474     QString dataRegionFrameAreaName( uint dataRow,
02475                              uint dataCol,
02476                              uint data3rd );
02477     void recomputeShadowColors();
02478     void insertDefaultAxisTitleBox( uint n,
02479                                     bool setTitle,       const QString& axisTitle,
02480                                     bool setColor,       const QColor& axisTitleColor,
02481                                     bool setFont,        const QFont& axisTitleFont,
02482                                     bool setFontUseRel,  bool useFontSize,
02483                                     bool setFontRelSize, int axisTitleFontRelSize );
02484 
02485     static QColor _internalPointer_DataValueAutoColor;
02486 
02487     KDChartPropertySet* tempPropSetA;
02488     KDChartPropertySet* tempPropSetB;
02489 
02490     bool _optimizeOutputForScreen;
02491     int _globalLeadingLeft;
02492     int _globalLeadingTop;
02493     int _globalLeadingRight;
02494     int _globalLeadingBottom;
02495     ChartType _chartType;
02496     ChartType _additionalChartType;
02497     int _numValues;
02498     QFont _defaultFont;
02499 
02500     typedef QDict < KDChartFrameSettings > AreaDict;
02501     AreaDict _areaDict;
02502 
02503     CustomBoxDict _customBoxDict;
02504     bool _customBoxDictMayContainHoles;
02505     QRect _noRect;
02506     KDFrame _noFrame;
02507 
02508     KDChartFrameSettings _noFrameSettings;
02509 
02510     class ModeAndChart
02511     {
02512     public:
02513         ModeAndChart()
02514             : _mode( UnknownMode ), _chart( KDCHART_NO_CHART )
02515             {}
02516         ModeAndChart( SourceMode mode, uint chart )
02517             : _mode( mode ), _chart( chart )
02518             {}
02519 
02520         SourceMode mode() const
02521             {
02522                 return _mode;
02523             };
02524         uint chart() const
02525             {
02526                 return _chart;
02527             };
02528 
02529         void setMode( SourceMode mode )
02530             {
02531                 _mode = mode;
02532             };
02533         void setChart( uint chart )
02534             {
02535                 _chart = chart;
02536             };
02537     private:
02538         SourceMode _mode;
02539         uint _chart;
02540     };
02541 
02542     typedef QMap < uint, ModeAndChart > ModeAndChartMap;
02543     ModeAndChartMap _dataSourceModeAndChart;
02544     bool _setChartSourceModeWasUsed;
02545     QMap < uint, QColor > _dataColors;
02546     uint _maxDatasetSourceMode;
02547     KDChartPropertySetList _propertySetList;
02548     double _shadowBrightnessFactor;
02549     Qt::BrushStyle _shadowPattern;
02550     bool _threeDShadowColors;
02551     uint _maxDatasetColor;
02552     QMap < uint, QColor > _dataColorsShadow1;
02553     QMap < uint, QColor > _dataColorsShadow2;
02554     QColor _outlineDataColor;
02555     uint _outlineDataLineWidth;
02556     PenStyle _outlineDataLineStyle;
02557 
02558 
02559     struct PrintDataValuesSettings {
02560         bool _printDataValues;
02561         int _divPow10;
02562         int _digitsBehindComma;
02563         QFont _dataValuesFont;
02564         bool _dataValuesUseFontRelSize;
02565         int _dataValuesFontRelSize;
02566         QColor _dataValuesColor;
02567         QBrush _dataValuesBrush;
02568         bool _dataValuesAutoColor;
02569         KDChartEnums::PositionFlag _dataValuesAnchorNegativePosition;
02570         uint _dataValuesAnchorNegativeAlign;
02571         int _dataValuesAnchorNegativeDeltaX;
02572         int _dataValuesAnchorNegativeDeltaY;
02573         int _dataValuesNegativeRotation;
02574         KDChartEnums::PositionFlag _dataValuesAnchorPositivePosition;
02575         uint _dataValuesAnchorPositiveAlign;
02576         int _dataValuesAnchorPositiveDeltaX;
02577         int _dataValuesAnchorPositiveDeltaY;
02578         int _dataValuesPositiveRotation;
02579         KDChartEnums::TextLayoutPolicy _dataValuesLayoutPolicy;
02580         bool _dataValuesShowInfinite;
02581 
02582         bool _useDefaultFontParams;  // internal flag, do NOT store it!
02583     };
02584     PrintDataValuesSettings _printDataValuesSettings;
02585     PrintDataValuesSettings _printDataValuesSettings2;
02586 
02587     bool _allowOverlappingDataValueTexts;
02588     BarChartSubType _barChartSubType;
02589     bool _threeDBars;
02590     int _threeDBarAngle;
02591     double _threeDBarDepth;
02592     double _cosThreeDBarAngle;
02593     int _datasetGap;
02594     bool _datasetGapIsRelative;
02595     int _valueBlockGap;
02596     bool _valueBlockGapIsRelative;
02597     int _barWidth;
02598     int _userWidth;
02599     bool _solidExcessArrows;
02600     // volatile bar chart information, not saved in the stream
02601     QRect _dataAreaRect;
02602     QRect _legendAreaRect;
02603     int _barsDisplayed;
02604     int _barsLeft;
02605 
02606     // LINES/AREAS-specific
02607     LineChartSubType _lineChartSubType;
02608     bool _threeDLines;
02609     int _threeDLineDepth;
02610     int _threeDLineXRotation;
02611     int _threeDLineYRotation;
02612     bool _lineMarker;
02613     LineMarkerStyleMap _lineMarkerStyles;
02614     uint _maxDatasetLineMarkerStyle;
02615     QSize _lineMarkerSize;
02616     QColor _lineColor;
02617     int _lineWidth;
02618     PenStyle _lineStyle;
02619     typedef QMap<uint, PenStyle> LineStyleMap;
02620     LineStyleMap _datasetLineStyles;
02621     AreaChartSubType _areaChartSubType;
02622     AreaLocation _areaLocation;
02623 
02624 
02625     // POLAR-specific
02626     PolarChartSubType _polarChartSubType;
02627     bool _polarMarker;
02628     PolarMarkerStyleMap _polarMarkerStyles;
02629     uint _maxDatasetPolarMarkerStyle;
02630     QSize _polarMarkerSize;
02631     int _polarLineWidth;
02632     int _polarZeroDegreePos;
02633     bool _polarRotateCircularLabels;
02634     struct _polarDelimsAndLabelStruct {
02635         bool showDelimiters;
02636         bool showLabels;
02637     };
02638     _polarDelimsAndLabelStruct _polarDelimsAndLabels[ 1 + KDCHART_MAX_POLAR_DELIMS_AND_LABELS_POS ];
02639 
02640 
02641 
02642     // PIES/RINGS
02643     bool _explode;
02644     double _explodeFactor;
02645     ExplodeFactorsMap _explodeFactors;
02646     QValueList<int> _explodeList;
02647     bool _threeDPies;
02648     int _threeDPieHeight;
02649     int _pieStart;
02650     int _ringStart;
02651     bool _relativeRingThickness;
02652 
02653 
02654     // HI-LO CHARTS
02655 
02656     HiLoChartSubType _hiLoChartSubType;
02657     bool _hiLoChartPrintLowValues;
02658     QFont _hiLoChartLowValuesFont;
02659     bool _hiLoChartLowValuesUseFontRelSize;
02660     int _hiLoChartLowValuesFontRelSize;
02661     QColor _hiLoChartLowValuesColor;
02662     bool _hiLoChartPrintHighValues;
02663     QFont _hiLoChartHighValuesFont;
02664     bool _hiLoChartHighValuesUseFontRelSize;
02665     int _hiLoChartHighValuesFontRelSize;
02666     QColor _hiLoChartHighValuesColor;
02667     bool _hiLoChartPrintOpenValues;
02668     QFont _hiLoChartOpenValuesFont;
02669     bool _hiLoChartOpenValuesUseFontRelSize;
02670     int _hiLoChartOpenValuesFontRelSize;
02671     QColor _hiLoChartOpenValuesColor;
02672     bool _hiLoChartPrintCloseValues;
02673     QFont _hiLoChartCloseValuesFont;
02674     bool _hiLoChartCloseValuesUseFontRelSize;
02675     int _hiLoChartCloseValuesFontRelSize;
02676     QColor _hiLoChartCloseValuesColor;
02677 
02678 
02679 
02680     // BOX AND WHISKER CHARTS
02681 
02682     BWChartSubType _BWChartSubType;
02683 
02684     struct BWChartStatistics {
02685         double value;
02686         int    y;
02687         bool   active;
02688         QFont  font;
02689         bool   useRelSize;
02690         int    relSize;
02691         QColor color;
02692         QBrush brush;
02693     };
02694     BWChartStatistics _BWChartStatistics[ BWStatValOffEndValue ];
02695     double _BWChartFenceUpperInner;
02696     double _BWChartFenceLowerInner;
02697     double _BWChartFenceUpperOuter;
02698     double _BWChartFenceLowerOuter;
02699     int _BWChartOutValMarkerSize;
02700     QBrush _BWChartBrush;
02701 
02702 
02703     // LEGENDS
02704 
02705     LegendPosition _legendPosition;
02706     Qt::Orientation _legendOrientation;
02707     bool _legendShowLines;
02708     LegendSource _legendSource;
02709     QMap < int, QString > _legendText;
02710     QColor _legendTextColor;
02711     QFont _legendFont;
02712     bool _legendFontUseRelSize;
02713     int _legendFontRelSize;
02714     QString _legendTitleText;
02715     QColor _legendTitleTextColor;
02716     QFont _legendTitleFont;
02717     bool _legendTitleFontUseRelSize;
02718     int _legendTitleFontRelSize;
02719     uint _legendSpacing;
02720 
02721 
02722     // AXES (private)
02723     // Must be exported because of the inline methods
02724     struct KDCHART_EXPORT AxisSettings
02725     {
02726         uint dataset;
02727         uint dataset2;
02728         uint chart;
02729         KDChartAxisParams params;
02730         AxisSettings()
02731             {
02732                 dataset = KDCHART_NO_DATASET;
02733                 dataset2 = KDCHART_NO_DATASET;
02734                 chart = KDCHART_NO_CHART;
02735             }
02736     };
02737 
02738     // 13 == KDCHART_MAX_AXES + 1
02739     AxisSettings _axisSettings[ 13 ];
02740     // END AXES (private)
02741 
02742 
02743     // HEADER/FOOTER (private)
02744     // Must be exported because of the inline methods
02745     struct KDCHART_EXPORT HdFtParams
02746     {
02747         QString _text;
02748         QColor _color;
02749         QFont _font;
02750         bool _fontUseRelSize;
02751         int _fontRelSize;
02752         HdFtParams()
02753             {
02754                 _color = QColor( Qt::black );
02755                 _font = QFont( "helvetica", 10, QFont::Normal, false );
02756                 _fontUseRelSize = true;
02757                 _fontRelSize = 8; // per default quite small
02758             }
02759         void setRect( QRect rect )
02760             {
02761                 _rect = rect;
02762             }
02763         const QRect& rect() const
02764             {
02765                 return _rect;
02766             }
02767     private:
02768         // temporary data that are NOT to be stored within sessions:
02769         QRect _rect;
02770     };
02771 
02772     HdFtParams _hdFtParams[ HdFtPosEND + 1 ];
02773     // END HEADER/FOOTER (private)
02774 };
02775 
02776 
02777 QTextStream& operator<<( QTextStream& s, const KDChartParams& p );
02778 
02779 
02780 QTextStream& operator>>( QTextStream& s, KDChartParams& p );
02781 
02782 
02783 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys