#include <KDChartTernaryPointDiagram.h>
Inheritance diagram for KDChart::TernaryPointDiagram:
Definition at line 41 of file KDChartTernaryPointDiagram.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 | |
bool | allowOverlappingDataValueTexts () const |
| |
bool | antiAliasing () const |
| |
virtual AttributesModel * | attributesModel () const |
Returns the AttributesModel, that is used by this 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. | |
AbstractCoordinatePlane * | coordinatePlane () 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< MarkerAttributes > | datasetMarkers () 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 column) const |
Retrieve the DataValueAttributes for the given dataset. | |
DataValueAttributes | dataValueAttributes () const |
Retrieve the DataValueAttributes speficied 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 column) const |
Retrieve the hidden status for the given dataset. | |
bool | isHidden () const |
Retrieve the hidden status speficied 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 QModelIndex | moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) |
[reimplemented] | |
virtual void | paint (PaintContext *paintContext) |
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) |
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 void | resize (const QSizeF &area) |
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. | |
virtual 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) |
Set the coordinate plane associated with the diagram. | |
void | setDatasetDimension (int dimension) |
Sets the dataset dimension of the diagram. | |
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 column, bool hidden) |
Hide (or unhide, resp. | |
void | setHidden (const QModelIndex &index, bool hidden) |
Hide (or unhide, resp. | |
virtual 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 | setRootIndex (const QModelIndex &idx) |
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] | |
void | setUnitPrefix (const QString &prefix, Qt::Orientation orientation) |
Sets the unit prefix for all values. | |
void | setUnitPrefix (const QString &prefix, int column, Qt::Orientation orientation) |
Sets the unit prefix for one value. | |
void | setUnitSuffix (const QString &suffix, Qt::Orientation orientation) |
Sets the unit suffix for all values. | |
void | setUnitSuffix (const QString &suffix, int column, Qt::Orientation orientation) |
Sets the unit suffix for one value. | |
TernaryPointDiagram (QWidget *parent=0, TernaryCoordinatePlane *plane=0) | |
QString | unitPrefix (Qt::Orientation orientation) const |
Returns the global unit prefix. | |
QString | unitPrefix (int column, Qt::Orientation orientation, bool fallback=false) const |
Returns the unit prefix for a special value. | |
QString | unitSuffix (Qt::Orientation orientation) const |
Returns the global unit suffix. | |
QString | unitSuffix (int column, Qt::Orientation orientation, bool fallback=false) const |
Returns the unit suffix for a special value. | |
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 | visualRegionForSelection (const QItemSelection &selection) const |
[reimplemented] | |
virtual | ~TernaryPointDiagram () |
Protected Member Functions | |
QModelIndex | attributesModelRootIndex () const |
virtual const QPair< QPointF, QPointF > | calculateDataBoundaries () const |
virtual bool | checkInvariants (bool justReturnTheStatus=false) const |
QModelIndex | columnToIndex (int column) const |
virtual void | paintDataValueTexts (QPainter *painter) |
virtual void | paintMarkers (QPainter *painter) |
void | setAttributesModelRootIndex (const QModelIndex &) |
void | setDataBoundariesDirty () const |
double | valueForCell (int row, int column) const |
Helper method, retrieving the data value (DisplayRole) for a given row and column. |
TernaryPointDiagram::TernaryPointDiagram | ( | QWidget * | parent = 0 , |
|
TernaryCoordinatePlane * | plane = 0 | |||
) | [explicit] |
Definition at line 50 of file KDChartTernaryPointDiagram.cpp.
References KDChart::AbstractDiagram::setDatasetDimension().
00052 : AbstractTernaryDiagram( new Private(), parent, plane ) 00053 { 00054 init(); 00055 setDatasetDimension( 3 ); // the third column is implicit 00056 }
TernaryPointDiagram::~TernaryPointDiagram | ( | ) | [virtual] |
bool AbstractDiagram::allowOverlappingDataValueTexts | ( | ) | const [inherited] |
Definition at line 440 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractDiagram::compare().
00441 { 00442 return d->allowOverlappingDataValueTexts; 00443 }
bool AbstractDiagram::antiAliasing | ( | ) | const [inherited] |
Definition at line 451 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractDiagram::compare().
00452 { 00453 return d->antiAliasing; 00454 }
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.
Definition at line 280 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::AbstractDiagram::isHidden(), KDChart::AbstractDiagram::itemRowLabels(), KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), KDChart::AbstractDiagram::pen(), KDChart::AbstractCartesianDiagram::setAttributesModel(), KDChart::BarDiagram::setBarAttributes(), KDChart::AbstractDiagram::setBrush(), KDChart::AbstractCartesianDiagram::setModel(), KDChart::AbstractDiagram::setPen(), and KDChart::TernaryLineDiagram::TernaryLineDiagram().
00281 { 00282 return d->attributesModel; 00283 }
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 302 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by 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(), KDChart::AbstractDiagram::valueForCell(), and KDChart::LineDiagram::valueForCellTesting().
00303 { 00304 if ( !d->attributesModelRootIndex.isValid() ) 00305 d->attributesModelRootIndex = d->attributesModel->mapFromSource( rootIndex() ); 00306 return d->attributesModelRootIndex; 00307 }
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.
index | The index of the datapoint in the model. |
Definition at line 838 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::brush(), KDChart::AttributesModel::data(), KDChart::DatasetBrushRole, and KDChart::AbstractDiagram::datasetDimension().
00839 { 00840 if( datasetDimension() > 1 ) 00841 return brush( index.column() ); 00842 return qVariantValue<QBrush>( 00843 attributesModel()->data( 00844 attributesModel()->mapFromSource( index ), 00845 DatasetBrushRole ) ); 00846 }
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.
dataset | The dataset to retrieve the brush for. |
Definition at line 828 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::columnToIndex(), KDChart::AttributesModel::data(), KDChart::DatasetBrushRole, and KDChart::AbstractDiagram::datasetDimension().
00829 { 00830 if( datasetDimension() > 1 ) 00831 dataset /= datasetDimension(); 00832 return qVariantValue<QBrush>( 00833 attributesModel()->data( 00834 attributesModel()->mapFromSource( columnToIndex( dataset ) ), 00835 DatasetBrushRole ) ); 00836 }
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.
Definition at line 822 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetBrushRole.
Referenced by KDChart::AbstractDiagram::brush(), paint(), KDChart::TernaryLineDiagram::paint(), KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), and KDChart::AbstractDiagram::paintMarker().
00823 { 00824 return qVariantValue<QBrush>( 00825 attributesModel()->data( DatasetBrushRole ) ); 00826 }
const QPair< QPointF, QPointF > TernaryPointDiagram::calculateDataBoundaries | ( | ) | const [protected, virtual] |
Implements KDChart::AbstractTernaryDiagram.
Definition at line 134 of file KDChartTernaryPointDiagram.cpp.
References TriangleBottomLeft, TriangleBottomRight, and TriangleHeight.
00135 { 00136 // this is a constant, because we defined it to be one: 00137 static QPair<QPointF, QPointF> Boundaries( 00138 TriangleBottomLeft, 00139 QPointF( TriangleBottomRight.x(), TriangleHeight ) ); 00140 return Boundaries; 00141 }
bool AbstractDiagram::checkInvariants | ( | bool | justReturnTheStatus = false |
) | const [protected, virtual, inherited] |
Definition at line 1060 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::PieDiagram::paint(), KDChart::LineDiagram::paint(), KDChart::BarDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractDiagram::paintMarkers().
01061 { 01062 if( ! justReturnTheStatus ){ 01063 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()", 01064 "There is no usable model set, for the diagram." ); 01065 01066 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()", 01067 "There is no usable coordinate plane set, for the diagram." ); 01068 } 01069 return model() && coordinatePlane(); 01070 }
QModelIndex AbstractDiagram::columnToIndex | ( | int | column | ) | const [protected, inherited] |
Definition at line 309 of file KDChartAbstractDiagram.cpp.
Referenced by KDChart::BarDiagram::barAttributes(), KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::dataValueAttributes(), KDChart::AbstractDiagram::isHidden(), KDChart::Plotter::lineAttributes(), KDChart::LineDiagram::lineAttributes(), KDChart::AbstractDiagram::pen(), KDChart::AbstractPieDiagram::pieAttributes(), KDChart::BarDiagram::threeDBarAttributes(), KDChart::Plotter::threeDLineAttributes(), KDChart::LineDiagram::threeDLineAttributes(), and KDChart::AbstractPieDiagram::threeDPieAttributes().
00310 { // FIXME (Mirko): shouldn't this be headerData? instead of the index for the first row? 00311 if( model() ) 00312 return QModelIndex( model()->index( 0, column, rootIndex() ) ); 00313 return QModelIndex(); 00314 }
bool AbstractDiagram::compare | ( | const AbstractDiagram * | other | ) | const [inherited] |
Returns true if both diagrams have the same settings.
Definition at line 129 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::allowOverlappingDataValueTexts(), KDChart::AbstractDiagram::antiAliasing(), KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::compare(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::AbstractDiagram::percentMode().
00130 { 00131 if( other == this ) return true; 00132 if( ! other ){ 00133 //qDebug() << "AbstractDiagram::compare() cannot compare to Null pointer"; 00134 return false; 00135 } 00136 /* 00137 qDebug() << "\n AbstractDiagram::compare() QAbstractScrollArea:"; 00138 // compare QAbstractScrollArea properties 00139 qDebug() << 00140 ((horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) && 00141 (verticalScrollBarPolicy() == other->verticalScrollBarPolicy())); 00142 qDebug() << "AbstractDiagram::compare() QFrame:"; 00143 // compare QFrame properties 00144 qDebug() << 00145 ((frameShadow() == other->frameShadow()) && 00146 (frameShape() == other->frameShape()) && 00147 (frameWidth() == other->frameWidth()) && 00148 (lineWidth() == other->lineWidth()) && 00149 (midLineWidth() == other->midLineWidth())); 00150 qDebug() << "AbstractDiagram::compare() QAbstractItemView:"; 00151 // compare QAbstractItemView properties 00152 qDebug() << 00153 ((alternatingRowColors() == other->alternatingRowColors()) && 00154 (hasAutoScroll() == other->hasAutoScroll()) && 00155 #if QT_VERSION > 0x040199 00156 (dragDropMode() == other->dragDropMode()) && 00157 (dragDropOverwriteMode() == other->dragDropOverwriteMode()) && 00158 (horizontalScrollMode() == other->horizontalScrollMode ()) && 00159 (verticalScrollMode() == other->verticalScrollMode()) && 00160 #endif 00161 (dragEnabled() == other->dragEnabled()) && 00162 (editTriggers() == other->editTriggers()) && 00163 (iconSize() == other->iconSize()) && 00164 (selectionBehavior() == other->selectionBehavior()) && 00165 (selectionMode() == other->selectionMode()) && 00166 (showDropIndicator() == other->showDropIndicator()) && 00167 (tabKeyNavigation() == other->tabKeyNavigation()) && 00168 (textElideMode() == other->textElideMode())); 00169 qDebug() << "AbstractDiagram::compare() AttributesModel: "; 00170 // compare all of the properties stored in the attributes model 00171 qDebug() << attributesModel()->compare( other->attributesModel() ); 00172 qDebug() << "AbstractDiagram::compare() own:"; 00173 // compare own properties 00174 qDebug() << 00175 ((rootIndex().column() == other->rootIndex().column()) && 00176 (rootIndex().row() == other->rootIndex().row()) && 00177 (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) && 00178 (antiAliasing() == other->antiAliasing()) && 00179 (percentMode() == other->percentMode()) && 00180 (datasetDimension() == other->datasetDimension())); 00181 */ 00182 return // compare QAbstractScrollArea properties 00183 (horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) && 00184 (verticalScrollBarPolicy() == other->verticalScrollBarPolicy()) && 00185 // compare QFrame properties 00186 (frameShadow() == other->frameShadow()) && 00187 (frameShape() == other->frameShape()) && 00188 // frameWidth is a read-only property defined by the style, it should not be in here: 00189 // (frameWidth() == other->frameWidth()) && 00190 (lineWidth() == other->lineWidth()) && 00191 (midLineWidth() == other->midLineWidth()) && 00192 // compare QAbstractItemView properties 00193 (alternatingRowColors() == other->alternatingRowColors()) && 00194 (hasAutoScroll() == other->hasAutoScroll()) && 00195 #if QT_VERSION > 0x040199 00196 (dragDropMode() == other->dragDropMode()) && 00197 (dragDropOverwriteMode() == other->dragDropOverwriteMode()) && 00198 (horizontalScrollMode() == other->horizontalScrollMode ()) && 00199 (verticalScrollMode() == other->verticalScrollMode()) && 00200 #endif 00201 (dragEnabled() == other->dragEnabled()) && 00202 (editTriggers() == other->editTriggers()) && 00203 (iconSize() == other->iconSize()) && 00204 (selectionBehavior() == other->selectionBehavior()) && 00205 (selectionMode() == other->selectionMode()) && 00206 (showDropIndicator() == other->showDropIndicator()) && 00207 (tabKeyNavigation() == other->tabKeyNavigation()) && 00208 (textElideMode() == other->textElideMode()) && 00209 // compare all of the properties stored in the attributes model 00210 attributesModel()->compare( other->attributesModel() ) && 00211 // compare own properties 00212 (rootIndex().column() == other->rootIndex().column()) && 00213 (rootIndex().row() == other->rootIndex().row()) && 00214 (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) && 00215 (antiAliasing() == other->antiAliasing()) && 00216 (percentMode() == other->percentMode()) && 00217 (datasetDimension() == other->datasetDimension()); 00218 }
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.
Definition at line 220 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractCartesianDiagram::layoutPlanes(), KDChart::PolarDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), KDChart::AbstractDiagram::paintMarkers(), KDChart::AbstractPolarDiagram::polarCoordinatePlane(), and KDChart::AbstractCartesianDiagram::setCoordinatePlane().
00221 { 00222 return d->plane; 00223 }
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 225 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::Plotter::paint(), KDChart::LineDiagram::paint(), and KDChart::BarDiagram::paint().
00226 { 00227 if( d->databoundariesDirty ){ 00228 d->databoundaries = calculateDataBoundaries (); 00229 d->databoundariesDirty = false; 00230 } 00231 return d->databoundaries; 00232 }
void AbstractDiagram::dataChanged | ( | const QModelIndex & | topLeft, | |
const QModelIndex & | bottomRight | |||
) | [virtual, inherited] |
[reimplemented]
Definition at line 330 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::setDataBoundariesDirty().
00332 { 00333 Q_UNUSED( topLeft ); 00334 Q_UNUSED( bottomRight ); 00335 // We are still too dumb to do intelligent updates... 00336 setDataBoundariesDirty(); 00337 scheduleDelayedItemsLayout(); 00338 }
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.
Definition at line 1018 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::DatasetBrushRole, and KDChart::AbstractDiagram::datasetDimension().
Referenced by KDChart::Legend::setBrushesFromDiagram().
01019 { 01020 QList<QBrush> ret; 01021 if( model() == 0 ) 01022 return ret; 01023 01024 const int columnCount = attributesModel()->columnCount(attributesModelRootIndex()); 01025 for( int i = 0; i < columnCount / datasetDimension(); ++i ) 01026 ret << qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetBrushRole ) ); 01027 01028 return ret; 01029 }
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.
Definition at line 1072 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::LineDiagram::getCellValues(), KDChart::CartesianCoordinatePlane::getDataDimensionsList(), paint(), KDChart::TernaryLineDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), KDChart::AbstractDiagram::paintMarkers(), KDChart::AbstractDiagram::pen(), KDChart::AbstractDiagram::setPen(), KDChart::Plotter::setType(), and KDChart::LineDiagram::setType().
01073 { 01074 return d->datasetDimension; 01075 }
QStringList AbstractDiagram::datasetLabels | ( | ) | const [inherited] |
The set of dataset labels currently displayed, for use in legends, etc.
Definition at line 1005 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::AttributesModel::headerData().
01006 { 01007 QStringList ret; 01008 if( model() == 0 ) 01009 return ret; 01010 01011 const int columnCount = attributesModel()->columnCount(attributesModelRootIndex()); 01012 for( int i = 0; i < columnCount / datasetDimension(); ++i ) 01013 ret << attributesModel()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString(); 01014 01015 return ret; 01016 }
QList< MarkerAttributes > AbstractDiagram::datasetMarkers | ( | ) | const [inherited] |
The set of dataset markers currently used, for use in legends, etc.
Definition at line 1044 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::DataValueLabelAttributesRole.
01045 { 01046 QList<MarkerAttributes> ret; 01047 if( model() == 0 ) 01048 return ret; 01049 01050 const int columnCount = attributesModel()->columnCount(attributesModelRootIndex()); 01051 for( int i = 0; i < columnCount / datasetDimension(); ++i ) 01052 { 01053 const DataValueAttributes a = 01054 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataValueLabelAttributesRole ) ); 01055 ret << a.markerAttributes(); 01056 } 01057 return ret; 01058 }
QList< QPen > AbstractDiagram::datasetPens | ( | ) | const [inherited] |
The set of dataset pens currently used, for use in legends, etc.
Definition at line 1031 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::DatasetPenRole.
01032 { 01033 QList<QPen> ret; 01034 if( model() == 0 ) 01035 return ret; 01036 01037 const int columnCount = attributesModel()->columnCount(attributesModelRootIndex()); 01038 for( int i = 0; i < columnCount / datasetDimension(); ++i ) 01039 ret << qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole ) ); 01040 01041 return ret; 01042 }
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.
index | The datapoint to retrieve the attributes for. |
Definition at line 421 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DataValueLabelAttributesRole.
00422 { 00423 return qVariantValue<DataValueAttributes>( 00424 attributesModel()->data( attributesModel()->mapFromSource(index), 00425 KDChart::DataValueLabelAttributesRole ) ); 00426 }
DataValueAttributes AbstractDiagram::dataValueAttributes | ( | int | column | ) | 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.
column | The dataset to retrieve the attributes for. |
Definition at line 414 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::columnToIndex(), KDChart::AttributesModel::data(), and KDChart::DataValueLabelAttributesRole.
00415 { 00416 return qVariantValue<DataValueAttributes>( 00417 attributesModel()->data( attributesModel()->mapFromSource(columnToIndex( column )), 00418 KDChart::DataValueLabelAttributesRole ) ); 00419 }
DataValueAttributes AbstractDiagram::dataValueAttributes | ( | ) | const [inherited] |
Retrieve the DataValueAttributes speficied globally.
This will fall back automatically to the default settings, if there are no specific settings.
Definition at line 408 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::DataValueLabelAttributesRole, and KDChart::AttributesModel::modelData().
Referenced by KDChart::AbstractDiagram::paintDataValueText(), KDChart::AbstractDiagram::paintMarker(), and KDChart::TernaryLineDiagram::TernaryLineDiagram().
00409 { 00410 return qVariantValue<DataValueAttributes>( 00411 attributesModel()->modelData( KDChart::DataValueLabelAttributesRole ) ); 00412 }
void AbstractDiagram::doItemsLayout | ( | ) | [virtual, inherited] |
[reimplemented]
Definition at line 321 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
00322 { 00323 if ( d->plane ) { 00324 d->plane->layoutDiagrams(); 00325 update(); 00326 } 00327 QAbstractItemView::doItemsLayout(); 00328 }
int AbstractDiagram::horizontalOffset | ( | ) | const [virtual, inherited] |
QModelIndex AbstractDiagram::indexAt | ( | const QPoint & | point | ) | const [virtual, inherited] |
[reimplemented]
Definition at line 1098 of file KDChartAbstractDiagram.cpp.
References d.
01099 { 01100 return d->indexAt( point ); 01101 }
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 1103 of file KDChartAbstractDiagram.cpp.
References d.
01104 { 01105 return d->indexesAt( point ); 01106 }
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.
index | The datapoint to retrieve the hidden status for. |
Definition at line 380 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DataHiddenRole.
00381 { 00382 return qVariantValue<bool>( 00383 attributesModel()->data( 00384 attributesModel()->mapFromSource(index), 00385 DataHiddenRole ) ); 00386 }
bool AbstractDiagram::isHidden | ( | int | column | ) | 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.
column | The dataset to retrieve the hidden status for. |
Definition at line 373 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::columnToIndex(), KDChart::AttributesModel::data(), and KDChart::DataHiddenRole.
00374 { 00375 return qVariantValue<bool>( 00376 attributesModel()->data( 00377 attributesModel()->mapFromSource(columnToIndex( column )), 00378 DataHiddenRole ) ); 00379 }
bool AbstractDiagram::isHidden | ( | ) | const [inherited] |
Retrieve the hidden status speficied globally.
This will fall back automatically to the default settings ( = not hidden), if there are no specific settings.
Definition at line 367 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::DataHiddenRole, and KDChart::AttributesModel::modelData().
Referenced by KDChart::LineDiagram::valueForCellTesting().
00368 { 00369 return qVariantValue<bool>( 00370 attributesModel()->modelData( DataHiddenRole ) ); 00371 }
bool AbstractDiagram::isIndexHidden | ( | const QModelIndex & | index | ) | const [virtual, inherited] |
QStringList AbstractDiagram::itemRowLabels | ( | ) | const [inherited] |
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Definition at line 989 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::rowCount(), KDChart::AbstractDiagram::unitPrefix(), and KDChart::AbstractDiagram::unitSuffix().
00990 { 00991 QStringList ret; 00992 if( model() ){ 00993 //qDebug() << "AbstractDiagram::itemRowLabels(): " << attributesModel()->rowCount(attributesModelRootIndex()) << "entries"; 00994 const int rowCount = attributesModel()->rowCount(attributesModelRootIndex()); 00995 for( int i = 0; i < rowCount; ++i ){ 00996 //qDebug() << "item row label: " << attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString(); 00997 ret << unitPrefix( i, Qt::Horizontal, true ) + 00998 attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString() + 00999 unitSuffix( i, Qt::Horizontal, true ); 01000 } 01001 } 01002 return ret; 01003 }
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::setDatasetDimension(), KDChart::AbstractPieDiagram::setPieAttributes(), KDChart::AbstractPieDiagram::setThreeDPieAttributes(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().
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::setModel().
QModelIndex AbstractDiagram::moveCursor | ( | CursorAction | cursorAction, | |
Qt::KeyboardModifiers | modifiers | |||
) | [virtual, inherited] |
void TernaryPointDiagram::paint | ( | PaintContext * | paintContext | ) | [virtual] |
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
paintContext | All information needed for painting. |
Reimplemented from KDChart::AbstractTernaryDiagram.
Definition at line 72 of file KDChartTernaryPointDiagram.cpp.
References KDChart::AbstractDiagram::brush(), KDChart::PaintContext::coordinatePlane(), d, KDChart::AbstractDiagram::datasetDimension(), KDChart::PaintContext::painter(), KDChart::AbstractDiagram::paintMarker(), KDChart::AbstractDiagram::pen(), KDChart::TernaryCoordinatePlane::translate(), and translate().
00073 { 00074 d->reverseMapper.clear(); 00075 00076 d->paint( paintContext ); 00077 00078 // sanity checks: 00079 if ( model() == 0 ) return; 00080 00081 QPainter* p = paintContext->painter(); 00082 PainterSaver s( p ); 00083 00084 TernaryCoordinatePlane* plane = 00085 (TernaryCoordinatePlane*) paintContext->coordinatePlane(); 00086 Q_ASSERT( plane ); 00087 00088 double x, y, z; 00089 00090 int columnCount = model()->columnCount( rootIndex() ); 00091 for(int column=0; column<columnCount; column+=datasetDimension() ) 00092 { 00093 int numrows = model()->rowCount( rootIndex() ); 00094 for( int row = 0; row < numrows; row++ ) 00095 { 00096 QModelIndex base = model()->index( row, column ); 00097 // see if there is data otherwise skip 00098 if( ! model()->data( model()->index( row, column+0 ) ).isNull() ) 00099 { 00100 p->setPen( pen( base ) ); 00101 p->setBrush( brush( base ) ); 00102 00103 // retrieve data 00104 x = qMax( model()->data( model()->index( row, column+0 ) ).toDouble(), 00105 0.0 ); 00106 y = qMax( model()->data( model()->index( row, column+1 ) ).toDouble(), 00107 0.0 ); 00108 z = qMax( model()->data( model()->index( row, column+2 ) ).toDouble(), 00109 0.0 ); 00110 00111 // fix messed up data values (paint as much as possible) 00112 double total = x + y + z; 00113 if ( fabs( total ) > 3 * std::numeric_limits<double>::epsilon() ) { 00114 TernaryPoint tPunkt( x / total, y / total ); 00115 QPointF diagramLocation = translate( tPunkt ); 00116 QPointF widgetLocation = plane->translate( diagramLocation ); 00117 00118 paintMarker( p, model()->index( row, column ), widgetLocation ); 00119 QString text = tr( "(%1, %2, %3)" ) 00120 .arg( x * 100, 0, 'f', 0 ) 00121 .arg( y * 100, 0, 'f', 0 ) 00122 .arg( z * 100, 0, 'f', 0 ); 00123 d->paintDataValueText( p, base, widgetLocation, text ); 00124 } else { 00125 // ignore and do not paint this point, garbage data 00126 qDebug() << "TernaryPointDiagram::paint: data point x/y/z:" 00127 << x << "/" << y << "/" << z << "ignored, unusable."; 00128 } 00129 } 00130 } 00131 } 00132 }
void AbstractDiagram::paintDataValueText | ( | QPainter * | painter, | |
const QModelIndex & | index, | |||
const QPointF & | pos, | |||
double | value | |||
) | [inherited] |
Definition at line 468 of file KDChartAbstractDiagram.cpp.
References d, KDChart::DataValueAttributes::dataLabel(), KDChart::AbstractDiagram::dataValueAttributes(), KDChart::DataValueAttributes::decimalDigits(), KDChart::DataValueAttributes::isVisible(), KDChartEnums::MeasureOrientationMinimum, KDChart::DataValueAttributes::position(), KDChart::DataValueAttributes::prefix(), KDChart::DataValueAttributes::suffix(), and KDChart::DataValueAttributes::textAttributes().
Referenced by KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), and KDChart::AbstractDiagram::paintDataValueTexts().
00472 { 00473 // paint one data series 00474 const DataValueAttributes a( dataValueAttributes(index) ); 00475 if ( !a.isVisible() ) return; 00476 00477 // handle decimal digits 00478 int decimalDigits = a.decimalDigits(); 00479 int decimalPos = QString::number( value ).indexOf( QLatin1Char( '.' ) ); 00480 QString roundedValue; 00481 if ( a.dataLabel().isNull() ) { 00482 if ( decimalPos > 0 && value != 0 ) 00483 roundedValue = roundValues ( value, decimalPos, decimalDigits ); 00484 else 00485 roundedValue = QString::number( value ); 00486 } else 00487 roundedValue = a.dataLabel(); 00488 // handle prefix and suffix 00489 if ( !a.prefix().isNull() ) 00490 roundedValue.prepend( a.prefix() ); 00491 00492 if ( !a.suffix().isNull() ) 00493 roundedValue.append( a.suffix() ); 00494 00495 const TextAttributes ta( a.textAttributes() ); 00496 // FIXME draw the non-text bits, background, etc 00497 if ( ta.isVisible() ) { 00498 00499 QPointF pt( pos ); 00500 /* for debugging: 00501 PainterSaver painterSaver( painter ); 00502 painter->setPen( Qt::black ); 00503 painter->drawLine( pos - QPointF( 1,1), pos + QPointF( 1,1) ); 00504 painter->drawLine( pos - QPointF(-1,1), pos + QPointF(-1,1) ); 00505 */ 00506 00507 QTextDocument doc; 00508 if( Qt::mightBeRichText( roundedValue ) ) 00509 doc.setHtml( roundedValue ); 00510 else 00511 doc.setPlainText( roundedValue ); 00512 00513 const RelativePosition relPos( a.position( value >= 0.0 ) ); 00514 const Qt::Alignment alignBottomLeft = Qt::AlignBottom | Qt::AlignLeft; 00515 const QFont calculatedFont( ta.calculatedFont( d->plane, KDChartEnums::MeasureOrientationMinimum ) ); 00516 const QRectF boundRect( d->cachedFontMetrics( calculatedFont, painter->device() )->boundingRect( doc.toPlainText() ) ); 00517 00518 // To place correctly 00519 pt.ry() -= boundRect.height(); 00520 00521 //qDebug() << "calculatedFont's point size:" << calculatedFont.pointSizeF(); 00522 // adjust the text start point position, if alignment is not Bottom/Left 00523 if( (relPos.alignment() & alignBottomLeft) != alignBottomLeft ){ 00524 if( relPos.alignment() & Qt::AlignRight ) 00525 pt.rx() -= boundRect.width(); 00526 else if( relPos.alignment() & Qt::AlignHCenter ) 00527 pt.rx() -= 0.5 * boundRect.width(); 00528 00529 if( relPos.alignment() & Qt::AlignTop ) 00530 pt.ry() += boundRect.height(); 00531 else if( relPos.alignment() & Qt::AlignVCenter ) 00532 pt.ry() += 0.5 * boundRect.height(); 00533 } 00534 00535 // FIXME draw the non-text bits, background, etc 00536 00537 if ( a.showRepetitiveDataLabels() || 00538 pos.x() <= d->lastX || 00539 d->lastRoundedValue != roundedValue ) { 00540 d->lastRoundedValue = roundedValue; 00541 d->lastX = pos.x(); 00542 PainterSaver painterSaver( painter ); 00543 00544 doc.setDefaultFont( calculatedFont ); 00545 QAbstractTextDocumentLayout::PaintContext context; 00546 context.palette = palette(); 00547 context.palette.setColor(QPalette::Text, ta.pen().color() ); 00548 00549 painter->translate( pt ); 00550 painter->rotate( ta.rotation() ); 00551 00552 QAbstractTextDocumentLayout* layout = doc.documentLayout(); 00553 layout->draw( painter, context ); 00554 } 00555 } 00556 }
void AbstractDiagram::paintDataValueTexts | ( | QPainter * | painter | ) | [protected, virtual, inherited] |
Definition at line 584 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::paintDataValueText(), and KDChart::AbstractCoordinatePlane::translate().
00585 { 00586 if ( !checkInvariants() ) return; 00587 const int rowCount = model()->rowCount(rootIndex()); 00588 const int columnCount = model()->columnCount(rootIndex()); 00589 for ( int i=datasetDimension()-1; i<columnCount; i += datasetDimension() ) { 00590 for ( int j=0; j< rowCount; ++j ) { 00591 const QModelIndex index = model()->index( j, i, rootIndex() ); 00592 double value = model()->data( index ).toDouble(); 00593 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) ); 00594 paintDataValueText( painter, index, pos, value ); 00595 } 00596 } 00597 }
void AbstractDiagram::paintMarker | ( | QPainter * | painter, | |
const QModelIndex & | index, | |||
const QPointF & | pos | |||
) | [inherited] |
Definition at line 600 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::checkInvariants(), d, KDChart::AbstractDiagram::dataValueAttributes(), KDChart::MarkerAttributes::isVisible(), KDChart::DataValueAttributes::isVisible(), KDChart::DataValueAttributes::markerAttributes(), KDChart::MarkerAttributes::markerColor(), KDChart::MarkerAttributes::markerSize(), KDChart::AbstractDiagram::paintMarker(), and KDChart::MarkerAttributes::pen().
00603 { 00604 if ( !checkInvariants() ) return; 00605 DataValueAttributes a = dataValueAttributes(index); 00606 if ( !a.isVisible() ) return; 00607 const MarkerAttributes &ma = a.markerAttributes(); 00608 if ( !ma.isVisible() ) return; 00609 00610 PainterSaver painterSaver( painter ); 00611 QSizeF maSize( ma.markerSize() ); 00612 QBrush indexBrush( brush( index ) ); 00613 QPen indexPen( ma.pen() ); 00614 if ( ma.markerColor().isValid() ) 00615 indexBrush.setColor( ma.markerColor() ); 00616 00617 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize ); 00618 00619 // workaround: BC cannot be changed, otherwise we would pass the 00620 // index down to next-lower paintMarker function. So far, we 00621 // basically save a circle of radius maSize at pos in the 00622 // reverseMapper. This means that ^^^ this version of paintMarker 00623 // needs to be called to reverse-map the marker. 00624 d->reverseMapper.addCircle( index.row(), index.column(), pos, 2 * maSize ); 00625 }
void AbstractDiagram::paintMarker | ( | QPainter * | painter, | |
const MarkerAttributes & | markerAttributes, | |||
const QBrush & | brush, | |||
const QPen & | , | |||
const QPointF & | point, | |||
const QSizeF & | size | |||
) | [virtual, inherited] |
Definition at line 627 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, and KDChart::MarkerAttributes::markerStyle().
Referenced by paint(), KDChart::TernaryLineDiagram::paint(), KDChart::MarkerLayoutItem::paintIntoRect(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractDiagram::paintMarkers().
00633 { 00634 const QPen oldPen( painter->pen() ); 00635 // Pen is used to paint 4Pixels - 1 Pixel - Ring and FastCross types. 00636 // make sure to use the brush color - see above in those cases. 00637 const bool isFourPixels = (markerAttributes.markerStyle() == MarkerAttributes::Marker4Pixels); 00638 if( isFourPixels || (markerAttributes.markerStyle() == MarkerAttributes::Marker1Pixel) ){ 00639 // for high-performance point charts with tiny point markers: 00640 painter->setPen( QPen( brush.color().light() ) ); 00641 if( isFourPixels ){ 00642 const qreal x = pos.x(); 00643 const qreal y = pos.y(); 00644 painter->drawLine( QPointF(x-1.0,y-1.0), 00645 QPointF(x+1.0,y-1.0) ); 00646 painter->drawLine( QPointF(x-1.0,y), 00647 QPointF(x+1.0,y) ); 00648 painter->drawLine( QPointF(x-1.0,y+1.0), 00649 QPointF(x+1.0,y+1.0) ); 00650 } 00651 painter->drawPoint( pos ); 00652 }else{ 00653 PainterSaver painterSaver( painter ); 00654 // we only a solid line surrounding the markers 00655 QPen painterPen( pen ); 00656 painterPen.setStyle( Qt::SolidLine ); 00657 painter->setPen( painterPen ); 00658 painter->setBrush( brush ); 00659 painter->setRenderHint ( QPainter::Antialiasing ); 00660 painter->translate( pos ); 00661 switch ( markerAttributes.markerStyle() ) { 00662 case MarkerAttributes::MarkerCircle: 00663 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2, 00664 maSize.height(), maSize.width()) ); 00665 break; 00666 case MarkerAttributes::MarkerSquare: 00667 { 00668 QRectF rect( 0 - maSize.width()/2, 0 - maSize.height()/2, 00669 maSize.width(), maSize.height() ); 00670 painter->drawRect( rect ); 00671 break; 00672 } 00673 case MarkerAttributes::MarkerDiamond: 00674 { 00675 QVector <QPointF > diamondPoints; 00676 QPointF top, left, bottom, right; 00677 top = QPointF( 0, 0 - maSize.height()/2 ); 00678 left = QPointF( 0 - maSize.width()/2, 0 ); 00679 bottom = QPointF( 0, maSize.height()/2 ); 00680 right = QPointF( maSize.width()/2, 0 ); 00681 diamondPoints << top << left << bottom << right; 00682 painter->drawPolygon( diamondPoints ); 00683 break; 00684 } 00685 // both handled on top of the method: 00686 case MarkerAttributes::Marker1Pixel: 00687 case MarkerAttributes::Marker4Pixels: 00688 break; 00689 case MarkerAttributes::MarkerRing: 00690 { 00691 painter->setPen( QPen( brush.color() ) ); 00692 painter->setBrush( Qt::NoBrush ); 00693 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2, 00694 maSize.height(), maSize.width()) ); 00695 break; 00696 } 00697 case MarkerAttributes::MarkerCross: 00698 { 00699 QRectF rect( maSize.width()*-0.5, maSize.height()*-0.2, 00700 maSize.width(), maSize.height()*0.4 ); 00701 painter->drawRect( rect ); 00702 rect.setTopLeft(QPointF( maSize.width()*-0.2, maSize.height()*-0.5 )); 00703 rect.setSize(QSizeF( maSize.width()*0.4, maSize.height() )); 00704 painter->drawRect( rect ); 00705 break; 00706 } 00707 case MarkerAttributes::MarkerFastCross: 00708 { 00709 QPointF left, right, top, bottom; 00710 left = QPointF( -maSize.width()/2, 0 ); 00711 right = QPointF( maSize.width()/2, 0 ); 00712 top = QPointF( 0, -maSize.height()/2 ); 00713 bottom= QPointF( 0, maSize.height()/2 ); 00714 painter->setPen( QPen( brush.color() ) ); 00715 painter->drawLine( left, right ); 00716 painter->drawLine( top, bottom ); 00717 break; 00718 } 00719 default: 00720 Q_ASSERT_X ( false, "paintMarkers()", 00721 "Type item does not match a defined Marker Type." ); 00722 } 00723 } 00724 painter->setPen( oldPen ); 00725 }
void AbstractDiagram::paintMarkers | ( | QPainter * | painter | ) | [protected, virtual, inherited] |
Definition at line 727 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractCoordinatePlane::translate().
00728 { 00729 if ( !checkInvariants() ) return; 00730 const int rowCount = model()->rowCount(rootIndex()); 00731 const int columnCount = model()->columnCount(rootIndex()); 00732 for ( int i=datasetDimension()-1; i<columnCount; i += datasetDimension() ) { 00733 for ( int j=0; j< rowCount; ++j ) { 00734 const QModelIndex index = model()->index( j, i, rootIndex() ); 00735 double value = model()->data( index ).toDouble(); 00736 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) ); 00737 paintMarker( painter, index, pos ); 00738 } 00739 } 00740 }
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.
index | The index of the datapoint in the model. |
Definition at line 788 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), KDChart::AbstractDiagram::datasetDimension(), KDChart::DatasetPenRole, and KDChart::AbstractDiagram::pen().
00789 { 00790 if( datasetDimension() > 1 ) 00791 return pen( index.column() ); 00792 return qVariantValue<QPen>( 00793 attributesModel()->data( 00794 attributesModel()->mapFromSource( index ), 00795 DatasetPenRole ) ); 00796 }
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.
dataset | The dataset to retrieve the pen for. |
Definition at line 777 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::columnToIndex(), KDChart::AttributesModel::data(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::DatasetPenRole.
00778 { 00779 if( datasetDimension() > 1 ) 00780 dataset /= datasetDimension(); 00781 00782 return qVariantValue<QPen>( 00783 attributesModel()->data( 00784 attributesModel()->mapFromSource( columnToIndex( dataset ) ), 00785 DatasetPenRole ) ); 00786 }
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.
Definition at line 771 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetPenRole.
Referenced by paint(), KDChart::TernaryLineDiagram::paint(), and KDChart::AbstractDiagram::pen().
00772 { 00773 return qVariantValue<QPen>( 00774 attributesModel()->data( DatasetPenRole ) ); 00775 }
bool AbstractDiagram::percentMode | ( | ) | const [inherited] |
Definition at line 462 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractDiagram::compare(), and KDChart::CartesianCoordinatePlane::getDataDimensionsList().
00463 { 00464 return d->percent; 00465 }
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::AbstractDiagram::setDataValueAttributes(), KDChart::Plotter::setLineAttributes(), KDChart::LineDiagram::setLineAttributes(), KDChart::AbstractDiagram::setPen(), KDChart::AbstractDiagram::setPercentMode(), KDChart::BarDiagram::setThreeDBarAttributes(), KDChart::Plotter::setThreeDLineAttributes(), KDChart::LineDiagram::setThreeDLineAttributes(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), KDChart::BarDiagram::setType(), KDChart::Plotter::setValueTrackerAttributes(), and KDChart::LineDiagram::setValueTrackerAttributes().
void TernaryPointDiagram::resize | ( | const QSizeF & | area | ) | [virtual] |
Called by the widget's sizeEvent.
Adjust all internal structures, that are calculated, dependending on the size of the widget.
area |
Implements KDChart::AbstractTernaryDiagram.
Definition at line 67 of file KDChartTernaryPointDiagram.cpp.
void AbstractDiagram::scrollTo | ( | const QModelIndex & | index, | |
ScrollHint | hint = EnsureVisible | |||
) | [virtual, inherited] |
void AbstractDiagram::setAllowOverlappingDataValueTexts | ( | bool | allow | ) | [inherited] |
Set whether data value labels are allowed to overlap.
allow | True means that overlapping labels are allowed. |
Definition at line 434 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::propertiesChanged().
00435 { 00436 d->allowOverlappingDataValueTexts = allow; 00437 emit propertiesChanged(); 00438 }
void AbstractDiagram::setAntiAliasing | ( | bool | enabled | ) | [inherited] |
Set whether anti-aliasing is to be used while rendering this diagram.
enabled | True means that AA is enabled. |
Definition at line 445 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::propertiesChanged().
00446 { 00447 d->antiAliasing = enabled; 00448 emit propertiesChanged(); 00449 }
void AbstractDiagram::setAttributesModel | ( | AttributesModel * | model | ) | [virtual, inherited] |
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 explicitely 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() );
model | The AttributesModel to use for this diagram. |
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 255 of file KDChartAbstractDiagram.cpp.
References d, KDChart::AbstractDiagram::modelsChanged(), and KDChart::AbstractDiagram::setDataBoundariesDirty().
Referenced by KDChart::AbstractCartesianDiagram::setAttributesModel().
00256 { 00257 if( amodel->sourceModel() != model() ) { 00258 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: " 00259 "Trying to set an attributesmodel which works on a different " 00260 "model than the diagram."); 00261 return; 00262 } 00263 if( qobject_cast<PrivateAttributesModel*>(amodel) ) { 00264 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: " 00265 "Trying to set an attributesmodel that is private to another diagram."); 00266 return; 00267 } 00268 d->setAttributesModel(amodel); 00269 scheduleDelayedItemsLayout(); 00270 setDataBoundariesDirty(); 00271 emit modelsChanged(); 00272 }
void AbstractDiagram::setAttributesModelRootIndex | ( | const QModelIndex & | ) | [protected, inherited] |
Definition at line 293 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::setDataBoundariesDirty().
Referenced by KDChart::AbstractDiagram::setRootIndex().
00294 { 00295 d->attributesModelRootIndex=idx; 00296 setDataBoundariesDirty(); 00297 scheduleDelayedItemsLayout(); 00298 }
void AbstractDiagram::setBrush | ( | const QBrush & | brush | ) | [inherited] |
Set the brush to be used, for painting all datasets in the model.
brush | The brush to use. |
Definition at line 806 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setModelData().
00807 { 00808 attributesModel()->setModelData( 00809 qVariantFromValue( brush ), DatasetBrushRole ); 00810 emit propertiesChanged(); 00811 }
void AbstractDiagram::setBrush | ( | int | dataset, | |
const QBrush & | brush | |||
) | [inherited] |
Set the brush to be used, for painting the given dataset.
dataset | The dataset's column in the model. | |
brush | The brush to use. |
Definition at line 813 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setHeaderData().
00814 { 00815 attributesModel()->setHeaderData( 00816 column, Qt::Vertical, 00817 qVariantFromValue( brush ), 00818 DatasetBrushRole ); 00819 emit propertiesChanged(); 00820 }
void AbstractDiagram::setBrush | ( | const QModelIndex & | index, | |
const QBrush & | brush | |||
) | [inherited] |
Set the brush to be used, for painting the datapoint at the given index.
index | The datapoint's index in the model. | |
brush | The brush to use. |
Definition at line 798 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setData().
00799 { 00800 attributesModel()->setData( 00801 attributesModel()->mapFromSource( index ), 00802 qVariantFromValue( brush ), DatasetBrushRole ); 00803 emit propertiesChanged(); 00804 }
void AbstractDiagram::setCoordinatePlane | ( | AbstractCoordinatePlane * | plane | ) | [virtual, inherited] |
Set the coordinate plane associated with the diagram.
This determines how coordinates in value space are mapped into pixel space. The chart takes ownership.
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 316 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCartesianDiagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().
00317 { 00318 d->plane = parent; 00319 }
void AbstractDiagram::setDataBoundariesDirty | ( | ) | const [protected, inherited] |
Definition at line 234 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractDiagram::dataChanged(), KDChart::Plotter::resize(), KDChart::LineDiagram::resize(), KDChart::BarDiagram::resize(), KDChart::AbstractDiagram::setAttributesModel(), KDChart::AbstractDiagram::setAttributesModelRootIndex(), KDChart::AbstractDiagram::setDatasetDimension(), KDChart::AbstractDiagram::setModel(), KDChart::BarDiagram::setThreeDBarAttributes(), KDChart::Plotter::setThreeDLineAttributes(), KDChart::LineDiagram::setThreeDLineAttributes(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().
00235 { 00236 d->databoundariesDirty = true; 00237 }
void AbstractDiagram::setDatasetDimension | ( | int | dimension | ) | [inherited] |
Sets the dataset dimension of the diagram.
dimension |
Definition at line 1077 of file KDChartAbstractDiagram.cpp.
References d, KDChart::AbstractDiagram::layoutChanged(), and KDChart::AbstractDiagram::setDataBoundariesDirty().
Referenced by KDChart::Widget::setType(), KDChart::TernaryLineDiagram::TernaryLineDiagram(), and TernaryPointDiagram().
01078 { 01079 if ( d->datasetDimension == dimension ) return; 01080 d->datasetDimension = dimension; 01081 setDataBoundariesDirty(); 01082 emit layoutChanged( this ); 01083 }
void AbstractDiagram::setDataValueAttributes | ( | const DataValueAttributes & | a | ) | [inherited] |
Set the DataValueAttributes for all datapoints in the model.
a | The attributes to set. |
Definition at line 428 of file KDChartAbstractDiagram.cpp.
References d, KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00429 { 00430 d->attributesModel->setModelData( qVariantFromValue( a ), DataValueLabelAttributesRole ); 00431 emit propertiesChanged(); 00432 }
void AbstractDiagram::setDataValueAttributes | ( | int | dataset, | |
const DataValueAttributes & | a | |||
) | [inherited] |
Set the DataValueAttributes for the given dataset.
dataset | The dataset to set the attributes for. | |
a | The attributes to set. |
Definition at line 400 of file KDChartAbstractDiagram.cpp.
References d, KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00401 { 00402 d->attributesModel->setHeaderData( 00403 column, Qt::Vertical, 00404 qVariantFromValue( a ), DataValueLabelAttributesRole ); 00405 emit propertiesChanged(); 00406 }
void AbstractDiagram::setDataValueAttributes | ( | const QModelIndex & | index, | |
const DataValueAttributes & | a | |||
) | [inherited] |
Set the DataValueAttributes for the given index.
index | The datapoint to set the attributes for. | |
a | The attributes to set. |
Definition at line 389 of file KDChartAbstractDiagram.cpp.
References d, KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00391 { 00392 d->attributesModel->setData( 00393 d->attributesModel->mapFromSource( index ), 00394 qVariantFromValue( a ), 00395 DataValueLabelAttributesRole ); 00396 emit propertiesChanged(); 00397 }
void AbstractDiagram::setHidden | ( | bool | hidden | ) | [inherited] |
Hide (or unhide, resp.
) all datapoints in the model.
hidden | The hidden status to set. |
Definition at line 359 of file KDChartAbstractDiagram.cpp.
References d, KDChart::AbstractDiagram::dataHidden(), and KDChart::DataHiddenRole.
00360 { 00361 d->attributesModel->setModelData( 00362 qVariantFromValue( hidden ), 00363 DataHiddenRole ); 00364 emit dataHidden(); 00365 }
void AbstractDiagram::setHidden | ( | int | column, | |
bool | hidden | |||
) | [inherited] |
Hide (or unhide, resp.
) a dataset.
column | The dataset to set the hidden status for. | |
hidden | The hidden status to set. |
Definition at line 350 of file KDChartAbstractDiagram.cpp.
References d, KDChart::AbstractDiagram::dataHidden(), and KDChart::DataHiddenRole.
00351 { 00352 d->attributesModel->setHeaderData( 00353 column, Qt::Vertical, 00354 qVariantFromValue( hidden ), 00355 DataHiddenRole ); 00356 emit dataHidden(); 00357 }
void AbstractDiagram::setHidden | ( | const QModelIndex & | index, | |
bool | hidden | |||
) | [inherited] |
Hide (or unhide, resp.
) a data cell.
index | The datapoint to set the hidden status for. | |
hidden | The hidden status to set. |
Definition at line 341 of file KDChartAbstractDiagram.cpp.
References d, KDChart::AbstractDiagram::dataHidden(), and KDChart::DataHiddenRole.
00342 { 00343 d->attributesModel->setData( 00344 d->attributesModel->mapFromSource( index ), 00345 qVariantFromValue( hidden ), 00346 DataHiddenRole ); 00347 emit dataHidden(); 00348 }
void AbstractDiagram::setModel | ( | QAbstractItemModel * | model | ) | [virtual, inherited] |
Associate a model with the diagram.
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 239 of file KDChartAbstractDiagram.cpp.
References d, KDChart::AttributesModel::initFrom(), KDChart::AbstractDiagram::modelsChanged(), and KDChart::AbstractDiagram::setDataBoundariesDirty().
Referenced by KDChart::AbstractCartesianDiagram::setModel(), and KDChart::Widget::setType().
00240 { 00241 QAbstractItemView::setModel( newModel ); 00242 AttributesModel* amodel = new PrivateAttributesModel( newModel, this ); 00243 amodel->initFrom( d->attributesModel ); 00244 d->setAttributesModel(amodel); 00245 scheduleDelayedItemsLayout(); 00246 setDataBoundariesDirty(); 00247 emit modelsChanged(); 00248 }
void AbstractDiagram::setPen | ( | const QPen & | pen | ) | [inherited] |
Set the pen to be used, for painting all datasets in the model.
pen | The pen to use. |
Definition at line 753 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setModelData().
00754 { 00755 attributesModel()->setModelData( 00756 qVariantFromValue( pen ), DatasetPenRole ); 00757 emit propertiesChanged(); 00758 }
void AbstractDiagram::setPen | ( | int | dataset, | |
const QPen & | pen | |||
) | [inherited] |
Set the pen to be used, for painting the given dataset.
dataset | The dataset's row in the model. | |
pen | The pen to use. |
Definition at line 760 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::datasetDimension(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setHeaderData().
00761 { 00762 if( datasetDimension() > 1 ) 00763 column *= datasetDimension(); 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.
index | The datapoint's index in the model. | |
pen | The pen to use. |
Definition at line 743 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::datasetDimension(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setData().
00744 { 00745 if( datasetDimension() > 1 ) 00746 return setPen( index.column(), pen ); 00747 attributesModel()->setData( 00748 attributesModel()->mapFromSource( index ), 00749 qVariantFromValue( pen ), DatasetPenRole ); 00750 emit propertiesChanged(); 00751 }
void AbstractDiagram::setPercentMode | ( | bool | percent | ) | [inherited] |
Definition at line 456 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::propertiesChanged().
Referenced by KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().
00457 { 00458 d->percent = percent; 00459 emit propertiesChanged(); 00460 }
void AbstractDiagram::setRootIndex | ( | const QModelIndex & | idx | ) | [virtual, inherited] |
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 286 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::setAttributesModelRootIndex().
Referenced by KDChart::AbstractCartesianDiagram::setRootIndex().
00287 { 00288 QAbstractItemView::setRootIndex(idx); 00289 setAttributesModelRootIndex( d->attributesModel->mapFromSource(idx) ); 00290 }
void AbstractDiagram::setSelection | ( | const QRect & | rect, | |
QItemSelectionModel::SelectionFlags | command | |||
) | [virtual, inherited] |
[reimplemented]
Definition at line 959 of file KDChartAbstractDiagram.cpp.
References d.
00960 { 00961 const QModelIndexList indexes = d->indexesIn( rect ); 00962 QItemSelection selection; 00963 KDAB_FOREACH( const QModelIndex& index, indexes ) 00964 { 00965 selection.append( QItemSelectionRange( index ) ); 00966 } 00967 selectionModel()->select( selection, command ); 00968 }
void AbstractDiagram::setUnitPrefix | ( | const QString & | prefix, | |
Qt::Orientation | orientation | |||
) | [inherited] |
Sets the unit prefix for all values.
prefix | the prefix to be set | |
orientation | the orientantion of the axis to set |
Definition at line 864 of file KDChartAbstractDiagram.cpp.
References d.
00865 { 00866 d->unitPrefix[ orientation ] = prefix; 00867 }
void AbstractDiagram::setUnitPrefix | ( | const QString & | prefix, | |
int | column, | |||
Qt::Orientation | orientation | |||
) | [inherited] |
Sets the unit prefix for one value.
prefix | the prefix to be set | |
column | the value using that prefix | |
orientation | the orientantion of the axis to set |
Definition at line 854 of file KDChartAbstractDiagram.cpp.
References d.
00855 { 00856 d->unitPrefixMap[ column ][ orientation ]= prefix; 00857 }
void AbstractDiagram::setUnitSuffix | ( | const QString & | suffix, | |
Qt::Orientation | orientation | |||
) | [inherited] |
Sets the unit suffix for all values.
suffix | the suffix to be set | |
orientation | the orientantion of the axis to set |
Definition at line 885 of file KDChartAbstractDiagram.cpp.
References d.
00886 { 00887 d->unitSuffix[ orientation ] = suffix; 00888 }
void AbstractDiagram::setUnitSuffix | ( | const QString & | suffix, | |
int | column, | |||
Qt::Orientation | orientation | |||
) | [inherited] |
Sets the unit suffix for one value.
suffix | the suffix to be set | |
column | the value using that suffix | |
orientation | the orientantion of the axis to set |
Definition at line 875 of file KDChartAbstractDiagram.cpp.
References d.
00876 { 00877 d->unitSuffixMap[ column ][ orientation ]= suffix; 00878 }
QString AbstractDiagram::unitPrefix | ( | Qt::Orientation | orientation | ) | const [inherited] |
Returns the global unit prefix.
orientation | the orientation of the axis |
Definition at line 908 of file KDChartAbstractDiagram.cpp.
References d.
00909 { 00910 return d->unitPrefix[ orientation ]; 00911 }
QString AbstractDiagram::unitPrefix | ( | int | column, | |
Qt::Orientation | orientation, | |||
bool | fallback = false | |||
) | const [inherited] |
Returns the unit prefix for a special value.
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 |
Definition at line 897 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractDiagram::itemRowLabels(), and KDChart::CartesianAxis::paintCtx().
00898 { 00899 if( !fallback || d->unitPrefixMap[ column ].contains( orientation ) ) 00900 return d->unitPrefixMap[ column ][ orientation ]; 00901 return d->unitPrefix[ orientation ]; 00902 }
QString AbstractDiagram::unitSuffix | ( | Qt::Orientation | orientation | ) | const [inherited] |
Returns the global unit suffix.
orientation | the orientation of the axis |
Definition at line 931 of file KDChartAbstractDiagram.cpp.
References d.
00932 { 00933 return d->unitSuffix[ orientation ]; 00934 }
QString AbstractDiagram::unitSuffix | ( | int | column, | |
Qt::Orientation | orientation, | |||
bool | fallback = false | |||
) | const [inherited] |
Returns the unit suffix for a special value.
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 |
Definition at line 920 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractDiagram::itemRowLabels(), and KDChart::CartesianAxis::paintCtx().
00921 { 00922 if( !fallback || d->unitSuffixMap[ column ].contains( orientation ) ) 00923 return d->unitSuffixMap[ column ][ orientation ]; 00924 return d->unitSuffix[ orientation ]; 00925 }
void AbstractDiagram::update | ( | ) | const [inherited] |
Definition at line 1091 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractDiagram::doItemsLayout().
01092 { 01093 //qDebug("KDChart::AbstractDiagram::update() called"); 01094 if( d->plane ) 01095 d->plane->update(); 01096 }
void KDChart::AbstractDiagram::useDefaultColors | ( | ) | [inherited] |
Set the palette to be used, for painting datasets to the default palette.
Definition at line 974 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AttributesModel::PaletteTypeDefault.
00975 { 00976 d->attributesModel->setPaletteType( AttributesModel::PaletteTypeDefault ); 00977 }
void KDChart::AbstractDiagram::useRainbowColors | ( | ) | [inherited] |
Set the palette to be used, for painting datasets to the rainbow palette.
Definition at line 984 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AttributesModel::PaletteTypeRainbow.
00985 { 00986 d->attributesModel->setPaletteType( AttributesModel::PaletteTypeRainbow ); 00987 }
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.
Definition at line 274 of file KDChartAbstractDiagram.cpp.
References d.
00275 { 00276 return d->usesExternalAttributesModel(); 00277 }
void KDChart::AbstractDiagram::useSubduedColors | ( | ) | [inherited] |
Set the palette to be used, for painting datasets to the subdued palette.
Definition at line 979 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AttributesModel::PaletteTypeSubdued.
00980 { 00981 d->attributesModel->setPaletteType( AttributesModel::PaletteTypeSubdued ); 00982 }
double AbstractDiagram::valueForCell | ( | int | row, | |
int | column | |||
) | const [protected, inherited] |
Helper method, retrieving the data value (DisplayRole) for a given row and column.
row | The row to query. | |
column | The column to query. |
Definition at line 1085 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.
01086 { 01087 return d->attributesModel->data( 01088 d->attributesModel->index( row, column, attributesModelRootIndex() ) ).toDouble(); 01089 }
int AbstractDiagram::verticalOffset | ( | ) | const [virtual, inherited] |
QRect AbstractDiagram::visualRect | ( | const QModelIndex & | index | ) | const [virtual, inherited] |
QRegion AbstractDiagram::visualRegionForSelection | ( | const QItemSelection & | selection | ) | const [virtual, inherited] |