kchart

KDChartParams.h File Reference


Detailed Description

Header for all common chart parameters.

This file is used to access all chart parameters except of the axis settings which you will find in KDChartAxisParams.h

See also:
KDChartAxisParams.h

Definition in file KDChartParams.h.

#include <qapplication.h>
#include <qfont.h>
#include <qcolor.h>
#include <qpen.h>
#include <qmap.h>
#include <qdict.h>
#include <qintdict.h>
#include <qobject.h>
#include <qtextstream.h>
#include <qsimplerichtext.h>
#include <qdom.h>
#include <limits.h>
#include <math.h>
#include "KDChartGlobal.h"
#include "KDChartEnums.h"
#include "KDChartCustomBox.h"
#include "KDFrame.h"
#include "KDChartAxisParams.h"
#include "KDChartPropertySet.h"
#include <qarray.h>

Go to the source code of this file.


Classes

class  KDChartAutoColor
class  KDChartParams
 Bundles the display parameters of a chart. More...
class  KDChartParams::KDChartFrameSettings
 Stores the frame settings for one of the chart areas:. More...

General parameters.

These methods set general parameters that apply to several or all chart types.

#define KDCHART_PROPSET_NORMAL_DATA   0
#define KDCHART_PROPSET_TRANSPARENT_DATA   1
#define KDCHART_PROPSET_HORI_LINE   2
#define KDCHART_PROPSET_VERT_LINE   3
#define KDCHART_MAX_AXES   12

Defines

#define KDCHART_ALL_AXES   UINT_MAX-1
#define KDCHART_NO_AXIS   UINT_MAX
#define KDCHART_ALL_DATASETS   UINT_MAX - 1
#define KDCHART_NO_DATASET   UINT_MAX
#define KDCHART_UNKNOWN_CHART   UINT_MAX - 2
#define KDCHART_ALL_CHARTS   UINT_MAX - 1
#define KDCHART_NO_CHART   UINT_MAX
#define KDCHART_GLOBAL_LINE_STYLE   UINT_MAX
#define KDCHART_AUTO_SIZE   INT_MAX
#define KDCHART_DATA_VALUE_AUTO_DIGITS   INT_MAX
#define KDCHART_SAGITTAL_ROTATION   INT_MAX
#define KDCHART_TANGENTIAL_ROTATION   INT_MAX - 1
#define KDCHART_SAGGITAL_ROTATION   INT_MAX
#define KDCHART_CNT_ORDINATES   4
#define KDCHART_MAX_POLAR_DELIMS_AND_LABELS_POS   8
#define KDCHART_DATA_VALUE_AUTO_COLOR   (KDChartAutoColor::instance()->color())

Typedefs

typedef QIntDict< KDChartPropertySetKDChartPropertySetList

Functions

QTextStream & operator<< (QTextStream &s, const KDChartParams &p)
QTextStream & operator>> (QTextStream &s, KDChartParams &p)

Define Documentation

#define KDCHART_CNT_ORDINATES   4
 

Our charts may have up to 4 ordinate axes: 2 left ones and 2 right ones.

Definition at line 110 of file KDChartParams.h.

const uint KDCHART_MAX_AXES   12
 

Charts have up to 12 axes: up to two axes on both sides for X, Y and Z (if data is 3-dimensional).

This constant is located here and in KDChartAxisParams, because one KDChartAxisParams object describes only one axis.

Definition at line 113 of file KDChartParams.h.

static const int KDCHART_PROPSET_HORI_LINE   2
 

Predefined (build-in) property ID.

may be used to specify a special cell which is not part of the normal data but to be used for positioning a separate horizontal line. Data display will be surpressed for this point: neither the data representation nor the connecting line to the next point will be shown, actually the point will remain invisible but a horizontal line will be drawn instead: using line style Qt::DotLine and the respective dataset's line color.

Use this IDs without previously defining a respective set of properties via KDChartParams::registerProperties(...).

In case you want to change this default behavior, use KDChartParams::setProperties(), e.g. the following piece of code still has an invisible line and also does not show the point's marker while now showing two separate markers at the horizontal line's start and end.

  KDChartPropertySet horiProps;
  if( properties(KDCHART_PROPSET_HORI_LINE,
  horiProps) ){
// build-in property was found, let's modify it a bit:
horiProps.setExtraMarkersAlign(
KDChartPropertySet::OwnID,
Qt::AlignLeft | Qt::AlignRight );
setProperties(KDCHART_PROPSET_HORI_LINE,
horiProps);
}else{
// Ooops? The build-in property was NOT found!
// OK, never mind, let's specify it from scratch:
horiProps.setName("horizontal line");
horiProps.setLineStyle(KDChartPropertySet::OwnID, Qt::NoPen);
horiProps.setShowMarker( KDChartPropertySet::OwnID, false );
horiProps.setExtraMarkersAlign(  KDChartPropertySet::OwnID,
Qt::AlignLeft | Qt::AlignRight );
horiProps.setExtraMarkersAlign(
KDChartPropertySet::OwnID,
Qt::AlignLeft | Qt::AlignRight );
setProperties(KDCHART_PROPSET_HORI_LINE,
horiProps);
}

Note:
The example above uses setProperties (in the last line) to define a property set. This is the right way for build-in property sets, but it is not recomended for your additional user-defined property sets: these should be registered with the registerProperties function to initially obtain a unique ID number for your new property set, see the second example given with KDCHART_PROPSET_VERT_LINE.
See also:
KDCHART_PROPSET_NORMAL_DATA

KDCHART_PROPSET_VERT_LINE

KDChartData::setPropertySet

KDChartParams::registerProperties, KDChartParams::setProperties, KDChartParams::properties

Definition at line 97 of file KDChartParams.h.

static const int KDCHART_PROPSET_NORMAL_DATA   0
 

Default (built-in) property ID, used for data cells without any special properties.

Use this IDs without previously defining a respective set of properties via KDChartParams::registerProperties(...).

Note:
While (in theory) it is possible to assign special property values to this build-in property set this normally might not a very good idea since these values would apply to every(!) data cell that has no other property set assigned. Such general changes would rather be done calling KDChartParam's main functions, e.g. you would invoke KDChartParams::setLineMarker(true) instead of changing the normal-data property set.
See also:
KDCHART_PROPSET_TRANSPARENT_DATA

KDCHART_PROPSET_HORI_LINE, KDCHART_PROPSET_VERT_LINE

KDChartData::setPropertySet

KDChartParams::registerProperties, KDChartParams::setProperties, KDChartParams::properties

Definition at line 95 of file KDChartParams.h.

static const int KDCHART_PROPSET_TRANSPARENT_DATA   1
 

Predefined (build-in) property ID.

used to specify a cell that should be displayed using a null pen: neither the data representation nor the connecting line to the next point will be shown, but the line will be drawn using line style Qt::NoPen.

Use this IDs without previously defining a respective set of properties via KDChartParams::registerProperties(...).

Note:
: Assigning this property to a data cell will result in the cell being invisible: there will be no marker for this point and there will be a 'gap' in this dataset's line from the point to the next one. In case you want to change this default behavior, use KDChartParams::setProperties(), e.g. the following piece of code still has an invisible line while now enabeling showing of the marker - but only if it was set active by KDChartParams::setLineMarker(true).
  KDChartPropertySet transpProps;
  bool bDummy;
  if( properties(KDCHART_PROPSET_TRANSPARENT_DATA,
  transpProps) ){
// build-in property was found, let's modify it a bit:
transpProps.setShowMarker(
KDCHART_PROPSET_NORMAL_DATA, bDummy );
setProperties(KDCHART_PROPSET_TRANSPARENT_DATA,
transpProps);
}else{
// Ooops? The build-in property was NOT found!
// OK, never mind, let's specify it from scratch:
transpProps.setName("transparent data");
transpProps.setLineStyle(KDChartPropertySet::OwnID, Qt::NoPen);
transpProps.setShowMarker(
KDCHART_PROPSET_NORMAL_DATA, bDummy);
setProperties(KDCHART_PROPSET_TRANSPARENT_DATA,
transpProps);
}

Note:
The example above uses setProperties (in the last line) to define a property set. This is the right way for build-in property sets, but it is not recomended for your additional user-defined property sets: these should be registered with the registerProperties function to initially obtain a unique ID number for your new property set, see the second example given with KDCHART_PROPSET_VERT_LINE.
See also:
KDCHART_PROPSET_NORMAL_DATA

KDCHART_PROPSET_HORI_LINE, KDCHART_PROPSET_VERT_LINE

KDChartData::setPropertySet

KDChartParams::registerProperties, KDChartParams::setProperties, KDChartParams::properties

Definition at line 96 of file KDChartParams.h.

static const int KDCHART_PROPSET_VERT_LINE   3
 

Predefined (build-in) property ID.

may be used to specify a special cell which is not part of the normal data but to be used for positioning a separate vertical line. Data display will be surpressed for this point: neither the data representation nor the connecting line to the next point will be shown, actually the point will remain invisible but a vertical line will be drawn instead: using line style Qt::DotLine and the respective dataset's line color.

Use this IDs without previously defining a respective set of properties via KDChartParams::registerProperties(...).

In case you want to change this default behavior, use KDChartParams::setProperties(), e.g. the following piece of code still has an invisible line and also does not show the point's marker while now showing a separate marker at the top end of the vertical line which will not run across the complete data area but start on the respective point's Y position and go to the top edge of the chart's area.

  KDChartPropertySet vertProps;
  if( properties(KDCHART_PROPSET_VERT_LINE,
  vertProps) ){
// build-in property was found, let's modify it a bit:
vertProps.setExtraMarkersAlign(
KDChartPropertySet::OwnID, Qt::AlignTop );
setProperties(KDCHART_PROPSET_VERT_LINE,
vertProps);
}else{
// Ooops? The build-in property was NOT found!
// OK, never mind, let's specify it from scratch:
vertProps.setName("vertical line");
vertProps.setLineStyle(KDChartPropertySet::OwnID, Qt::NoPen);
vertProps.setShowMarker( KDChartPropertySet::OwnID, false );
vertProps.setExtraMarkersAlign(  KDChartPropertySet::OwnID,
Qt::AlignTop );
vertProps.setExtraMarkersAlign(
KDChartPropertySet::OwnID,
Qt::AlignTop );
setProperties(KDCHART_PROPSET_VERT_LINE,
vertProps);
}

Note:
The example above uses setProperties (in the last line) to define a property set. This is the right way for build-in property sets, but it is not recomended for your additional user-defined property sets: these should be registered with the registerProperties function to initially obtain a unique ID number for your new property set, see the following example:
The code shown below demonstrates how to specify a new property set which then can be used for adding a red vertical line with marker to some of your normal data points:

// 1. specify and register the new property set
KDChartPropertySet dataWithTopLineProps;
dataWithTopLineProps.setName(
"normal data with red vertical line on top");
dataWithTopLineProps.setExtraLinesAlign(
KDChartPropertySet::OwnID,
Qt::AlignTop );
dataWithTopLineProps.setExtraLinesWidth(
KDChartPropertySet::OwnID,
-2 );
dataWithTopLineProps.setExtraLinesColor(
KDChartPropertySet::OwnID,
    Qt::red );
dataWithTopLineProps.setExtraLinesStyle(
        KDChartPropertySet::OwnID,
        Qt::SolidLine );
dataWithTopLineProps.setExtraMarkersAlign(
        KDChartPropertySet::OwnID,
        Qt::AlignTop );
dataWithTopLineProps.setExtraMarkersSize(
        KDChartPropertySet::OwnID,
        QSize(-10, -10) );
dataWithTopLineProps.setExtraMarkersColor(
        KDChartPropertySet::OwnID,
        Qt::darkRed );
dataWithTopLineProps.setExtraMarkersStyle(
        KDChartPropertySet::OwnID,
        KDChartParams::LineMarkerCircle );
int idDataWithTopLineProps
= registerProperties( dataWithTopLineProps );
// 2. assign this property set
//    to some of your data cells
d = new KDChartTableData( 5, 10 );
// ...
d->cell( 0, 2 ).setPropertySet( idDataWithTopLineProps );
d->cell( 2, 5 ).setPropertySet( idDataWithTopLineProps );

See also:
KDCHART_PROPSET_NORMAL_DATA

KDCHART_PROPSET_HORI_LINE

KDChartData::setPropertySet

KDChartParams::registerProperties, KDChartParams::setProperties, KDChartParams::properties

Definition at line 98 of file KDChartParams.h.


Function Documentation

QTextStream & operator<< QTextStream &  s,
const KDChartParams p
 

Writes the KDChartParams object p as an XML document to the text stream s.

Parameters:
s the text stream to write to
p the KDChartParams object to write
Returns:
the text stream after the write operation

Definition at line 42 of file KDChartParams_io.cpp.

QTextStream & operator>> QTextStream &  s,
KDChartParams p
 

Reads the an XML document from the text stream s into the KDChartParams object p.

Parameters:
s the text stream to read from
p the KDChartParams object to read into
Returns:
the text stream after the read operation

Definition at line 1039 of file KDChartParams_io.cpp.

KDE Home | KDE Accessibility Home | Description of Access Keys