KDChart::AbstractCartesianDiagram Class Reference

#include <KDChartAbstractCartesianDiagram.h>

Inheritance diagram for KDChart::AbstractCartesianDiagram:

Inheritance graph
[legend]
Collaboration diagram for KDChart::AbstractCartesianDiagram:

Collaboration graph
[legend]

List of all members.


Detailed Description

Base class for diagrams based on a cartesian coordianate system.

The AbstractCartesianDiagram interface adds those elements that are specific to diagrams based on a cartesian coordinate system to the basic AbstractDiagram interface.

Definition at line 45 of file KDChartAbstractCartesianDiagram.h.


Signals

void dataHidden ()
 This signal is emitted, when the hidden status of at least one data cell was (un)set.
void layoutChanged (AbstractDiagram *)
 Diagrams are supposed to emit this signal, when the layout of one of their element changes.
void modelsChanged ()
 This signal is emitted, when either the model or the AttributesModel is replaced.
void propertiesChanged ()
 Emitted upon change of a property of the Diagram.

Public Member Functions

 AbstractCartesianDiagram (QWidget *parent=0, CartesianCoordinatePlane *plane=0)
virtual void addAxis (CartesianAxis *axis)
 Add the axis to the diagram.
bool allowOverlappingDataValueTexts () const
 
Returns:
Whether data value labels are allowed to overlap.

bool antiAliasing () const
 
Returns:
Whether anti-aliasing is to be used for rendering this diagram.

virtual AttributesModelattributesModel () const
 Returns the AttributesModel, that is used by this diagram.
virtual KDChart::CartesianAxisList axes () const
 
Returns:
a list of all axes added to the diagram

QBrush brush (const QModelIndex &index) const
 Retrieve the brush to be used, for painting the datapoint at the given index in the model.
QBrush brush (int dataset) const
 Retrieve the brush to be used for the given dataset.
QBrush brush () const
 Retrieve the brush to be used for painting datapoints globally.
bool compare (const AbstractDiagram *other) const
 Returns true if both diagrams have the same settings.
bool compare (const AbstractCartesianDiagram *other) const
 Returns true if both diagrams have the same settings.
AbstractCoordinatePlanecoordinatePlane () const
 The coordinate plane associated with the diagram.
const QPair< QPointF, QPointF > dataBoundaries () const
 Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these values).
virtual void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 [reimplemented]
QList< QBrush > datasetBrushes () const
 The set of dataset brushes currently used, for use in legends, etc.
int datasetDimension () const
 The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to have.
QStringList datasetLabels () const
 The set of dataset labels currently displayed, for use in legends, etc.
QList< MarkerAttributesdatasetMarkers () const
 The set of dataset markers currently used, for use in legends, etc.
QList< QPen > datasetPens () const
 The set of dataset pens currently used, for use in legends, etc.
DataValueAttributes dataValueAttributes (const QModelIndex &index) const
 Retrieve the DataValueAttributes for the given index.
DataValueAttributes dataValueAttributes (int dataset) const
 Retrieve the DataValueAttributes for the given dataset.
DataValueAttributes dataValueAttributes () const
 Retrieve the DataValueAttributes specified globally.
virtual void doItemsLayout ()
 [reimplemented]
virtual int horizontalOffset () const
 [reimplemented]
virtual QModelIndex indexAt (const QPoint &point) const
 [reimplemented]
QModelIndexList indexesAt (const QPoint &point) const
 This method is added alongside with indexAt from QAIM, since in kdchart multiple indexes can be displayed at the same spot.
bool isHidden (const QModelIndex &index) const
 Retrieve the hidden status for the given index.
bool isHidden (int dataset) const
 Retrieve the hidden status for the given dataset.
bool isHidden () const
 Retrieve the hidden status specified globally.
virtual bool isIndexHidden (const QModelIndex &index) const
 [reimplemented]
QStringList itemRowLabels () const
 The set of item row labels currently displayed, for use in Abscissa axes, etc.
virtual void layoutPlanes ()
 Triggers layouting of all coordinate planes on the current chart.
virtual QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
 [reimplemented]
virtual const int numberOfAbscissaSegments () const =0
virtual const int numberOfOrdinateSegments () const =0
virtual void paint (PaintContext *paintContext)=0
 Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
void paintDataValueText (QPainter *painter, const QModelIndex &index, const QPointF &pos, double value)
void paintMarker (QPainter *painter, const QModelIndex &index, const QPointF &pos)
void paintMarker (QPainter *painter, const DataValueAttributes &a, const QModelIndex &index, const QPointF &pos)
virtual void paintMarker (QPainter *painter, const MarkerAttributes &markerAttributes, const QBrush &brush, const QPen &, const QPointF &point, const QSizeF &size)
QPen pen (const QModelIndex &index) const
 Retrieve the pen to be used, for painting the datapoint at the given index in the model.
QPen pen (int dataset) const
 Retrieve the pen to be used for the given dataset.
QPen pen () const
 Retrieve the pen to be used for painting datapoints globally.
bool percentMode () const
virtual AbstractCartesianDiagramreferenceDiagram () const
 
Returns:
this diagram's reference diagram

virtual QPointF referenceDiagramOffset () const
 
Returns:
the relative offset of this diagram's reference diagram

virtual void resize (const QSizeF &area)=0
 Called by the widget's sizeEvent.
virtual void scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible)
 [reimplemented]
void setAllowOverlappingDataValueTexts (bool allow)
 Set whether data value labels are allowed to overlap.
void setAntiAliasing (bool enabled)
 Set whether anti-aliasing is to be used while rendering this diagram.
void setAttributesModel (AttributesModel *model)
 Associate an AttributesModel with this diagram.
void setBrush (const QBrush &brush)
 Set the brush to be used, for painting all datasets in the model.
void setBrush (int dataset, const QBrush &brush)
 Set the brush to be used, for painting the given dataset.
void setBrush (const QModelIndex &index, const QBrush &brush)
 Set the brush to be used, for painting the datapoint at the given index.
virtual void setCoordinatePlane (AbstractCoordinatePlane *plane)
 [reimplemented]
void setDatasetDimension (int dimension)
 
void setDataValueAttributes (const DataValueAttributes &a)
 Set the DataValueAttributes for all datapoints in the model.
void setDataValueAttributes (int dataset, const DataValueAttributes &a)
 Set the DataValueAttributes for the given dataset.
void setDataValueAttributes (const QModelIndex &index, const DataValueAttributes &a)
 Set the DataValueAttributes for the given index.
void setHidden (bool hidden)
 Hide (or unhide, resp.
void setHidden (int dataset, bool hidden)
 Hide (or unhide, resp.
void setHidden (const QModelIndex &index, bool hidden)
 Hide (or unhide, resp.
void setModel (QAbstractItemModel *model)
 Associate a model with the diagram.
void setPen (const QPen &pen)
 Set the pen to be used, for painting all datasets in the model.
void setPen (int dataset, const QPen &pen)
 Set the pen to be used, for painting the given dataset.
void setPen (const QModelIndex &index, const QPen &pen)
 Set the pen to be used, for painting the datapoint at the given index.
void setPercentMode (bool percent)
virtual void setReferenceDiagram (AbstractCartesianDiagram *diagram, const QPointF &offset=QPointF())
 Makes this diagram use another diagram diagram as reference diagram with relative offset offset.
void setRootIndex (const QModelIndex &index)
 Set the root index in the model, where the diagram starts referencing data for display.
virtual void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command)
 [reimplemented]
virtual void setSelectionModel (QItemSelectionModel *selectionModel)
 Associate a seleection model with the diagrom.
void setUnitPrefix (const QString &prefix, Qt::Orientation orientation)
 Set the unit prefix to be used on axes for all columns.
void setUnitPrefix (const QString &prefix, int column, Qt::Orientation orientation)
 Set the unit prefix to be used on axes for one specific column.
void setUnitSuffix (const QString &suffix, Qt::Orientation orientation)
 Set the unit prefix to be used on axes for all columns.
void setUnitSuffix (const QString &suffix, int column, Qt::Orientation orientation)
 Set the unit prefix to be used on axes for one specific column.
virtual void takeAxis (CartesianAxis *axis)
 Removes the axis from the diagram, without deleting it.
QString unitPrefix (Qt::Orientation orientation) const
 Retrieves the axis unit prefix.
QString unitPrefix (int column, Qt::Orientation orientation, bool fallback=false) const
 Retrieves the axis unit prefix for a specific column.
QString unitSuffix (Qt::Orientation orientation) const
 Retrieves the axis unit suffix.
QString unitSuffix (int column, Qt::Orientation orientation, bool fallback=false) const
 Retrieves the axis unit suffix for a specific column.
void update () const
void useDefaultColors ()
 Set the palette to be used, for painting datasets to the default palette.
void useRainbowColors ()
 Set the palette to be used, for painting datasets to the rainbow palette.
virtual bool usesExternalAttributesModel () const
 Returns whether the diagram is using its own built-in attributes model or an attributes model that was set via setAttributesModel.
void useSubduedColors ()
 Set the palette to be used, for painting datasets to the subdued palette.
virtual int verticalOffset () const
 [reimplemented]
virtual QRect visualRect (const QModelIndex &index) const
 [reimplemented]
virtual QRegion visualRegion (const QModelIndex &index) const
virtual QRegion visualRegionForSelection (const QItemSelection &selection) const
 [reimplemented]
virtual ~AbstractCartesianDiagram ()

Protected Slots

void setDataBoundariesDirty () const

Protected Member Functions

QModelIndex attributesModelRootIndex () const
virtual const QPair< QPointF,
QPointF > 
calculateDataBoundaries () const =0
virtual bool checkInvariants (bool justReturnTheStatus=false) const
virtual void paintDataValueTexts (QPainter *painter)
 This method is obsolete and provided for backward-compatibility only.
virtual void paintMarkers (QPainter *painter)
 This method is obsolete and provided for backward-compatibility only.
void setAttributesModelRootIndex (const QModelIndex &)
void setDatasetDimensionInternal (int dimension)
virtual double threeDItemDepth (int column) const =0
 
Returns:
the 3D item depth of the data set column

virtual double threeDItemDepth (const QModelIndex &index) const =0
 
Returns:
the 3D item depth of the model index index

double valueForCell (int row, int column) const
 Helper method, retrieving the data value (DisplayRole) for a given row and column.

Constructor & Destructor Documentation

AbstractCartesianDiagram::AbstractCartesianDiagram ( QWidget parent = 0,
CartesianCoordinatePlane plane = 0 
) [explicit]

Definition at line 71 of file KDChartAbstractCartesianDiagram.cpp.

References StockDiagram::init().

00072     : AbstractDiagram ( new Private(), parent, plane )
00073 {
00074     init();
00075 }

KDChart::AbstractCartesianDiagram::~AbstractCartesianDiagram (  )  [virtual]

Definition at line 77 of file KDChartAbstractCartesianDiagram.cpp.

References d, and KDChart::AbstractAxis::deleteObserver().

00078 {
00079     Q_FOREACH( CartesianAxis* axis, d->axesList ) {
00080         axis->deleteObserver( this );
00081     }
00082     d->axesList.clear();
00083 }


Member Function Documentation

void AbstractCartesianDiagram::addAxis ( CartesianAxis axis  )  [virtual]

Add the axis to the diagram.

The diagram takes ownership of the axis and will delete it.

To gain back ownership (e.g. for assigning the axis to another diagram) use the takeAxis method, before calling addAxis on the other diagram.

See also:
takeAxis

Definition at line 92 of file KDChartAbstractCartesianDiagram.cpp.

References KDChart::AbstractAxis::createObserver(), d, and layoutPlanes().

00093 {
00094     if ( !d->axesList.contains( axis ) ) {
00095         d->axesList.append( axis );
00096         axis->createObserver( this );
00097         layoutPlanes();
00098     }
00099 }

bool AbstractDiagram::allowOverlappingDataValueTexts (  )  const [inherited]

Returns:
Whether data value labels are allowed to overlap.

Definition at line 511 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::compare().

00512 {
00513     return d->allowOverlappingDataValueTexts;
00514 }

bool AbstractDiagram::antiAliasing (  )  const [inherited]

Returns:
Whether anti-aliasing is to be used for rendering this diagram.

Definition at line 522 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::compare().

00523 {
00524     return d->antiAliasing;
00525 }

AttributesModel * AbstractDiagram::attributesModel (  )  const [virtual, inherited]

Returns the AttributesModel, that is used by this diagram.

By default each diagram owns its own AttributesModel, which should never be deleted. Only if a user-supplied AttributesModel has been set does the pointer returned here not belong to the diagram.

Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
Returns:
a pointer to the AttributesModel currently used by this diagram.

Definition at line 315 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::brush(), StockDiagram::calculateDataBoundaries(), KDChart::AbstractDiagram::compare(), KDChart::AbstractDiagram::datasetBrushes(), KDChart::AbstractDiagram::datasetLabels(), KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::datasetPens(), KDChart::AbstractDiagram::dataValueAttributes(), StockDiagram::init(), KDChart::AbstractDiagram::isHidden(), KDChart::AbstractDiagram::itemRowLabels(), StockDiagram::paint(), KDChart::PolarDiagram::paint(), KDChart::AbstractDiagram::pen(), setAttributesModel(), KDChart::BarDiagram::setBarAttributes(), KDChart::AbstractDiagram::setBrush(), setCoordinatePlane(), setModel(), KDChart::AbstractDiagram::setPen(), setRootIndex(), StockDiagram::setStockBarAttributes(), StockDiagram::setThreeDBarAttributes(), StockDiagram::stockBarAttributes(), KDChart::TernaryLineDiagram::TernaryLineDiagram(), and StockDiagram::threeDBarAttributes().

00316 {
00317     return d->attributesModel;
00318 }

QModelIndex AbstractDiagram::attributesModelRootIndex (  )  const [protected, inherited]

returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.

Definition at line 345 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by StockDiagram::calculateDataBoundaries(), KDChart::AbstractDiagram::datasetBrushes(), KDChart::AbstractDiagram::datasetLabels(), KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::datasetPens(), KDChart::AbstractDiagram::itemRowLabels(), KDChart::Plotter::numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfAbscissaSegments(), KDChart::BarDiagram::numberOfAbscissaSegments(), KDChart::Plotter::numberOfOrdinateSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(), KDChart::BarDiagram::numberOfOrdinateSegments(), StockDiagram::paint(), KDChart::AbstractDiagram::valueForCell(), and KDChart::LineDiagram::valueForCellTesting().

00346 {
00347     if ( !d->attributesModelRootIndex.isValid() )
00348         d->attributesModelRootIndex = d->attributesModel->mapFromSource( rootIndex() );
00349     return d->attributesModelRootIndex;
00350 }

KDChart::CartesianAxisList AbstractCartesianDiagram::axes (  )  const [virtual]

Returns:
a list of all axes added to the diagram

Definition at line 111 of file KDChartAbstractCartesianDiagram.cpp.

References d.

Referenced by KDChart::Widget::setType(), and KDChart::CartesianCoordinatePlane::sharedAxisMasterPlane().

00112 {
00113     return d->axesList;
00114 }

QBrush AbstractDiagram::brush ( const QModelIndex &  index  )  const [inherited]

Retrieve the brush to be used, for painting the datapoint at the given index in the model.

Parameters:
index The index of the datapoint in the model. With a dataset dimension of two, this is the index of the key of each key/value pair.
Returns:
The brush to use for painting.

Definition at line 850 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetBrushRole.

00851 {
00852     return qVariantValue<QBrush>(
00853         attributesModel()->data( conditionallyMapFromSource( index ), DatasetBrushRole ) );
00854 }

QBrush AbstractDiagram::brush ( int  dataset  )  const [inherited]

Retrieve the brush to be used for the given dataset.

This will fall back automatically to what was set at model level, if there are no dataset specific settings.

Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.

Definition at line 835 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::brush(), KDChart::DatasetBrushRole, and KDChart::AbstractDiagram::datasetDimension().

00836 {
00837     // To store the brush for a dataset, we use the first column
00838     // that's associated with it. (i.e., with a dataset dimension
00839     // of two, the column of the keys)
00840     const int column = dataset * datasetDimension();
00841     
00842     const QVariant brushSettings(
00843             attributesModel()->headerData( column, Qt::Vertical,
00844                     DatasetBrushRole ) );
00845     if( brushSettings.isValid() )
00846         return qVariantValue< QBrush >( brushSettings );
00847     return brush();
00848 }

QBrush AbstractDiagram::brush (  )  const [inherited]

Retrieve the brush to be used for painting datapoints globally.

This will fall back automatically to the default settings, if there are no specific settings.

Returns:
The brush to use for painting.

Definition at line 829 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetBrushRole.

Referenced by KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::datasetBrushes(), KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::PolarDiagram::paint(), and KDChart::AbstractDiagram::paintMarker().

00830 {
00831     return qVariantValue<QBrush>(
00832         attributesModel()->data( DatasetBrushRole ) );
00833 }

virtual const QPair<QPointF, QPointF> KDChart::AbstractDiagram::calculateDataBoundaries (  )  const [protected, pure virtual, inherited]

Implemented in KDChart::BarDiagram, KDChart::LineDiagram, KDChart::PieDiagram, KDChart::Plotter, KDChart::PolarDiagram, KDChart::RingDiagram, KDChart::StockDiagram, KDChart::LeveyJenningsDiagram, KDChart::AbstractTernaryDiagram, KDChart::TernaryLineDiagram, and KDChart::TernaryPointDiagram.

Referenced by KDChart::AbstractDiagram::dataBoundaries().

bool AbstractDiagram::checkInvariants ( bool  justReturnTheStatus = false  )  const [protected, virtual, inherited]

Definition at line 1077 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::coordinatePlane().

Referenced by KDChart::RingDiagram::calculateDataBoundaries(), KDChart::PolarDiagram::calculateDataBoundaries(), KDChart::Plotter::calculateDataBoundaries(), KDChart::PieDiagram::calculateDataBoundaries(), KDChart::LineDiagram::calculateDataBoundaries(), KDChart::BarDiagram::calculateDataBoundaries(), KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), KDChart::Plotter::paint(), KDChart::LineDiagram::paint(), KDChart::LeveyJenningsDiagram::paint(), KDChart::BarDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), KDChart::PieDiagram::paintInternal(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractDiagram::paintMarkers().

01078 {
01079     if( ! justReturnTheStatus ){
01080         Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
01081                     "There is no usable model set, for the diagram." );
01082 
01083         Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
01084                     "There is no usable coordinate plane set, for the diagram." );
01085     }
01086     return model() && coordinatePlane();
01087 }

bool AbstractDiagram::compare ( const AbstractDiagram other  )  const [inherited]

Returns true if both diagrams have the same settings.

Definition at line 131 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::allowOverlappingDataValueTexts(), KDChart::AbstractDiagram::antiAliasing(), KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::compare(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::AbstractDiagram::percentMode().

00132 {
00133     if( other == this ) return true;
00134     if( ! other ){
00135         //qDebug() << "AbstractDiagram::compare() cannot compare to Null pointer";
00136         return false;
00137     }
00138     /*
00139     qDebug() << "\n             AbstractDiagram::compare() QAbstractScrollArea:";
00140             // compare QAbstractScrollArea properties
00141     qDebug() <<
00142             ((horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) &&
00143             (verticalScrollBarPolicy()    == other->verticalScrollBarPolicy()));
00144     qDebug() << "AbstractDiagram::compare() QFrame:";
00145             // compare QFrame properties
00146     qDebug() <<
00147             ((frameShadow() == other->frameShadow()) &&
00148             (frameShape()   == other->frameShape()) &&
00149             (frameWidth()   == other->frameWidth()) &&
00150             (lineWidth()    == other->lineWidth()) &&
00151             (midLineWidth() == other->midLineWidth()));
00152     qDebug() << "AbstractDiagram::compare() QAbstractItemView:";
00153             // compare QAbstractItemView properties
00154     qDebug() <<
00155             ((alternatingRowColors() == other->alternatingRowColors()) &&
00156             (hasAutoScroll()         == other->hasAutoScroll()) &&
00157 #if QT_VERSION > 0x040199
00158             (dragDropMode()          == other->dragDropMode()) &&
00159             (dragDropOverwriteMode() == other->dragDropOverwriteMode()) &&
00160             (horizontalScrollMode()  == other->horizontalScrollMode ()) &&
00161             (verticalScrollMode()    == other->verticalScrollMode()) &&
00162 #endif
00163             (dragEnabled()           == other->dragEnabled()) &&
00164             (editTriggers()          == other->editTriggers()) &&
00165             (iconSize()              == other->iconSize()) &&
00166             (selectionBehavior()     == other->selectionBehavior()) &&
00167             (selectionMode()         == other->selectionMode()) &&
00168             (showDropIndicator()     == other->showDropIndicator()) &&
00169             (tabKeyNavigation()      == other->tabKeyNavigation()) &&
00170             (textElideMode()         == other->textElideMode()));
00171     qDebug() << "AbstractDiagram::compare() AttributesModel: ";
00172             // compare all of the properties stored in the attributes model
00173     qDebug() << attributesModel()->compare( other->attributesModel() );
00174     qDebug() << "AbstractDiagram::compare() own:";
00175             // compare own properties
00176     qDebug() <<
00177             ((rootIndex().column()            == other->rootIndex().column()) &&
00178             (rootIndex().row()                == other->rootIndex().row()) &&
00179             (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) &&
00180             (antiAliasing()                   == other->antiAliasing()) &&
00181             (percentMode()                    == other->percentMode()) &&
00182             (datasetDimension()               == other->datasetDimension()));
00183     */
00184     return  // compare QAbstractScrollArea properties
00185             (horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) &&
00186             (verticalScrollBarPolicy()   == other->verticalScrollBarPolicy()) &&
00187             // compare QFrame properties
00188             (frameShadow()  == other->frameShadow()) &&
00189             (frameShape()   == other->frameShape()) &&
00190 // frameWidth is a read-only property defined by the style, it should not be in here:
00191             // (frameWidth()   == other->frameWidth()) &&
00192             (lineWidth()    == other->lineWidth()) &&
00193             (midLineWidth() == other->midLineWidth()) &&
00194             // compare QAbstractItemView properties
00195             (alternatingRowColors()  == other->alternatingRowColors()) &&
00196             (hasAutoScroll()         == other->hasAutoScroll()) &&
00197 #if QT_VERSION > 0x040199
00198             (dragDropMode()          == other->dragDropMode()) &&
00199             (dragDropOverwriteMode() == other->dragDropOverwriteMode()) &&
00200             (horizontalScrollMode()  == other->horizontalScrollMode ()) &&
00201             (verticalScrollMode()    == other->verticalScrollMode()) &&
00202 #endif
00203             (dragEnabled()           == other->dragEnabled()) &&
00204             (editTriggers()          == other->editTriggers()) &&
00205             (iconSize()              == other->iconSize()) &&
00206             (selectionBehavior()     == other->selectionBehavior()) &&
00207             (selectionMode()         == other->selectionMode()) &&
00208             (showDropIndicator()     == other->showDropIndicator()) &&
00209             (tabKeyNavigation()      == other->tabKeyNavigation()) &&
00210             (textElideMode()         == other->textElideMode()) &&
00211             // compare all of the properties stored in the attributes model
00212             attributesModel()->compare( other->attributesModel() ) &&
00213             // compare own properties
00214             (rootIndex().column()             == other->rootIndex().column()) &&
00215             (rootIndex().row()                == other->rootIndex().row()) &&
00216             (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) &&
00217             (antiAliasing()                   == other->antiAliasing()) &&
00218             (percentMode()                    == other->percentMode()) &&
00219             (datasetDimension()               == other->datasetDimension());
00220 }

bool AbstractCartesianDiagram::compare ( const AbstractCartesianDiagram other  )  const

Returns true if both diagrams have the same settings.

Definition at line 47 of file KDChartAbstractCartesianDiagram.cpp.

References referenceDiagram(), and referenceDiagramOffset().

00048 {
00049     if( other == this ) return true;
00050     if( ! other ){
00051         //qDebug() << "AbstractCartesianDiagram::compare() cannot compare to Null pointer";
00052         return false;
00053     }
00054     /*
00055     qDebug() << "\n             AbstractCartesianDiagram::compare():";
00056             // compare own properties
00057     qDebug() <<
00058             ((referenceDiagram() == other->referenceDiagram()) &&
00059             ((! referenceDiagram()) || (referenceDiagramOffset() == other->referenceDiagramOffset())));
00060     */
00061     return  // compare the base class
00062             ( static_cast<const AbstractDiagram*>(this)->compare( other ) ) &&
00063             // compare own properties
00064             (referenceDiagram() == other->referenceDiagram()) &&
00065             ((! referenceDiagram()) || (referenceDiagramOffset() == other->referenceDiagramOffset()));
00066 }

AbstractCoordinatePlane * AbstractDiagram::coordinatePlane (  )  const [inherited]

The coordinate plane associated with the diagram.

This determines how coordinates in value space are mapped into pixel space. By default this is a CartesianCoordinatePlane.

Returns:
The coordinate plane associated with the diagram.

Definition at line 222 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::checkInvariants(), KDChart::LeveyJenningsDiagram::iconRect(), layoutPlanes(), KDChart::PolarDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), KDChart::AbstractDiagram::paintMarkers(), KDChart::AbstractPolarDiagram::polarCoordinatePlane(), StockDiagram::resize(), KDChart::Plotter::resize(), KDChart::LineDiagram::resize(), KDChart::BarDiagram::resize(), and setCoordinatePlane().

00223 {
00224     return d->plane;
00225 }

const QPair< QPointF, QPointF > AbstractDiagram::dataBoundaries (  )  const [inherited]

Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these values).

This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they can call setDataBoundariesDirty()

Returned value is in diagram coordinates.

Definition at line 227 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.

Referenced by KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::Plotter::paint(), KDChart::LineDiagram::paint(), KDChart::LeveyJenningsDiagram::paint(), and KDChart::BarDiagram::paint().

00228 {
00229     if( d->databoundariesDirty ){
00230         d->databoundaries = calculateDataBoundaries ();
00231         d->databoundariesDirty = false;
00232     }
00233     return d->databoundaries;
00234 }

void AbstractDiagram::dataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
) [virtual, inherited]

[reimplemented]

Definition at line 366 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::setDataBoundariesDirty().

Referenced by KDChart::LeveyJenningsDiagram::setModel().

00368 {
00369     Q_UNUSED( topLeft );
00370     Q_UNUSED( bottomRight );
00371     // We are still too dumb to do intelligent updates...
00372     setDataBoundariesDirty();
00373     scheduleDelayedItemsLayout();
00374 }

void KDChart::AbstractDiagram::dataHidden (  )  [signal, inherited]

This signal is emitted, when the hidden status of at least one data cell was (un)set.

Referenced by KDChart::AbstractDiagram::setHidden().

QList< QBrush > AbstractDiagram::datasetBrushes (  )  const [inherited]

The set of dataset brushes currently used, for use in legends, etc.

Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.

Definition at line 1038 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AbstractDiagram::brush(), KDChart::AttributesModel::columnCount(), and KDChart::AbstractDiagram::datasetDimension().

Referenced by KDChart::Legend::datasetCount(), and KDChart::Legend::setBrushesFromDiagram().

01039 {
01040     QList<QBrush> ret;
01041     if( model() == 0 )
01042         return ret;
01043 
01044     const int datasetCount = attributesModel()->columnCount(attributesModelRootIndex()) / datasetDimension();
01045     for ( int dataset = 0; dataset < datasetCount; dataset++ )
01046         ret << brush( dataset );
01047 
01048     return ret;
01049 }

int AbstractDiagram::datasetDimension (  )  const [inherited]

The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to have.

For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic values will be used for the abscissa.

For example a diagram with the default dimension of 1, will have one column per datapoint (the y values) and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y values.

Returns:
The dataset dimension of the diagram.

Definition at line 1089 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::compare(), KDChart::AbstractDiagram::datasetBrushes(), KDChart::AbstractDiagram::datasetLabels(), KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::datasetPens(), KDChart::AbstractDiagram::dataValueAttributes(), KDChart::LineDiagram::getCellValues(), KDChart::CartesianCoordinatePlane::getDataDimensionsList(), KDChart::AbstractDiagram::isHidden(), KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), KDChart::AbstractDiagram::paintMarkers(), KDChart::AbstractDiagram::pen(), KDChart::AbstractDiagram::setBrush(), KDChart::AbstractDiagram::setDataValueAttributes(), KDChart::AbstractDiagram::setHidden(), KDChart::AbstractDiagram::setPen(), KDChart::Plotter::setType(), and KDChart::LineDiagram::setType().

01090 {
01091     return d->datasetDimension;
01092 }

QStringList AbstractDiagram::datasetLabels (  )  const [inherited]

The set of dataset labels currently displayed, for use in legends, etc.

Returns:
The set of dataset labels currently displayed.

Definition at line 1025 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::AttributesModel::headerData().

Referenced by KDChart::Legend::datasetCount().

01026 {
01027     QStringList ret;
01028     if( model() == 0 )
01029         return ret;
01030     
01031     const int columnCount = attributesModel()->columnCount(attributesModelRootIndex());
01032     for( int i = 0; i < columnCount; i += datasetDimension() )
01033         ret << attributesModel()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString();
01034     
01035     return ret;
01036 }

QList< MarkerAttributes > AbstractDiagram::datasetMarkers (  )  const [inherited]

The set of dataset markers currently used, for use in legends, etc.

Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.

Definition at line 1064 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::dataValueAttributes(), and KDChart::DataValueAttributes::markerAttributes().

01065 {
01066     QList<MarkerAttributes> ret;
01067     if( model() == 0 )
01068         return ret;
01069     
01070     const int datasetCount = attributesModel()->columnCount(attributesModelRootIndex()) / datasetDimension();
01071     for ( int dataset = 0; dataset < datasetCount; dataset++ )
01072         ret << dataValueAttributes( dataset ).markerAttributes();
01073 
01074     return ret;
01075 }

QList< QPen > AbstractDiagram::datasetPens (  )  const [inherited]

The set of dataset pens currently used, for use in legends, etc.

Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.

Definition at line 1051 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::AbstractDiagram::pen().

01052 {
01053     QList<QPen> ret;
01054     if( model() == 0 )
01055         return ret;
01056     
01057     const int datasetCount = attributesModel()->columnCount(attributesModelRootIndex()) / datasetDimension();
01058     for ( int dataset = 0; dataset < datasetCount; dataset++ )
01059         ret << pen( dataset );
01060     
01061     return ret;
01062 }

DataValueAttributes AbstractDiagram::dataValueAttributes ( const QModelIndex &  index  )  const [inherited]

Retrieve the DataValueAttributes for the given index.

This will fall back automatically to what was set at dataset or model level, if there are no datapoint specific settings.

Parameters:
index The datapoint to retrieve the attributes for. With a dataset dimension of two, this is the index of the key of each key/value pair.
Returns:
The DataValueAttributes for the given index.

Definition at line 491 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DataValueLabelAttributesRole.

00492 {
00493     return qVariantValue<DataValueAttributes>(
00494         attributesModel()->data(
00495             conditionallyMapFromSource( index ),
00496             KDChart::DataValueLabelAttributesRole ) );
00497 }

DataValueAttributes AbstractDiagram::dataValueAttributes ( int  dataset  )  const [inherited]

Retrieve the DataValueAttributes for the given dataset.

This will fall back automatically to what was set at model level, if there are no dataset specific settings.

Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.

Definition at line 465 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::dataValueAttributes(), and KDChart::DataValueLabelAttributesRole.

00466 {
00467     /*
00468     The following did not work!
00469     (khz, 2008-01-25)
00470     If there was some attrs specified for the 0-th cells of a dataset,
00471     then this logic would return the cell's settings instead of the header settings:
00472 
00473     return qVariantValue<DataValueAttributes>(
00474         attributesModel()->data( attributesModel()->mapFromSource(columnToIndex( column )),
00475         KDChart::DataValueLabelAttributesRole ) );
00476     */
00477     
00478     // To store the attributes for a dataset, we use the first column
00479     // that's associated with it. (i.e., with a dataset dimension
00480     // of two, the column of the keys)
00481     const int column = dataset * datasetDimension();
00482 
00483     const QVariant headerAttrs(
00484             attributesModel()->headerData( column, Qt::Vertical,
00485                 KDChart::DataValueLabelAttributesRole ) );
00486     if( headerAttrs.isValid() )
00487         return qVariantValue< DataValueAttributes >( headerAttrs );
00488     return dataValueAttributes();
00489 }

DataValueAttributes AbstractDiagram::dataValueAttributes (  )  const [inherited]

Retrieve the DataValueAttributes specified globally.

This will fall back automatically to the default settings, if there are no specific settings.

Returns:
The global DataValueAttributes.

Definition at line 459 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DataValueLabelAttributesRole, and KDChart::AttributesModel::modelData().

Referenced by KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::dataValueAttributes(), KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::AbstractDiagram::paintMarker(), and KDChart::TernaryLineDiagram::TernaryLineDiagram().

00460 {
00461     return qVariantValue<DataValueAttributes>(
00462         attributesModel()->modelData( KDChart::DataValueLabelAttributesRole ) );
00463 }

void AbstractDiagram::doItemsLayout (  )  [virtual, inherited]

[reimplemented]

Definition at line 357 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::update().

00358 {
00359     if ( d->plane ) {
00360         d->plane->layoutDiagrams();
00361         update();
00362     }
00363     QAbstractItemView::doItemsLayout();
00364 }

int AbstractDiagram::horizontalOffset (  )  const [virtual, inherited]

[reimplemented]

Definition at line 958 of file KDChartAbstractDiagram.cpp.

00959 { return 0; }

QModelIndex AbstractDiagram::indexAt ( const QPoint &  point  )  const [virtual, inherited]

[reimplemented]

Definition at line 1123 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::Chart::event().

01124 {
01125     return d->indexAt( point );
01126 }

QModelIndexList AbstractDiagram::indexesAt ( const QPoint &  point  )  const [inherited]

This method is added alongside with indexAt from QAIM, since in kdchart multiple indexes can be displayed at the same spot.

Definition at line 1128 of file KDChartAbstractDiagram.cpp.

References d.

01129 {
01130     return d->indexesAt( point );
01131 }

bool AbstractDiagram::isHidden ( const QModelIndex &  index  )  const [inherited]

Retrieve the hidden status for the given index.

This will fall back automatically to what was set at dataset or diagram level, if there are no datapoint specific settings.

Parameters:
index The datapoint to retrieve the hidden status for.
Returns:
The hidden status for the given index.

Definition at line 427 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DataHiddenRole.

00428 {
00429     return qVariantValue<bool>(
00430         attributesModel()->data(
00431             conditionallyMapFromSource(index),
00432             DataHiddenRole ) );
00433 }

bool AbstractDiagram::isHidden ( int  dataset  )  const [inherited]

Retrieve the hidden status for the given dataset.

This will fall back automatically to what was set at diagram level, if there are no dataset specific settings.

Parameters:
dataset The dataset to retrieve the hidden status for.
Returns:
The hidden status for the given dataset.

Definition at line 413 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DataHiddenRole, KDChart::AbstractDiagram::datasetDimension(), and KDChart::AbstractDiagram::isHidden().

00414 {
00415     // To store the flag for a dataset, we use the first column
00416     // that's associated with it. (i.e., with a dataset dimension
00417     // of two, the column of the keys)
00418     const int column = dataset * datasetDimension();
00419     const QVariant boolFlag(
00420             attributesModel()->headerData( column, Qt::Vertical,
00421                     DataHiddenRole ) );
00422     if( boolFlag.isValid() )
00423         return qVariantValue< bool >( boolFlag );
00424     return isHidden();
00425 }

bool AbstractDiagram::isHidden (  )  const [inherited]

Retrieve the hidden status specified globally.

This will fall back automatically to the default settings ( = not hidden), if there are no specific settings.

Returns:
The global hidden status.

Definition at line 407 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DataHiddenRole, and KDChart::AttributesModel::modelData().

Referenced by KDChart::AbstractDiagram::isHidden(), and KDChart::LineDiagram::valueForCellTesting().

00408 {
00409     return qVariantValue<bool>(
00410         attributesModel()->modelData( DataHiddenRole ) );
00411 }

bool AbstractDiagram::isIndexHidden ( const QModelIndex &  index  )  const [virtual, inherited]

[reimplemented]

Definition at line 964 of file KDChartAbstractDiagram.cpp.

00965 { return true; }

QStringList AbstractDiagram::itemRowLabels (  )  const [inherited]

The set of item row labels currently displayed, for use in Abscissa axes, etc.

Returns:
The set of item row labels currently displayed.

Definition at line 1009 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::headerData(), KDChart::AttributesModel::rowCount(), KDChart::AbstractDiagram::unitPrefix(), and KDChart::AbstractDiagram::unitSuffix().

01010 {
01011     QStringList ret;
01012     if( model() ){
01013         //qDebug() << "AbstractDiagram::itemRowLabels(): " << attributesModel()->rowCount(attributesModelRootIndex()) << "entries";
01014         const int rowCount = attributesModel()->rowCount(attributesModelRootIndex());
01015         for( int i = 0; i < rowCount; ++i ){
01016             //qDebug() << "item row label: " << attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString();
01017             ret << unitPrefix( i, Qt::Horizontal, true ) +
01018                    attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString() +
01019                    unitSuffix( i, Qt::Horizontal, true );
01020         }
01021     }
01022     return ret;
01023 }

void KDChart::AbstractDiagram::layoutChanged ( AbstractDiagram  )  [signal, inherited]

Diagrams are supposed to emit this signal, when the layout of one of their element changes.

Layouts can change, for example, when axes are added or removed, or when the configuration was changed in a way that the axes or the diagram itself are displayed in a different geometry. Changes in the diagrams coordinate system also result in the layoutChanged() signal being emitted.

Referenced by KDChart::AbstractDiagram::setDatasetDimensionInternal(), KDChart::LeveyJenningsDiagram::setModel(), KDChart::AbstractDiagram::setModel(), KDChart::BarDiagram::setOrientation(), KDChart::AbstractPieDiagram::setPieAttributes(), KDChart::AbstractPieDiagram::setThreeDPieAttributes(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().

void KDChart::AbstractCartesianDiagram::layoutPlanes (  )  [virtual]

Triggers layouting of all coordinate planes on the current chart.

Normally you don't need to call this method. It's handled automatically for you.

Definition at line 116 of file KDChartAbstractCartesianDiagram.cpp.

References KDChart::AbstractDiagram::coordinatePlane(), and KDChart::AbstractCoordinatePlane::layoutPlanes().

Referenced by addAxis(), and takeAxis().

00117 {
00118     //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes()";
00119     AbstractCoordinatePlane* plane = coordinatePlane();
00120     if( plane ){
00121         plane->layoutPlanes();
00122         //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes() OK";
00123     }
00124 }

void KDChart::AbstractDiagram::modelsChanged (  )  [signal, inherited]

This signal is emitted, when either the model or the AttributesModel is replaced.

Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::setSelectionModel().

QModelIndex AbstractDiagram::moveCursor ( CursorAction  cursorAction,
Qt::KeyboardModifiers  modifiers 
) [virtual, inherited]

[reimplemented]

Definition at line 955 of file KDChartAbstractDiagram.cpp.

00956 { return QModelIndex(); }

virtual const int KDChart::AbstractCartesianDiagram::numberOfAbscissaSegments (  )  const [pure virtual]

Implemented in KDChart::BarDiagram, KDChart::LineDiagram, KDChart::Plotter, and KDChart::StockDiagram.

virtual const int KDChart::AbstractCartesianDiagram::numberOfOrdinateSegments (  )  const [pure virtual]

Implemented in KDChart::BarDiagram, KDChart::LineDiagram, KDChart::Plotter, and KDChart::StockDiagram.

virtual void KDChart::AbstractDiagram::paint ( PaintContext paintContext  )  [pure virtual, inherited]

Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.

Parameters:
paintContext All information needed for painting.

Implemented in KDChart::BarDiagram, KDChart::LineDiagram, KDChart::PieDiagram, KDChart::Plotter, KDChart::PolarDiagram, KDChart::RingDiagram, KDChart::StockDiagram, KDChart::LeveyJenningsDiagram, KDChart::TernaryLineDiagram, and KDChart::TernaryPointDiagram.

void AbstractDiagram::paintDataValueText ( QPainter *  painter,
const QModelIndex &  index,
const QPointF &  pos,
double  value 
) [inherited]

Definition at line 539 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::paintDataValueTexts().

00543 {
00544     d->paintDataValueText( this, painter, index, pos, value );
00545 }

void AbstractDiagram::paintDataValueTexts ( QPainter *  painter  )  [protected, virtual, inherited]

This method is obsolete and provided for backward-compatibility only.

Your own diagram classes should call d->paintDataValueTextsAndMarkers() instead which also is taking care for showing your cell-specific comments, if any,

Definition at line 555 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), d, KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::paintDataValueText(), and KDChart::AbstractCoordinatePlane::translate().

00556 {
00557     if ( !checkInvariants() ) return;
00558     const int rowCount = model()->rowCount(rootIndex());
00559     const int columnCount = model()->columnCount(rootIndex());
00560     d->clearListOfAlreadyDrawnDataValueTexts();
00561     for ( int i=datasetDimension()-1; i<columnCount; i += datasetDimension() ) {
00562        for ( int j=0; j< rowCount; ++j ) {
00563            const QModelIndex index = model()->index( j, i, rootIndex() );
00564            double value = model()->data( index ).toDouble();
00565            const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
00566            paintDataValueText( painter, index, pos, value );
00567        }
00568     }
00569 }

void AbstractDiagram::paintMarker ( QPainter *  painter,
const QModelIndex &  index,
const QPointF &  pos 
) [inherited]

Definition at line 600 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::dataValueAttributes(), and KDChart::AbstractDiagram::paintMarker().

00603 {
00604     if ( !checkInvariants() ) return;
00605     paintMarker( painter, dataValueAttributes( index ), index, pos );
00606 }

void AbstractDiagram::paintMarker ( QPainter *  painter,
const DataValueAttributes a,
const QModelIndex &  index,
const QPointF &  pos 
) [inherited]

Definition at line 572 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::checkInvariants(), d, KDChart::MarkerAttributes::isVisible(), KDChart::DataValueAttributes::isVisible(), KDChart::DataValueAttributes::markerAttributes(), KDChart::MarkerAttributes::markerColor(), KDChart::MarkerAttributes::markerSize(), KDChart::AbstractDiagram::paintMarker(), and KDChart::MarkerAttributes::pen().

00576 {
00577     if ( !checkInvariants() || !a.isVisible() ) return;
00578     const MarkerAttributes ma = a.markerAttributes();
00579     if ( !ma.isVisible() ) return;
00580 
00581     const PainterSaver painterSaver( painter );
00582     // the size of the marker - unscaled
00583     const QSizeF maSize( ma.markerSize().width() / painter->matrix().m11(), 
00584                          ma.markerSize().height() / painter->matrix().m22() );
00585     QBrush indexBrush( brush( index ) );
00586     QPen indexPen( ma.pen() );
00587     if ( ma.markerColor().isValid() )
00588         indexBrush.setColor( ma.markerColor() );
00589 
00590     paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
00591 
00592     // workaround: BC cannot be changed, otherwise we would pass the
00593     // index down to next-lower paintMarker function. So far, we
00594     // basically save a circle of radius maSize at pos in the
00595     // reverseMapper. This means that ^^^ this version of paintMarker
00596     // needs to be called to reverse-map the marker.
00597     d->reverseMapper.addCircle( index.row(), index.column(), pos, 2 * maSize );
00598 }

void AbstractDiagram::paintMarker ( QPainter *  painter,
const MarkerAttributes markerAttributes,
const QBrush &  brush,
const QPen &  pen,
const QPointF &  point,
const QSizeF &  size 
) [virtual, inherited]

Definition at line 608 of file KDChartAbstractDiagram.cpp.

References KDChart::MarkerAttributes::Marker1Pixel, KDChart::MarkerAttributes::Marker4Pixels, KDChart::MarkerAttributes::MarkerCircle, KDChart::MarkerAttributes::MarkerCross, KDChart::MarkerAttributes::MarkerDiamond, KDChart::MarkerAttributes::MarkerFastCross, KDChart::MarkerAttributes::MarkerRing, KDChart::MarkerAttributes::MarkerSquare, KDChart::MarkerAttributes::markerStyle(), p, and KDChart::PrintingParameters::scalePen().

Referenced by KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::MarkerLayoutItem::paintIntoRect(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractDiagram::paintMarkers().

00614 {
00615     const QPen oldPen( painter->pen() );
00616     // Pen is used to paint 4Pixels - 1 Pixel - Ring and FastCross types.
00617     // make sure to use the brush color - see above in those cases.
00618     const bool isFourPixels = (markerAttributes.markerStyle() == MarkerAttributes::Marker4Pixels);
00619     if( isFourPixels || (markerAttributes.markerStyle() == MarkerAttributes::Marker1Pixel) ){
00620         // for high-performance point charts with tiny point markers:
00621         painter->setPen( PrintingParameters::scalePen( QPen( brush.color().light() ) ) );
00622         if( isFourPixels ){
00623             const qreal x = pos.x();
00624             const qreal y = pos.y();
00625             painter->drawLine( QPointF(x-1.0,y-1.0),
00626                                QPointF(x+1.0,y-1.0) );
00627             painter->drawLine( QPointF(x-1.0,y),
00628                                QPointF(x+1.0,y) );
00629             painter->drawLine( QPointF(x-1.0,y+1.0),
00630                                QPointF(x+1.0,y+1.0) );
00631         }
00632         painter->drawPoint( pos );
00633     }else{
00634         const PainterSaver painterSaver( painter );
00635         // we only a solid line surrounding the markers
00636         QPen painterPen( pen );
00637         painterPen.setStyle( Qt::SolidLine );
00638         painter->setPen( PrintingParameters::scalePen( painterPen ) );
00639         painter->setBrush( brush );
00640         painter->setRenderHint ( QPainter::Antialiasing );
00641         painter->translate( pos );
00642         switch ( markerAttributes.markerStyle() ) {
00643             case MarkerAttributes::MarkerCircle:
00644                 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
00645                             maSize.height(), maSize.width()) );
00646                 break;
00647             case MarkerAttributes::MarkerSquare:
00648                 {
00649                     QRectF rect( 0 - maSize.width()/2, 0 - maSize.height()/2,
00650                                 maSize.width(), maSize.height() );
00651                     painter->drawRect( rect );
00652                     break;
00653                 }
00654             case MarkerAttributes::MarkerDiamond:
00655                 {
00656                     QVector <QPointF > diamondPoints;
00657                     QPointF top, left, bottom, right;
00658                     top    = QPointF( 0, 0 - maSize.height()/2 );
00659                     left   = QPointF( 0 - maSize.width()/2, 0 );
00660                     bottom = QPointF( 0, maSize.height()/2 );
00661                     right  = QPointF( maSize.width()/2, 0 );
00662                     diamondPoints << top << left << bottom << right;
00663                     painter->drawPolygon( diamondPoints );
00664                     break;
00665                 }
00666             // both handled on top of the method:
00667             case MarkerAttributes::Marker1Pixel:
00668             case MarkerAttributes::Marker4Pixels:
00669                     break;
00670             case MarkerAttributes::MarkerRing:
00671                 {
00672                     painter->setPen( PrintingParameters::scalePen( QPen( brush.color() ) ) );
00673                     painter->setBrush( Qt::NoBrush );
00674                     painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
00675                                         maSize.height(), maSize.width()) );
00676                     break;
00677                 }
00678             case MarkerAttributes::MarkerCross:
00679                 {
00680                     // Note: Markers can have outline,
00681                     //       so just drawing two rects is NOT the solution here!
00682                     const qreal w02 = maSize.width() * 0.2;
00683                     const qreal w05 = maSize.width() * 0.5;
00684                     const qreal h02 = maSize.height()* 0.2;
00685                     const qreal h05 = maSize.height()* 0.5;
00686                     QVector <QPointF > crossPoints;
00687                     QPointF p[12];
00688                     p[ 0] = QPointF( -w02, -h05 );
00689                     p[ 1] = QPointF(  w02, -h05 );
00690                     p[ 2] = QPointF(  w02, -h02 );
00691                     p[ 3] = QPointF(  w05, -h02 );
00692                     p[ 4] = QPointF(  w05,  h02 );
00693                     p[ 5] = QPointF(  w02,  h02 );
00694                     p[ 6] = QPointF(  w02,  h05 );
00695                     p[ 7] = QPointF( -w02,  h05 );
00696                     p[ 8] = QPointF( -w02,  h02 );
00697                     p[ 9] = QPointF( -w05,  h02 );
00698                     p[10] = QPointF( -w05, -h02 );
00699                     p[11] = QPointF( -w02, -h02 );
00700                     for( int i=0; i<12; ++i )
00701                         crossPoints << p[i];
00702                     crossPoints << p[0];
00703                     painter->drawPolygon( crossPoints );
00704                     break;
00705                 }
00706             case MarkerAttributes::MarkerFastCross:
00707                 {
00708                     QPointF left, right, top, bottom;
00709                     left  = QPointF( -maSize.width()/2, 0 );
00710                     right = QPointF( maSize.width()/2, 0 );
00711                     top   = QPointF( 0, -maSize.height()/2 );
00712                     bottom= QPointF( 0, maSize.height()/2 );
00713                     painter->setPen( PrintingParameters::scalePen( QPen( brush.color() ) ) );
00714                     painter->drawLine( left, right );
00715                     painter->drawLine(  top, bottom );
00716                     break;
00717                 }
00718             default:
00719                 Q_ASSERT_X ( false, "paintMarkers()",
00720                             "Type item does not match a defined Marker Type." );
00721         }
00722     }
00723     painter->setPen( oldPen );
00724 }

void AbstractDiagram::paintMarkers ( QPainter *  painter  )  [protected, virtual, inherited]

This method is obsolete and provided for backward-compatibility only.

Your own diagram classes should call d->paintDataValueTextsAndMarkers() instead which also is taking care for showing your cell-specific comments, if any,

Definition at line 726 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractCoordinatePlane::translate().

00727 {
00728     if ( !checkInvariants() ) return;
00729     const int rowCount = model()->rowCount(rootIndex());
00730     const int columnCount = model()->columnCount(rootIndex());
00731     for ( int i=datasetDimension()-1; i<columnCount; i += datasetDimension() ) {
00732        for ( int j=0; j< rowCount; ++j ) {
00733            const QModelIndex index = model()->index( j, i, rootIndex() );
00734            double value = model()->data( index ).toDouble();
00735            const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
00736            paintMarker( painter, index, pos );
00737        }
00738     }
00739 }

QPen AbstractDiagram::pen ( const QModelIndex &  index  )  const [inherited]

Retrieve the pen to be used, for painting the datapoint at the given index in the model.

Parameters:
index The index of the datapoint in the model. With a dataset dimension of two, this is the index of the key of each key/value pair.
Returns:
The pen to use for painting.

Definition at line 792 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetPenRole.

00793 {
00794     return qVariantValue<QPen>(
00795         attributesModel()->data(
00796             conditionallyMapFromSource( index ),
00797             DatasetPenRole ) );
00798 }

QPen AbstractDiagram::pen ( int  dataset  )  const [inherited]

Retrieve the pen to be used for the given dataset.

This will fall back automatically to what was set at model level, if there are no dataset specific settings.

Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.

Definition at line 777 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::datasetDimension(), KDChart::DatasetPenRole, and KDChart::AbstractDiagram::pen().

00778 {
00779     // To store the pen for a dataset, we use the first column
00780     // that's associated with it. (i.e., with a dataset dimension
00781     // of two, the column of the keys)
00782     const int column = dataset * datasetDimension();
00783     
00784     const QVariant penSettings(
00785             attributesModel()->headerData( column, Qt::Vertical,
00786                     DatasetPenRole ) );
00787     if( penSettings.isValid() )
00788         return qVariantValue< QPen >( penSettings );
00789     return pen();
00790 }

QPen AbstractDiagram::pen (  )  const [inherited]

Retrieve the pen to be used for painting datapoints globally.

This will fall back automatically to the default settings, if there are no specific settings.

Returns:
The pen to use for painting.

Definition at line 771 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetPenRole.

Referenced by KDChart::AbstractDiagram::datasetPens(), KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::LeveyJenningsDiagram::paint(), and KDChart::AbstractDiagram::pen().

00772 {
00773     return qVariantValue<QPen>(
00774         attributesModel()->data( DatasetPenRole ) );
00775 }

bool AbstractDiagram::percentMode (  )  const [inherited]

Definition at line 533 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::compare().

00534 {
00535     return d->percent;
00536 }

void KDChart::AbstractDiagram::propertiesChanged (  )  [signal, inherited]

Emitted upon change of a property of the Diagram.

Referenced by KDChart::Plotter::resetLineAttributes(), KDChart::LineDiagram::resetLineAttributes(), KDChart::AbstractDiagram::setAllowOverlappingDataValueTexts(), KDChart::AbstractDiagram::setAntiAliasing(), KDChart::BarDiagram::setBarAttributes(), KDChart::AbstractDiagram::setBrush(), KDChart::LineDiagram::setCenterDataPoints(), KDChart::AbstractDiagram::setDataValueAttributes(), KDChart::Plotter::setLineAttributes(), KDChart::LineDiagram::setLineAttributes(), KDChart::BarDiagram::setOrientation(), KDChart::AbstractDiagram::setPen(), KDChart::AbstractDiagram::setPercentMode(), StockDiagram::setStockBarAttributes(), StockDiagram::setThreeDBarAttributes(), KDChart::BarDiagram::setThreeDBarAttributes(), KDChart::Plotter::setThreeDLineAttributes(), KDChart::LineDiagram::setThreeDLineAttributes(), StockDiagram::setType(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), KDChart::BarDiagram::setType(), KDChart::Plotter::setValueTrackerAttributes(), and KDChart::LineDiagram::setValueTrackerAttributes().

AbstractCartesianDiagram * AbstractCartesianDiagram::referenceDiagram (  )  const [virtual]

Returns:
this diagram's reference diagram

See also:
setReferenceDiagram

Definition at line 170 of file KDChartAbstractCartesianDiagram.cpp.

References d.

Referenced by compare(), KDChart::CartesianCoordinatePlane::getDataDimensionsList(), KDChart::CartesianAxis::paintCtx(), referenceDiagramIsBarDiagram(), and referenceDiagramNeedsCenteredAbscissaTicks().

00171 {
00172     return d->referenceDiagram;
00173 }

QPointF AbstractCartesianDiagram::referenceDiagramOffset (  )  const [virtual]

Returns:
the relative offset of this diagram's reference diagram

See also:
setReferenceDiagram

Definition at line 175 of file KDChartAbstractCartesianDiagram.cpp.

References d.

Referenced by compare().

00176 {
00177     return d->referenceDiagramOffset;
00178 }

virtual void KDChart::AbstractDiagram::resize ( const QSizeF &  area  )  [pure virtual, inherited]

Called by the widget's sizeEvent.

Adjust all internal structures, that are calculated, dependending on the size of the widget.

Parameters:
area 

Implemented in KDChart::BarDiagram, KDChart::LineDiagram, KDChart::PieDiagram, KDChart::Plotter, KDChart::PolarDiagram, KDChart::RingDiagram, KDChart::StockDiagram, KDChart::TernaryLineDiagram, and KDChart::TernaryPointDiagram.

Referenced by KDChart::CartesianCoordinatePlane::setGeometry().

void AbstractDiagram::scrollTo ( const QModelIndex &  index,
ScrollHint  hint = EnsureVisible 
) [virtual, inherited]

[reimplemented]

Definition at line 950 of file KDChartAbstractDiagram.cpp.

00951 {}

void AbstractDiagram::setAllowOverlappingDataValueTexts ( bool  allow  )  [inherited]

Set whether data value labels are allowed to overlap.

Parameters:
allow True means that overlapping labels are allowed.

Definition at line 505 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::propertiesChanged().

00506 {
00507     d->allowOverlappingDataValueTexts = allow;
00508     emit propertiesChanged();
00509 }

void AbstractDiagram::setAntiAliasing ( bool  enabled  )  [inherited]

Set whether anti-aliasing is to be used while rendering this diagram.

Parameters:
enabled True means that AA is enabled.

Definition at line 516 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::propertiesChanged().

00517 {
00518     d->antiAliasing = enabled;
00519     emit propertiesChanged();
00520 }

void AbstractCartesianDiagram::setAttributesModel ( AttributesModel amodel  )  [virtual]

Associate an AttributesModel with this diagram.

Note that the diagram does _not_ take ownership of the AttributesModel. This should thus only be used with AttributesModels that have been explicitly created by the user, and are owned by her. Setting an AttributesModel that is internal to another diagram is an error.

Correct:

 AttributesModel *am = new AttributesModel( model, 0 );
 diagram1->setAttributesModel( am );
 diagram2->setAttributesModel( am );

Wrong:

 diagram1->setAttributesModel( diagram2->attributesModel() );

Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel, usesExternalAttributesModel
Sets an external AttributesModel on this diagram. By default, a diagram has it's own internal set of attributes, but an external one can be set. This can be used to share attributes between several diagrams. The diagram does not take ownership of the attributesmodel.

Reimplemented from KDChart::AbstractDiagram.

Definition at line 192 of file KDChartAbstractCartesianDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), d, and KDChart::AbstractDiagram::setAttributesModel().

00193 {
00194     AbstractDiagram::setAttributesModel( model );
00195     d->compressor.setModel( attributesModel() );
00196 }

void AbstractDiagram::setAttributesModelRootIndex ( const QModelIndex &  idx  )  [protected, inherited]

Definition at line 336 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::setDataBoundariesDirty().

Referenced by KDChart::AbstractDiagram::setRootIndex().

00337 {
00338     d->attributesModelRootIndex=idx;
00339     setDataBoundariesDirty();
00340     scheduleDelayedItemsLayout();
00341 }

void AbstractDiagram::setBrush ( const QBrush &  brush  )  [inherited]

Set the brush to be used, for painting all datasets in the model.

Parameters:
brush The brush to use.

Definition at line 808 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setModelData().

00809 {
00810     attributesModel()->setModelData(
00811         qVariantFromValue( brush ), DatasetBrushRole );
00812     emit propertiesChanged();
00813 }

void AbstractDiagram::setBrush ( int  dataset,
const QBrush &  brush 
) [inherited]

Set the brush to be used, for painting the given dataset.

Parameters:
dataset The dataset to set the brush for.
brush The brush to use.

Definition at line 815 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setHeaderData().

00816 {
00817     // To store the brush for a dataset, we use the first column
00818     // that's associated with it. (i.e., with a dataset dimension
00819     // of two, the column of the keys)
00820     const int column = dataset * datasetDimension();
00821     
00822     attributesModel()->setHeaderData(
00823         column, Qt::Vertical,
00824         qVariantFromValue( brush ),
00825         DatasetBrushRole );
00826     emit propertiesChanged();
00827 }

void AbstractDiagram::setBrush ( const QModelIndex &  index,
const QBrush &  brush 
) [inherited]

Set the brush to be used, for painting the datapoint at the given index.

Parameters:
index The datapoint's index in the model. With a dataset dimension of two, this is the index of the key of each key/value pair.
brush The brush to use.

Definition at line 800 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setData().

00801 {
00802     attributesModel()->setData(
00803         conditionallyMapFromSource( index ),
00804         qVariantFromValue( brush ), DatasetBrushRole );
00805     emit propertiesChanged();
00806 }

void KDChart::AbstractCartesianDiagram::setCoordinatePlane ( AbstractCoordinatePlane plane  )  [virtual]

[reimplemented]

Reimplemented from KDChart::AbstractDiagram.

Definition at line 126 of file KDChartAbstractCartesianDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::coordinatePlane(), and KDChart::AbstractDiagram::setCoordinatePlane().

00127 {
00128     if( coordinatePlane() ) {
00129         disconnect( attributesModel(), SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ),
00130                  coordinatePlane(), SLOT( relayout() ) );
00131         disconnect( attributesModel(), SIGNAL( rowsInserted( const QModelIndex&, int, int ) ),
00132                  coordinatePlane(), SLOT( relayout() ) );
00133         disconnect( attributesModel(), SIGNAL( columnsRemoved( const QModelIndex&, int, int ) ),
00134                  coordinatePlane(), SLOT( relayout() ) );
00135         disconnect( attributesModel(), SIGNAL( columnsInserted( const QModelIndex&, int, int ) ),
00136                  coordinatePlane(), SLOT( relayout() ) );
00137         disconnect( coordinatePlane() );
00138     }
00139     
00140     AbstractDiagram::setCoordinatePlane(plane);
00141     if ( plane ) {
00142         // Readjust the layout when the dataset count changes
00143         connect( attributesModel(), SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ),
00144                  plane, SLOT( relayout() ), Qt::QueuedConnection );
00145         connect( attributesModel(), SIGNAL( rowsInserted( const QModelIndex&, int, int ) ),
00146                  plane, SLOT( relayout() ), Qt::QueuedConnection );
00147         connect( attributesModel(), SIGNAL( columnsRemoved( const QModelIndex&, int, int ) ),
00148                  plane, SLOT( relayout() ), Qt::QueuedConnection );
00149         connect( attributesModel(), SIGNAL( columnsInserted( const QModelIndex&, int, int ) ),
00150                  plane, SLOT( relayout() ), Qt::QueuedConnection );
00151     }
00152     // show the axes, after all have been layoutPlanes
00153     // (because they might depend on each other)
00154     /*
00155     if( plane )
00156         Q_FOREACH( CartesianAxis* axis, d->axesList )
00157             axis->show();
00158     else
00159         Q_FOREACH( CartesianAxis* axis, d->axesList )
00160             axis->hide();
00161     */
00162 }

void AbstractDiagram::setDataBoundariesDirty (  )  const [protected, slot, inherited]

Definition at line 236 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::dataChanged(), StockDiagram::resize(), KDChart::Plotter::resize(), KDChart::LineDiagram::resize(), KDChart::BarDiagram::resize(), KDChart::AbstractDiagram::setAttributesModel(), KDChart::AbstractDiagram::setAttributesModelRootIndex(), KDChart::AbstractDiagram::setDatasetDimensionInternal(), KDChart::AbstractDiagram::setModel(), KDChart::BarDiagram::setOrientation(), KDChart::BarDiagram::setThreeDBarAttributes(), KDChart::Plotter::setThreeDLineAttributes(), KDChart::LineDiagram::setThreeDLineAttributes(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().

00237 {
00238     d->databoundariesDirty = true;
00239 }

void AbstractDiagram::setDatasetDimension ( int  dimension  )  [inherited]

Sets the dataset dimension of the diagram. Using this method is obsolete. Use the specific diagram types instead.

Definition at line 1094 of file KDChartAbstractDiagram.cpp.

01095 {
01096     Q_UNUSED( dimension );
01097     qDebug() << "Setting the dataset dimension using AbstractDiagram::setDatasetDimension is obsolete. Use the specific diagram types instead.";
01098 }

void AbstractDiagram::setDatasetDimensionInternal ( int  dimension  )  [protected, inherited]

Definition at line 1100 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::layoutChanged(), and KDChart::AbstractDiagram::setDataBoundariesDirty().

Referenced by KDChart::TernaryLineDiagram::TernaryLineDiagram(), and KDChart::TernaryPointDiagram::TernaryPointDiagram().

01101 {
01102     Q_ASSERT( dimension != 0 );
01103     
01104     if ( d->datasetDimension == dimension ) return;
01105     d->datasetDimension = dimension;
01106     setDataBoundariesDirty();
01107     emit layoutChanged( this );
01108 }

void AbstractDiagram::setDataValueAttributes ( const DataValueAttributes a  )  [inherited]

Set the DataValueAttributes for all datapoints in the model.

Parameters:
a The attributes to set.

Definition at line 499 of file KDChartAbstractDiagram.cpp.

References d, KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().

00500 {
00501     d->attributesModel->setModelData( qVariantFromValue( a ), DataValueLabelAttributesRole );
00502     emit propertiesChanged();
00503 }

void AbstractDiagram::setDataValueAttributes ( int  dataset,
const DataValueAttributes a 
) [inherited]

Set the DataValueAttributes for the given dataset.

Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.

Definition at line 447 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::datasetDimension(), KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().

00448 {
00449     // To store the attributes for a dataset, we use the first column
00450     // that's associated with it. (i.e., with a dataset dimension
00451     // of two, the column of the keys)
00452     const int column = dataset * datasetDimension();
00453     d->attributesModel->setHeaderData(
00454         column, Qt::Vertical,
00455         qVariantFromValue( a ), DataValueLabelAttributesRole );
00456     emit propertiesChanged();
00457 }

void AbstractDiagram::setDataValueAttributes ( const QModelIndex &  index,
const DataValueAttributes a 
) [inherited]

Set the DataValueAttributes for the given index.

Parameters:
index The datapoint to set the attributes for. With a dataset dimension of two, this is the index of the key of each key/value pair.
a The attributes to set.

Definition at line 436 of file KDChartAbstractDiagram.cpp.

References d, KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().

00438 {
00439     d->attributesModel->setData(
00440         conditionallyMapFromSource( index ),
00441         qVariantFromValue( a ),
00442         DataValueLabelAttributesRole );
00443     emit propertiesChanged();
00444 }

void AbstractDiagram::setHidden ( bool  hidden  )  [inherited]

Hide (or unhide, resp.

) all datapoints in the model.

Note:
Hidden data are still taken into account by the coordinate plane, so neither the grid nor your axes' ranges will change, when you hide data. For totally removing data from KD Chart's view you can use another approach: e.g. you could define a proxy model on top of your data model, and register the proxy model calling setModel() instead of registering your real data model.
Parameters:
hidden The hidden status to set.

Definition at line 399 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::dataHidden(), and KDChart::DataHiddenRole.

00400 {
00401     d->attributesModel->setModelData(
00402         qVariantFromValue( hidden ),
00403         DataHiddenRole );
00404     emit dataHidden();
00405 }

void AbstractDiagram::setHidden ( int  dataset,
bool  hidden 
) [inherited]

Hide (or unhide, resp.

) a dataset.

Note:
Hidden data are still taken into account by the coordinate plane, so neither the grid nor your axes' ranges will change, when you hide data. For totally removing data from KD Chart's view you can use another approach: e.g. you could define a proxy model on top of your data model, and register the proxy model calling setModel() instead of registering your real data model.
Parameters:
dataset The dataset to set the hidden status for.
hidden The hidden status to set.

Definition at line 386 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::dataHidden(), KDChart::DataHiddenRole, and KDChart::AbstractDiagram::datasetDimension().

00387 {
00388     // To store the flag for a dataset, we use the first column
00389     // that's associated with it. (i.e., with a dataset dimension
00390     // of two, the column of the keys)
00391     const int column = dataset * datasetDimension();
00392     d->attributesModel->setHeaderData(
00393         column, Qt::Vertical,
00394         qVariantFromValue( hidden ),
00395         DataHiddenRole );
00396     emit dataHidden();
00397 }

void AbstractDiagram::setHidden ( const QModelIndex &  index,
bool  hidden 
) [inherited]

Hide (or unhide, resp.

) a data cell.

Note:
Hidden data are still taken into account by the coordinate plane, so neither the grid nor your axes' ranges will change, when you hide data. For totally removing data from KD Chart's view you can use another approach: e.g. you could define a proxy model on top of your data model, and register the proxy model calling setModel() instead of registering your real data model.
Parameters:
index The datapoint to set the hidden status for. With a dataset dimension of two, this is the index of the key of each key/value pair.
hidden The hidden status to set.

Definition at line 377 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::dataHidden(), and KDChart::DataHiddenRole.

00378 {
00379     d->attributesModel->setData(
00380         conditionallyMapFromSource( index ),
00381         qVariantFromValue( hidden ),
00382         DataHiddenRole );
00383     emit dataHidden();
00384 }

void AbstractCartesianDiagram::setModel ( QAbstractItemModel *  model  )  [virtual]

Associate a model with the diagram.

Reimplemented from KDChart::AbstractDiagram.

Reimplemented in KDChart::LeveyJenningsDiagram.

Definition at line 186 of file KDChartAbstractCartesianDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), d, and KDChart::AbstractDiagram::setModel().

Referenced by KDChart::LeveyJenningsDiagram::setModel().

00187 {
00188     AbstractDiagram::setModel( model );
00189     d->compressor.setModel( attributesModel() );
00190 }

void AbstractDiagram::setPen ( const QPen &  pen  )  [inherited]

Set the pen to be used, for painting all datasets in the model.

Parameters:
pen The pen to use.

Definition at line 750 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setModelData().

00751 {
00752     attributesModel()->setModelData(
00753         qVariantFromValue( pen ), DatasetPenRole );
00754     emit propertiesChanged();
00755 }

void AbstractDiagram::setPen ( int  dataset,
const QPen &  pen 
) [inherited]

Set the pen to be used, for painting the given dataset.

Parameters:
dataset The dataset to set the pen for.
pen The pen to use.

Definition at line 757 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::datasetDimension(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setHeaderData().

00758 {
00759     // To store the pen for a dataset, we use the first column
00760     // that's associated with it. (i.e., with a dataset dimension
00761     // of two, the column of the keys)
00762     const int column = dataset * datasetDimension();
00763     
00764     attributesModel()->setHeaderData(
00765         column, Qt::Vertical,
00766         qVariantFromValue( pen ),
00767         DatasetPenRole );
00768     emit propertiesChanged();
00769 }

void AbstractDiagram::setPen ( const QModelIndex &  index,
const QPen &  pen 
) [inherited]

Set the pen to be used, for painting the datapoint at the given index.

Parameters:
index The datapoint's index in the model. With a dataset dimension of two, this is the index of the key of each key/value pair.
pen The pen to use.

Definition at line 742 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setData().

Referenced by StockDiagram::init().

00743 {
00744     attributesModel()->setData(
00745         conditionallyMapFromSource( index ),
00746         qVariantFromValue( pen ), DatasetPenRole );
00747     emit propertiesChanged();
00748 }

void AbstractDiagram::setPercentMode ( bool  percent  )  [inherited]

Definition at line 527 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::propertiesChanged().

Referenced by KDChart::BarDiagram::setOrientation(), KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().

00528 {
00529     d->percent = percent;
00530     emit propertiesChanged();
00531 }

void AbstractCartesianDiagram::setReferenceDiagram ( AbstractCartesianDiagram diagram,
const QPointF &  offset = QPointF() 
) [virtual]

Makes this diagram use another diagram diagram as reference diagram with relative offset offset.

To share cartesian axes between different diagrams there might be cases when you need that. Normally you don't.

See also:
examples/SharedAbscissa

Definition at line 164 of file KDChartAbstractCartesianDiagram.cpp.

References d.

00165 {
00166     d->referenceDiagram = diagram;
00167     d->referenceDiagramOffset = offset;
00168 }

void AbstractCartesianDiagram::setRootIndex ( const QModelIndex &  idx  )  [virtual]

Set the root index in the model, where the diagram starts referencing data for display.

[reimplemented]

Reimplemented from KDChart::AbstractDiagram.

Definition at line 180 of file KDChartAbstractCartesianDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), d, and KDChart::AbstractDiagram::setRootIndex().

00181 {
00182     AbstractDiagram::setRootIndex( index );
00183     d->compressor.setRootIndex( attributesModel()->mapFromSource( index ) );
00184 }

void AbstractDiagram::setSelection ( const QRect &  rect,
QItemSelectionModel::SelectionFlags  command 
) [virtual, inherited]

[reimplemented]

Definition at line 967 of file KDChartAbstractDiagram.cpp.

References d.

00968 {
00969     const QModelIndexList indexes = d->indexesIn( rect );
00970     QItemSelection selection;
00971     KDAB_FOREACH( const QModelIndex& index, indexes )
00972     {
00973         selection.append( QItemSelectionRange( index ) );
00974     }
00975     selectionModel()->select( selection, command );
00976 }

void AbstractDiagram::setSelectionModel ( QItemSelectionModel *  selectionModel  )  [virtual, inherited]

Associate a seleection model with the diagrom.

Definition at line 269 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::modelsChanged().

00270 {
00271     if( selectionModel() )
00272     {
00273         disconnect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( modelsChanged() ) );
00274         disconnect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SIGNAL( modelsChanged() ) );
00275     }
00276     QAbstractItemView::setSelectionModel( newSelectionModel );
00277     if( selectionModel() )
00278     {
00279         connect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( modelsChanged() ) );
00280         connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SIGNAL( modelsChanged() ) );
00281     }
00282     emit modelsChanged();
00283 }

void AbstractDiagram::setUnitPrefix ( const QString &  prefix,
Qt::Orientation  orientation 
) [inherited]

Set the unit prefix to be used on axes for all columns.

Sets the unit prefix for all values.

Parameters:
prefix The prefix to be used.
orientation The orientation of the axis to use.
prefix the prefix to be set
orientation the orientantion of the axis to set

Definition at line 872 of file KDChartAbstractDiagram.cpp.

References d.

00873 {
00874     d->unitPrefix[ orientation ] = prefix;
00875 }

void AbstractDiagram::setUnitPrefix ( const QString &  prefix,
int  column,
Qt::Orientation  orientation 
) [inherited]

Set the unit prefix to be used on axes for one specific column.

Sets the unit prefix for one value.

Parameters:
prefix The prefix to be used.
column The column which should be set.
orientation The orientation of the axis to use.
prefix the prefix to be set
column the value using that prefix
orientation the orientantion of the axis to set

Definition at line 862 of file KDChartAbstractDiagram.cpp.

References d.

00863 {
00864     d->unitPrefixMap[ column ][ orientation ]= prefix;
00865 }

void AbstractDiagram::setUnitSuffix ( const QString &  suffix,
Qt::Orientation  orientation 
) [inherited]

Set the unit prefix to be used on axes for all columns.

Sets the unit suffix for all values.

Parameters:
suffix The suffix to be used.
orientation The orientation of the axis to use.
suffix the suffix to be set
orientation the orientantion of the axis to set

Definition at line 893 of file KDChartAbstractDiagram.cpp.

References d.

00894 {
00895     d->unitSuffix[ orientation ] = suffix;
00896 }

void AbstractDiagram::setUnitSuffix ( const QString &  suffix,
int  column,
Qt::Orientation  orientation 
) [inherited]

Set the unit prefix to be used on axes for one specific column.

Sets the unit suffix for one value.

Parameters:
suffix The suffix to be used.
column The column which should be set.
orientation The orientation of the axis to use.
suffix the suffix to be set
column the value using that suffix
orientation the orientantion of the axis to set

Definition at line 883 of file KDChartAbstractDiagram.cpp.

References d.

00884 {
00885     d->unitSuffixMap[ column ][ orientation ]= suffix;
00886 }

void AbstractCartesianDiagram::takeAxis ( CartesianAxis axis  )  [virtual]

Removes the axis from the diagram, without deleting it.

The diagram no longer owns the axis, so it is the caller's responsibility to delete the axis.

See also:
addAxis

Definition at line 101 of file KDChartAbstractCartesianDiagram.cpp.

References d, KDChart::AbstractAxis::deleteObserver(), layoutPlanes(), and KDChart::AbstractLayoutItem::setParentWidget().

Referenced by KDChart::Widget::setType(), KDChart::CartesianAxis::~CartesianAxis(), and KDChart::LeveyJenningsAxis::~LeveyJenningsAxis().

00102 {
00103     const int idx = d->axesList.indexOf( axis );
00104     if( idx != -1 )
00105         d->axesList.takeAt( idx );
00106     axis->deleteObserver( this );
00107     axis->setParentWidget( 0 );
00108     layoutPlanes();
00109 }

virtual double KDChart::AbstractCartesianDiagram::threeDItemDepth ( int  column  )  const [protected, pure virtual]

Returns:
the 3D item depth of the data set column

Implemented in KDChart::BarDiagram, KDChart::LineDiagram, KDChart::Plotter, and KDChart::StockDiagram.

virtual double KDChart::AbstractCartesianDiagram::threeDItemDepth ( const QModelIndex &  index  )  const [protected, pure virtual]

Returns:
the 3D item depth of the model index index

Implemented in KDChart::BarDiagram, KDChart::LineDiagram, KDChart::Plotter, and KDChart::StockDiagram.

QString AbstractDiagram::unitPrefix ( Qt::Orientation  orientation  )  const [inherited]

Retrieves the axis unit prefix.

Returns the global unit prefix.

Parameters:
orientation The orientation of the axis.
Returns:
The axis unit prefix.
Parameters:
orientation the orientation of the axis
Returns:
the unit prefix

Definition at line 916 of file KDChartAbstractDiagram.cpp.

References d.

00917 {
00918     return d->unitPrefix[ orientation ];
00919 }

QString AbstractDiagram::unitPrefix ( int  column,
Qt::Orientation  orientation,
bool  fallback = false 
) const [inherited]

Retrieves the axis unit prefix for a specific column.

Returns the unit prefix for a special value.

Parameters:
column The column whose prefix should be retrieved.
orientation The orientation of the axis.
fallback If true, the prefix for all columns is returned, when none is set for the selected column.
Returns:
The axis unit prefix.
Parameters:
column the value which's prefix is requested
orientation the orientation of the axis
fallback if true, the global prefix is return when no specific one is set for that value
Returns:
the unit prefix

Definition at line 905 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::itemRowLabels(), and KDChart::CartesianAxis::paintCtx().

00906 {
00907     if( !fallback || d->unitPrefixMap[ column ].contains( orientation ) )
00908         return d->unitPrefixMap[ column ][ orientation ];
00909     return d->unitPrefix[ orientation ];
00910 }

QString AbstractDiagram::unitSuffix ( Qt::Orientation  orientation  )  const [inherited]

Retrieves the axis unit suffix.

Returns the global unit suffix.

Parameters:
orientation The orientation of the axis.
Returns:
The axis unit suffix.
Parameters:
orientation the orientation of the axis
Returns:
the unit siffix

Definition at line 939 of file KDChartAbstractDiagram.cpp.

References d.

00940 {
00941     return d->unitSuffix[ orientation ];
00942 }

QString AbstractDiagram::unitSuffix ( int  column,
Qt::Orientation  orientation,
bool  fallback = false 
) const [inherited]

Retrieves the axis unit suffix for a specific column.

Returns the unit suffix for a special value.

Parameters:
column The column whose prefix should be retrieved.
orientation The orientation of the axis.
fallback If true, the suffix for all columns is returned, when none is set for the selected column.
Returns:
The axis unit suffix.
Parameters:
column the value which's suffix is requested
orientation the orientation of the axis
fallback if true, the global suffix is return when no specific one is set for that value
Returns:
the unit suffix

Definition at line 928 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::itemRowLabels(), and KDChart::CartesianAxis::paintCtx().

00929 {
00930     if( !fallback || d->unitSuffixMap[ column ].contains( orientation ) )
00931         return d->unitSuffixMap[ column ][ orientation ];
00932     return d->unitSuffix[ orientation ];
00933 }

void AbstractDiagram::update (  )  const [inherited]

Definition at line 1116 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::doItemsLayout(), KDChart::LeveyJenningsDiagram::setExpectedMeanValue(), KDChart::LeveyJenningsDiagram::setExpectedStandardDeviation(), KDChart::LeveyJenningsDiagram::setFluidicsPackChangedSymbolPosition(), KDChart::LeveyJenningsDiagram::setFluidicsPackChanges(), KDChart::LeveyJenningsDiagram::setLotChangedSymbolPosition(), KDChart::LeveyJenningsDiagram::setScanLinePen(), KDChart::LeveyJenningsDiagram::setSensorChangedSymbolPosition(), KDChart::LeveyJenningsDiagram::setSensorChanges(), KDChart::LeveyJenningsDiagram::setSymbol(), and KDChart::LeveyJenningsDiagram::setTimeRange().

01117 {
01118     //qDebug("KDChart::AbstractDiagram::update() called");
01119     if( d->plane )
01120         d->plane->update();
01121 }

void KDChart::AbstractDiagram::useDefaultColors (  )  [inherited]

Set the palette to be used, for painting datasets to the default palette.

See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method

Definition at line 994 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AttributesModel::PaletteTypeDefault.

00995 {
00996     d->attributesModel->setPaletteType( AttributesModel::PaletteTypeDefault );
00997 }

void KDChart::AbstractDiagram::useRainbowColors (  )  [inherited]

Set the palette to be used, for painting datasets to the rainbow palette.

See also:
KDChart::Palette.

Definition at line 1004 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AttributesModel::PaletteTypeRainbow.

01005 {
01006     d->attributesModel->setPaletteType( AttributesModel::PaletteTypeRainbow );
01007 }

bool AbstractDiagram::usesExternalAttributesModel (  )  const [virtual, inherited]

Returns whether the diagram is using its own built-in attributes model or an attributes model that was set via setAttributesModel.

See also:
setAttributesModel

Definition at line 309 of file KDChartAbstractDiagram.cpp.

References d.

00310 {
00311     return d->usesExternalAttributesModel();
00312 }

void KDChart::AbstractDiagram::useSubduedColors (  )  [inherited]

Set the palette to be used, for painting datasets to the subdued palette.

See also:
KDChart::Palette.

Definition at line 999 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AttributesModel::PaletteTypeSubdued.

01000 {
01001     d->attributesModel->setPaletteType( AttributesModel::PaletteTypeSubdued );
01002 }

double AbstractDiagram::valueForCell ( int  row,
int  column 
) const [protected, inherited]

Helper method, retrieving the data value (DisplayRole) for a given row and column.

Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
Deprecated:

Definition at line 1110 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.

01111 {
01112     return d->attributesModel->data(
01113             d->attributesModel->index( row, column, attributesModelRootIndex() ) ).toDouble();
01114 }

int AbstractDiagram::verticalOffset (  )  const [virtual, inherited]

[reimplemented]

Definition at line 961 of file KDChartAbstractDiagram.cpp.

00962 { return 0; }

QRect AbstractDiagram::visualRect ( const QModelIndex &  index  )  const [virtual, inherited]

[reimplemented]

Definition at line 945 of file KDChartAbstractDiagram.cpp.

References d.

00946 {
00947     return d->reverseMapper.boundingRect( index.row(), index.column() ).toRect();
00948 }

QRegion AbstractDiagram::visualRegion ( const QModelIndex &  index  )  const [virtual, inherited]

Definition at line 988 of file KDChartAbstractDiagram.cpp.

References d.

00989 {
00990     QPolygonF polygon = d->reverseMapper.polygon(index.row(), index.column());
00991     return polygon.isEmpty() ? QRegion() : QRegion( polygon.toPolygon() );
00992 }

QRegion AbstractDiagram::visualRegionForSelection ( const QItemSelection &  selection  )  const [virtual, inherited]

[reimplemented]

Definition at line 978 of file KDChartAbstractDiagram.cpp.

References d.

00979 {
00980     QPolygonF polygon;
00981     KDAB_FOREACH( const QModelIndex& index, selection.indexes() )
00982     {
00983         polygon << d->reverseMapper.polygon(index.row(), index.column());
00984     }
00985     return polygon.isEmpty() ? QRegion() : QRegion( polygon.toPolygon() );
00986 }


The documentation for this class was generated from the following files:
Generated on Thu Mar 4 23:25:24 2010 for KD Chart 2 by  doxygen 1.5.4