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