#include <KDChartLineDiagram.h>
Inheritance diagram for KDChart::LineDiagram:
Public Types | |
enum | LineType { Normal = 0, Stacked = 1, Percent = 2 } |
Public Member Functions | |
virtual void | addAxis (CartesianAxis *axis) |
Add the axis to the diagram. | |
bool | allowOverlappingDataValueTexts () const |
bool | antiAliasing () const |
virtual AttributesModel * | attributesModel () const |
Returns the AttributesModel, that is used by this diagram. | |
virtual KDChart::CartesianAxisList | axes () const |
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. | |
virtual LineDiagram * | clone () const |
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. | |
bool | compare (const LineDiagram *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] | |
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 void | layoutPlanes () |
LineAttributes | lineAttributes (const QModelIndex &index) const |
LineAttributes | lineAttributes (int column) const |
LineAttributes | lineAttributes () const |
LineDiagram (QWidget *parent=0, CartesianCoordinatePlane *plane=0) | |
virtual QModelIndex | moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) |
[reimplemented] | |
const int | numberOfAbscissaSegments () const |
const int | numberOfOrdinateSegments () const |
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 AbstractCartesianDiagram * | referenceDiagram () const |
virtual QPointF | referenceDiagramOffset () const |
void | resetLineAttributes (const QModelIndex &index) |
Remove any explicit line attributes settings that might have been specified before. | |
void | resetLineAttributes (int column) |
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.) all datapoints in the model. | |
void | setHidden (int column, bool hidden) |
Hide (or unhide, resp.) a dataset. | |
void | setHidden (const QModelIndex &index, bool hidden) |
Hide (or unhide, resp.) a data cell. | |
void | setLineAttributes (const QModelIndex &index, const LineAttributes &a) |
void | setLineAttributes (int column, const LineAttributes &a) |
void | setLineAttributes (const LineAttributes &a) |
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 | setReferenceDiagram (AbstractCartesianDiagram *diagram, const QPointF &offset=QPointF()) |
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 | setThreeDLineAttributes (const QModelIndex &index, const ThreeDLineAttributes &a) |
void | setThreeDLineAttributes (int column, const ThreeDLineAttributes &a) |
void | setThreeDLineAttributes (const ThreeDLineAttributes &a) |
void | setType (const LineType type) |
virtual void | takeAxis (CartesianAxis *axis) |
Removes the axis from the diagram, without deleting it. | |
ThreeDLineAttributes | threeDLineAttributes (const QModelIndex &index) const |
ThreeDLineAttributes | threeDLineAttributes (int column) const |
ThreeDLineAttributes | threeDLineAttributes () const |
LineType | type () const |
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 | ~LineDiagram () |
Protected Member Functions | |
QModelIndex | attributesModelRootIndex () const |
virtual const QPair< QPointF, QPointF > | calculateDataBoundaries () const |
[reimplemented] | |
virtual bool | checkInvariants (bool justReturnTheStatus=false) const |
QModelIndex | columnToIndex (int column) const |
void | dataHidden () |
This signal is emitted, when the hidden status of at least one data cell was (un)set. | |
LineAttributes::MissingValuesPolicy | getCellValues (int row, int column, bool shiftCountedXValuesByHalfSection, double &valueX, double &valueY) const |
void | modelsChanged () |
This signal is emitted, when either the model or the AttributesModel is replaced. | |
void | paint (PaintContext *paintContext) |
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context. | |
virtual void | paintDataValueTexts (QPainter *painter) |
void | paintEvent (QPaintEvent *) |
virtual void | paintMarkers (QPainter *painter) |
void | propertiesChanged () |
Emitted upon change of a property of the Diagram. | |
void | resizeEvent (QResizeEvent *) |
void | setAttributesModelRootIndex (const QModelIndex &) |
void | setDataBoundariesDirty () const |
virtual double | threeDItemDepth (int column) const |
virtual double | threeDItemDepth (const QModelIndex &index) const |
double | valueForCell (int row, int column) const |
Helper method, retrieving the data value (DisplayRole) for a given row and column. | |
double | valueForCellTesting (int row, int column, bool &bOK, bool showHiddenCellsAsInvalid=false) const |
Protected Attributes | |
Q_SIGNALS | __pad0__: void layoutChanged( AbstractDiagram* ) |
|
Definition at line 62 of file KDChartLineDiagram.h.
|
|
Definition at line 60 of file KDChartLineDiagram.cpp. Referenced by clone().
00060 : 00061 AbstractCartesianDiagram( new Private(), parent, plane ) 00062 { 00063 init(); 00064 } |
|
Definition at line 70 of file KDChartLineDiagram.cpp.
00071 { 00072 } |
|
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.
Definition at line 89 of file KDChartAbstractCartesianDiagram.cpp. References KDChart::AbstractAxis::createObserver(), d, and KDChart::AbstractCartesianDiagram::layoutPlanes().
00090 { 00091 if ( !d->axesList.contains( axis ) ) { 00092 d->axesList.append( axis ); 00093 axis->createObserver( this ); 00094 layoutPlanes(); 00095 } 00096 } |
|
Definition at line 446 of file KDChartAbstractDiagram.cpp. References d.
00450 { |
|
Definition at line 457 of file KDChartAbstractDiagram.cpp. References d. Referenced by paint().
00461 { |
|
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 286 of file KDChartAbstractDiagram.cpp. References d. Referenced by KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), and KDChart::BarDiagram::setBarAttributes().
00287 { 00288 return d->attributesModel; 00289 } |
|
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram. Definition at line 310 of file KDChartAbstractDiagram.cpp. References d. Referenced by calculateDataBoundaries(), KDChart::BarDiagram::calculateDataBoundaries(), numberOfAbscissaSegments(), KDChart::BarDiagram::numberOfAbscissaSegments(), numberOfOrdinateSegments(), KDChart::BarDiagram::numberOfOrdinateSegments(), paint(), KDChart::BarDiagram::paint(), and KDChart::AbstractDiagram::valueForCell().
00316 { |
|
Definition at line 108 of file KDChartAbstractCartesianDiagram.cpp. References KDChart::CartesianAxisList, and d.
00109 { 00110 return d->axesList; 00111 } |
|
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Definition at line 816 of file KDChartAbstractDiagram.cpp.
00822 : QRect AbstractDiagram::visualRect(const QModelIndex &) const |
|
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.
Definition at line 808 of file KDChartAbstractDiagram.cpp.
00815 { |
|
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 802 of file KDChartAbstractDiagram.cpp. Referenced by KDChart::PieDiagram::paint(), paint(), and KDChart::AbstractDiagram::paintMarker().
00807 { |
|
[reimplemented]
Implements KDChart::AbstractDiagram. Definition at line 267 of file KDChartLineDiagram.cpp. References KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AbstractDiagram::checkInvariants(), d, KDChart::AbstractDiagram::datasetDimension(), type(), and valueForCellTesting().
00268 { 00269 if ( !checkInvariants( true ) ) return QPair<QPointF, QPointF>( QPointF( 0, 0 ), QPointF( 0, 0 ) ); 00270 00271 // note: calculateDataBoundaries() is ignoring the hidden flags. 00272 // That's not a bug but a feature: Hiding data does not mean removing them. 00273 // For totally removing data from KD Chart's view people can use e.g. a proxy model ... 00274 00275 const int rowCount = d->attributesModel->rowCount(attributesModelRootIndex()); 00276 const int colCount = d->attributesModel->columnCount(attributesModelRootIndex()); 00277 double xMin = 0; 00278 double xMax = rowCount -1; 00279 double yMin = 0, yMax = 0; 00280 bool bOK; 00281 00282 // calculate boundaries for different line types Normal - Stacked - Percent - Default Normal 00283 switch ( type() ){ 00284 case LineDiagram::Normal: 00285 { 00286 bool bStarting = true; 00287 for( int i = datasetDimension()-1; i < colCount; i += datasetDimension() ) { 00288 for ( int j=0; j< rowCount; ++j ) { 00289 const double value = valueForCellTesting( j, i, bOK ); 00290 double xvalue; 00291 if( datasetDimension() > 1 && bOK ) 00292 xvalue = valueForCellTesting( j, i-1, bOK ); 00293 if( bOK ){ 00294 if( bStarting ){ 00295 yMin = value; 00296 yMax = value; 00297 }else{ 00298 yMin = qMin( yMin, value ); 00299 yMax = qMax( yMax, value ); 00300 } 00301 if ( datasetDimension() > 1 ) { 00302 if( bStarting ){ 00303 xMin = xvalue; 00304 xMax = xvalue; 00305 }else{ 00306 xMin = qMin( xMin, xvalue ); 00307 xMax = qMax( xMax, xvalue ); 00308 } 00309 } 00310 bStarting = false; 00311 } 00312 } 00313 } 00314 00315 // the following code is replaced by CartesianCoordinatePlane's automatic range / zoom adjusting 00316 //if( yMin > 0 && yMax / yMin >= 2.0 ) 00317 // yMin = 0; 00318 //else if( yMax < 0 && yMax / yMin <= 0.5 ) 00319 // yMax = 0; 00320 } 00321 break; 00322 case LineDiagram::Stacked: 00323 { 00324 bool bStarting = true; 00325 for ( int j=0; j< rowCount; ++j ) { 00326 // calculate sum of values per column - Find out stacked Min/Max 00327 double stackedValues = 0; 00328 for( int i = datasetDimension()-1; i < colCount; i += datasetDimension() ) { 00329 const double value = valueForCellTesting( j, i, bOK ); 00330 if( bOK ) 00331 stackedValues += value; 00332 } 00333 if( bStarting ){ 00334 yMin = stackedValues; 00335 yMax = stackedValues; 00336 bStarting = false; 00337 }else{ 00338 // Pending Michel: 00339 // I am taking in account all values negatives or positives 00340 // take in account all stacked values 00341 yMin = qMin( qMin( yMin, 0.0 ), stackedValues ); 00342 yMax = qMax( yMax, stackedValues ); 00343 } 00344 } 00345 } 00346 break; 00347 case LineDiagram::Percent: 00348 { 00349 for( int i = datasetDimension()-1; i < colCount; i += datasetDimension() ) { 00350 for ( int j=0; j< rowCount; ++j ) { 00351 // Ordinate should begin at 0 the max value being the 100% pos 00352 const double value = valueForCellTesting( j, i, bOK ); 00353 if( bOK ) 00354 yMax = qMax( yMax, value ); 00355 } 00356 } 00357 } 00358 break; 00359 default: 00360 Q_ASSERT_X ( false, "calculateDataBoundaries()", 00361 "Type item does not match a defined line chart Type." ); 00362 } 00363 00364 QPointF bottomLeft( QPointF( xMin, yMin ) ); 00365 QPointF topRight( QPointF( xMax, yMax ) ); 00366 //qDebug() << "LineDiagram::calculateDataBoundaries () returns ( " << bottomLeft << topRight <<")"; 00367 return QPair<QPointF, QPointF> ( bottomLeft, topRight ); 00368 } |
|
Definition at line 930 of file KDChartAbstractDiagram.cpp. References KDChart::AbstractDiagram::coordinatePlane(). Referenced by KDChart::RingDiagram::calculateDataBoundaries(), KDChart::PolarDiagram::calculateDataBoundaries(), KDChart::PieDiagram::calculateDataBoundaries(), calculateDataBoundaries(), KDChart::BarDiagram::calculateDataBoundaries(), KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), KDChart::PieDiagram::paint(), paint(), KDChart::BarDiagram::paint(), and KDChart::AbstractDiagram::paintMarker().
00930 { 00931 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()", 00932 "There is no usable model set, for the diagram." ); 00933 00934 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()", 00935 "There is no usable coordinate plane set, for the diagram." ); 00936 } 00937 return model() && coordinatePlane(); 00938 } 00939 00940 int AbstractDiagram::datasetDimension( ) const |
|
Definition at line 74 of file KDChartLineDiagram.cpp. References d, and LineDiagram().
00075 { 00076 return new LineDiagram( new Private( *d ) ); 00077 } |
|
Definition at line 317 of file KDChartAbstractDiagram.cpp.
00323 { |
|
Returns true if both diagrams have the same settings.
Definition at line 135 of file KDChartAbstractDiagram.cpp.
00136 { 00137 if( other == this ) return true; 00138 if( ! other ){ 00139 //qDebug() << "AbstractDiagram::compare() cannot compare to Null pointer"; 00140 return false; 00141 } 00142 /* 00143 qDebug() << "\n AbstractDiagram::compare() QAbstractScrollArea:"; 00144 // compare QAbstractScrollArea properties 00145 qDebug() << 00146 ((horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) && 00147 (verticalScrollBarPolicy() == other->verticalScrollBarPolicy())); 00148 qDebug() << "AbstractDiagram::compare() QFrame:"; 00149 // compare QFrame properties 00150 qDebug() << 00151 ((frameShadow() == other->frameShadow()) && 00152 (frameShape() == other->frameShape()) && 00153 (frameWidth() == other->frameWidth()) && 00154 (lineWidth() == other->lineWidth()) && 00155 (midLineWidth() == other->midLineWidth())); 00156 qDebug() << "AbstractDiagram::compare() QAbstractItemView:"; 00157 // compare QAbstractItemView properties 00158 qDebug() << 00159 ((alternatingRowColors() == other->alternatingRowColors()) && 00160 (hasAutoScroll() == other->hasAutoScroll()) && 00161 #if QT_VERSION > 0x040199 00162 (dragDropMode() == other->dragDropMode()) && 00163 (dragDropOverwriteMode() == other->dragDropOverwriteMode()) && 00164 (horizontalScrollMode() == other->horizontalScrollMode ()) && 00165 (verticalScrollMode() == other->verticalScrollMode()) && 00166 #endif 00167 (dragEnabled() == other->dragEnabled()) && 00168 (editTriggers() == other->editTriggers()) && 00169 (iconSize() == other->iconSize()) && 00170 (selectionBehavior() == other->selectionBehavior()) && 00171 (selectionMode() == other->selectionMode()) && 00172 (showDropIndicator() == other->showDropIndicator()) && 00173 (tabKeyNavigation() == other->tabKeyNavigation()) && 00174 (textElideMode() == other->textElideMode())); 00175 qDebug() << "AbstractDiagram::compare() AttributesModel: "; 00176 // compare all of the properties stored in the attributes model 00177 qDebug() << attributesModel()->compare( other->attributesModel() ); 00178 qDebug() << "AbstractDiagram::compare() own:"; 00179 // compare own properties 00180 qDebug() << 00181 ((rootIndex().column() == other->rootIndex().column()) && 00182 (rootIndex().row() == other->rootIndex().row()) && 00183 (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) && 00184 (antiAliasing() == other->antiAliasing()) && 00185 (percentMode() == other->percentMode()) && 00186 (datasetDimension() == other->datasetDimension())); 00187 */ 00188 return // compare QAbstractScrollArea properties 00189 (horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) && 00190 (verticalScrollBarPolicy() == other->verticalScrollBarPolicy()) && 00191 // compare QFrame properties 00192 (frameShadow() == other->frameShadow()) && 00193 (frameShape() == other->frameShape()) && 00194 (frameWidth() == other->frameWidth()) && 00195 (lineWidth() == other->lineWidth()) && 00196 (midLineWidth() == other->midLineWidth()) && 00197 // compare QAbstractItemView properties 00198 (alternatingRowColors() == other->alternatingRowColors()) && 00199 (hasAutoScroll() == other->hasAutoScroll()) && 00200 #if QT_VERSION > 0x040199 00201 (dragDropMode() == other->dragDropMode()) && 00202 (dragDropOverwriteMode() == other->dragDropOverwriteMode()) && 00203 (horizontalScrollMode() == other->horizontalScrollMode ()) && 00204 (verticalScrollMode() == other->verticalScrollMode()) && 00205 #endif 00206 (dragEnabled() == other->dragEnabled()) && 00207 (editTriggers() == other->editTriggers()) && 00208 (iconSize() == other->iconSize()) && 00209 (selectionBehavior() == other->selectionBehavior()) && 00210 (selectionMode() == other->selectionMode()) && 00211 (showDropIndicator() == other->showDropIndicator()) && 00212 (tabKeyNavigation() == other->tabKeyNavigation()) && 00213 (textElideMode() == other->textElideMode()) && 00214 // compare all of the properties stored in the attributes model 00215 attributesModel()->compare( other->attributesModel() ) && 00216 // compare own properties 00217 (rootIndex().column() == other->rootIndex().column()) && 00218 (rootIndex().row() == other->rootIndex().row()) && 00219 (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) && 00220 (antiAliasing() == other->antiAliasing()) && 00221 (percentMode() == other->percentMode()) && 00222 (datasetDimension() == other->datasetDimension()); 00223 } |
|
Returns true if both diagrams have the same settings.
Definition at line 52 of file KDChartAbstractCartesianDiagram.cpp.
00053 { 00054 if( other == this ) return true; 00055 if( ! other ){ 00056 //qDebug() << "AbstractCartesianDiagram::compare() cannot compare to Null pointer"; 00057 return false; 00058 } 00059 /* 00060 qDebug() << "\n AbstractCartesianDiagram::compare():"; 00061 // compare own properties 00062 qDebug() << 00063 ((referenceDiagram() == other->referenceDiagram()) && 00064 ((! referenceDiagram()) || (referenceDiagramOffset() == other->referenceDiagramOffset()))); 00065 */ 00066 return // compare the base class 00067 ( static_cast<const AbstractDiagram*>(this)->compare( other ) ) && 00068 // compare own properties 00069 (referenceDiagram() == other->referenceDiagram()) && 00070 ((! referenceDiagram()) || (referenceDiagramOffset() == other->referenceDiagramOffset())); 00071 } |
|
Returns true if both diagrams have the same settings.
Definition at line 80 of file KDChartLineDiagram.cpp.
00081 { 00082 if( other == this ) return true; 00083 if( ! other ){ 00084 //qDebug() << "LineDiagram::compare() cannot compare to Null pointer"; 00085 return false; 00086 } 00087 /* 00088 qDebug() <<"\n LineDiagram::compare():"; 00089 // compare own properties 00090 qDebug() << (type() == other->type()); 00091 */ 00092 return // compare the base class 00093 ( static_cast<const AbstractCartesianDiagram*>(this)->compare( other ) ) && 00094 // compare own properties 00095 (type() == other->type()); 00096 } |
|
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 226 of file KDChartAbstractDiagram.cpp. References d. Referenced by KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractCartesianDiagram::layoutPlanes(), KDChart::PolarDiagram::paint(), paint(), KDChart::BarDiagram::paint(), KDChart::AbstractPolarDiagram::polarCoordinatePlane(), and KDChart::AbstractCartesianDiagram::setCoordinatePlane().
00227 { 00228 return d->plane; 00229 } |
|
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 231 of file KDChartAbstractDiagram.cpp. References KDChart::AbstractDiagram::calculateDataBoundaries(), and d. Referenced by KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), paint(), and KDChart::BarDiagram::paint().
00232 { 00233 if( d->databoundariesDirty ){ 00234 d->databoundaries = calculateDataBoundaries (); 00235 d->databoundariesDirty = false; 00236 } 00237 return d->databoundaries; 00238 } |
|
[reimplemented]
Definition at line 338 of file KDChartAbstractDiagram.cpp. References d.
00338 { 00339 // We are still too dumb to do intelligent updates... 00340 d->databoundariesDirty = true; 00341 scheduleDelayedItemsLayout(); 00342 } 00343 00344 |
|
This signal is emitted, when the hidden status of at least one data cell was (un)set.
|
|
The set of dataset brushes currently used, for use in legends, etc.
Definition at line 894 of file KDChartAbstractDiagram.cpp. Referenced by KDChart::Legend::buildLegend(), KDChart::Legend::datasetCount(), and KDChart::Legend::setBrushesFromDiagram().
00896 { 00897 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetBrushRole ) ); 00898 ret << brush; 00899 } 00900 00901 return ret; 00902 } 00903 00904 QList<QPen> AbstractDiagram::datasetPens() const |
|
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 942 of file KDChartAbstractDiagram.cpp. References d. Referenced by calculateDataBoundaries(), getCellValues(), KDChart::CartesianCoordinatePlane::getDataDimensionsList(), paint(), and setType().
00946 { |
|
The set of dataset labels currently displayed, for use in legends, etc.
Definition at line 882 of file KDChartAbstractDiagram.cpp. Referenced by KDChart::Legend::buildLegend(), and KDChart::Legend::datasetCount().
00883 : " << attributesModel()->columnCount(attributesModelRootIndex()) << "entries"; 00884 const int columnCount = attributesModel()->columnCount(attributesModelRootIndex()); 00885 for( int i = datasetDimension()-1; i < columnCount; i += datasetDimension() ){ 00886 //qDebug() << "dataset label: " << attributesModel()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString(); 00887 ret << attributesModel()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString(); 00888 } 00889 return ret; 00890 } 00891 00892 QList<QBrush> AbstractDiagram::datasetBrushes() const |
|
The set of dataset markers currently used, for use in legends, etc.
Definition at line 917 of file KDChartAbstractDiagram.cpp. Referenced by KDChart::Legend::buildLegend().
00919 { 00920 DataValueAttributes a = 00921 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataValueLabelAttributesRole ) ); 00922 const MarkerAttributes &ma = a.markerAttributes(); 00923 ret << ma; 00924 } 00925 return ret; 00926 } 00927 00928 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const |
|
The set of dataset pens currently used, for use in legends, etc.
Definition at line 906 of file KDChartAbstractDiagram.cpp. Referenced by KDChart::Legend::buildLegend().
00908 { 00909 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole ) ); 00910 ret << pen; 00911 } 00912 return ret; 00913 } 00914 00915 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const |
|
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.
Definition at line 427 of file KDChartAbstractDiagram.cpp.
00433 { |
|
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.
Definition at line 420 of file KDChartAbstractDiagram.cpp.
00426 { |
|
Retrieve the DataValueAttributes speficied globally. This will fall back automatically to the default settings, if there are no specific settings.
Definition at line 414 of file KDChartAbstractDiagram.cpp. Referenced by KDChart::AbstractDiagram::paintDataValueText(), and KDChart::AbstractDiagram::paintMarker().
00419 { |
|
[reimplemented]
Definition at line 329 of file KDChartAbstractDiagram.cpp. References d, and KDChart::AbstractDiagram::update().
00329 { 00330 d->plane->layoutDiagrams(); 00331 update(); 00332 } 00333 QAbstractItemView::doItemsLayout(); 00334 } 00335 00336 void AbstractDiagram::dataChanged( const QModelIndex &topLeft, |
|
Definition at line 398 of file KDChartLineDiagram.cpp. References KDChart::AbstractDiagram::datasetDimension(), lineAttributes(), KDChart::LineAttributes::missingValuesPolicy(), and valueForCellTesting(). Referenced by paint().
00402 { 00403 LineAttributes::MissingValuesPolicy policy; 00404 00405 bool bOK = true; 00406 valueX = ( datasetDimension() > 1 && column > 0 ) 00407 ? valueForCellTesting( row, column-1, bOK, true ) 00408 : ((shiftCountedXValuesByHalfSection ? 0.5 : 0.0) + row); 00409 if( bOK ) 00410 valueY = valueForCellTesting( row, column, bOK, true ); 00411 if( bOK ){ 00412 policy = LineAttributes::MissingValuesPolicyIgnored; 00413 }else{ 00414 // missing value: find out the policy 00415 QModelIndex index = model()->index( row, column, rootIndex() ); 00416 LineAttributes la = lineAttributes( index ); 00417 policy = la.missingValuesPolicy(); 00418 } 00419 return policy; 00420 } |
|
[reimplemented]
Definition at line 839 of file KDChartAbstractDiagram.cpp.
00841 { return 0; }
|
|
[reimplemented]
Definition at line 833 of file KDChartAbstractDiagram.cpp.
00835 { return QModelIndex(); }
|
|
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.
Definition at line 386 of file KDChartAbstractDiagram.cpp. |
|
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.
Definition at line 379 of file KDChartAbstractDiagram.cpp.
00385 { |
|
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 373 of file KDChartAbstractDiagram.cpp. Referenced by KDChart::Legend::buildLegend(), paint(), and valueForCellTesting().
00378 { |
|
[reimplemented]
Definition at line 845 of file KDChartAbstractDiagram.cpp.
00847 {} |
|
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Definition at line 870 of file KDChartAbstractDiagram.cpp.
00871 : " << attributesModel()->rowCount(attributesModelRootIndex()) << "entries"; 00872 const int rowCount = attributesModel()->rowCount(attributesModelRootIndex()); 00873 for( int i = 0; i < rowCount; ++i ){ 00874 //qDebug() << "item row label: " << attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString(); 00875 ret << attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString(); 00876 } 00877 return ret; 00878 } 00879 00880 QStringList AbstractDiagram::datasetLabels() const |
|
Definition at line 113 of file KDChartAbstractCartesianDiagram.cpp. References KDChart::AbstractDiagram::coordinatePlane(), and KDChart::AbstractCoordinatePlane::layoutPlanes(). Referenced by KDChart::AbstractCartesianDiagram::addAxis(), and KDChart::AbstractCartesianDiagram::takeAxis().
00114 { 00115 //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes()"; 00116 AbstractCoordinatePlane* plane = coordinatePlane(); 00117 if( plane ){ 00118 plane->layoutPlanes(); 00119 //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes() OK"; 00120 } 00121 } |
|
Definition at line 182 of file KDChartLineDiagram.cpp. References d.
|
|
Definition at line 174 of file KDChartLineDiagram.cpp. References d.
00175 { 00176 return qVariantValue<LineAttributes>( 00177 d->attributesModel->data( 00178 d->attributesModel->mapFromSource( columnToIndex( column ) ), 00179 KDChart::LineAttributesRole ) ); 00180 } |
|
Definition at line 168 of file KDChartLineDiagram.cpp. References d. Referenced by getCellValues(), and paint().
00169 { 00170 return qVariantValue<LineAttributes>( 00171 d->attributesModel->data( KDChart::LineAttributesRole ) ); 00172 } |
|
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::setModel(). |
|
[reimplemented]
Definition at line 836 of file KDChartAbstractDiagram.cpp.
00838 { return 0; }
|
|
Implements KDChart::AbstractCartesianDiagram. Definition at line 899 of file KDChartLineDiagram.cpp. References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.
00900 { 00901 return d->attributesModel->rowCount(attributesModelRootIndex()); 00902 } |
|
Implements KDChart::AbstractCartesianDiagram. Definition at line 904 of file KDChartLineDiagram.cpp. References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.
00905 { 00906 return d->attributesModel->columnCount(attributesModelRootIndex()); 00907 } |
|
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
Implements KDChart::AbstractDiagram. Definition at line 427 of file KDChartLineDiagram.cpp. References KDChart::AbstractDiagram::antiAliasing(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), d, KDChart::AbstractDiagram::dataBoundaries(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractThreeDAttributes::depth(), KDChart::LineAttributes::displayArea(), getCellValues(), KDChart::AbstractThreeDAttributes::isEnabled(), KDChart::AbstractDiagram::isHidden(), lineAttributes(), KDChart::PaintContext::painter(), KDChart::AbstractDiagram::pen(), KDChart::AbstractCartesianDiagram::referenceDiagram(), threeDLineAttributes(), KDChart::AbstractCoordinatePlane::translate(), KDChart::LineAttributes::transparency(), type(), and KDChart::AbstractDiagram::valueForCell(). Referenced by paintEvent().
00428 { 00429 //qDebug() << " start diag::paint()"; 00430 // note: Not having any data model assigned is no bug 00431 // but we can not draw a diagram then either. 00432 if ( !checkInvariants( true ) ) return; 00433 if ( !AbstractGrid::isBoundariesValid(dataBoundaries()) ) return; 00434 00435 // Make sure counted x values (== in diagrams with 1-dimensional data cells) 00436 // get shifted by 0.5, if the diagram's reference diagram is a BarDiagram. 00437 // So we get the lines to start/end at the middle of the respective bar groups. 00438 const bool shiftCountedXValuesByHalfSection = 00439 (dynamic_cast< BarDiagram* >( referenceDiagram() ) != 0); 00440 00441 //QTime t = QTime::currentTime(); 00442 00443 const QPair<QPointF, QPointF> boundaries = dataBoundaries(); 00444 const QPointF bottomLeft = boundaries.first; 00445 const QPointF topRight = boundaries.second; 00446 00447 int maxFound = 0; 00448 { // find the last column number that is not hidden 00449 const int columnCount = d->attributesModel->columnCount(attributesModelRootIndex()); 00450 for( int iColumn = datasetDimension()-1; 00451 iColumn < columnCount; 00452 iColumn += datasetDimension() ) 00453 if( ! isHidden( iColumn ) ) 00454 maxFound = iColumn; 00455 } 00456 const int lastVisibleColumn = maxFound; 00457 const int rowCount = d->attributesModel->rowCount(attributesModelRootIndex()); 00458 00459 DataValueTextInfoList list; 00460 LineAttributesInfoList lineList; 00461 LineAttributes::MissingValuesPolicy policy; 00462 00463 // paint different line types Normal - Stacked - Percent - Default Normal 00464 switch ( type() ) 00465 { 00466 case LineDiagram::Normal: 00467 { 00468 for( int iColumn = datasetDimension()-1; 00469 iColumn <= lastVisibleColumn; 00470 iColumn += datasetDimension() ) { 00471 00472 //display area can be set by dataset ( == column) and/or by cell 00473 LineAttributes laPreviousCell; // by default no area is drawn 00474 QModelIndex indexPreviousCell; 00475 QList<QPolygonF> areas; 00476 00477 bool bValuesFound = false; 00478 double lastValueX, lastValueY; 00479 double valueX, valueY; 00480 for ( int iRow = 0; iRow < rowCount; ++iRow ) { 00481 bool skipThisCell = false; 00482 // trying to find a fromPoint 00483 policy = getCellValues( iRow, iColumn, 00484 shiftCountedXValuesByHalfSection, 00485 valueX, valueY ); 00486 switch( policy ){ 00487 case LineAttributes::MissingValuesAreBridged: 00488 if( bValuesFound ){ 00489 valueX = lastValueX; 00490 valueY = lastValueY; 00491 }else{ 00492 skipThisCell = true; 00493 } 00494 break; 00495 case LineAttributes::MissingValuesHideSegments: 00496 skipThisCell = true; 00497 break; 00498 case LineAttributes::MissingValuesShownAsZero: 00499 // fall through intended 00500 case LineAttributes::MissingValuesPolicyIgnored: 00501 lastValueX = valueX; 00502 lastValueY = valueY; 00503 bValuesFound = true; 00504 break; 00505 } 00506 if( ! skipThisCell ){ 00507 // trying to find a toPoint 00508 double nextValueX, nextValueY; 00509 bool foundToPoint = false; 00510 int iNextRow = iRow+1; 00511 while ( ! (foundToPoint || skipThisCell || iNextRow >= rowCount) ) { 00512 policy = getCellValues( 00513 iNextRow, iColumn, 00514 shiftCountedXValuesByHalfSection, 00515 nextValueX, nextValueY ); 00516 switch( policy ){ 00517 case LineAttributes::MissingValuesAreBridged: 00518 // The cell has no valid value, so we make sure that 00519 // this cell will not be processed by the next iteration 00520 // of the iRow loop: 00521 ++iRow; 00522 break; 00523 case LineAttributes::MissingValuesHideSegments: 00524 // The cell has no valid value, so we make sure that 00525 // this cell will not be processed by the next iteration 00526 // of the iRow loop: 00527 skipThisCell = true; 00528 ++iRow; 00529 break; 00530 case LineAttributes::MissingValuesShownAsZero: 00531 // fall through intended 00532 case LineAttributes::MissingValuesPolicyIgnored: 00533 foundToPoint = true; 00534 break; 00535 } 00536 ++iNextRow; 00537 } 00538 if( ! skipThisCell ){ 00539 const bool isPositive = (valueY >= 0.0); 00540 const QModelIndex index = model()->index( iRow, iColumn, rootIndex() ); 00541 const LineAttributes laCell = lineAttributes( index ); 00542 const bool bDisplayCellArea = laCell.displayArea(); 00543 00544 QPointF fromPoint = coordinatePlane()->translate( QPointF( valueX, valueY ) ); 00545 00546 const QPointF ptNorthWest( 00547 (bDisplayCellArea && ! isPositive) 00548 ? coordinatePlane()->translate( QPointF( valueX, 0.0 ) ) 00549 : fromPoint ); 00550 const QPointF ptSouthWest( 00551 (bDisplayCellArea && isPositive) 00552 ? coordinatePlane()->translate( QPointF( valueX, 0.0 ) ) 00553 : fromPoint ); 00554 //qDebug() << "--> ptNorthWest:" << ptNorthWest; 00555 //qDebug() << "--> ptSouthWest:" << ptSouthWest; 00556 QPointF ptNorthEast; 00557 QPointF ptSouthEast; 00558 00559 if( foundToPoint ){ 00560 QPointF toPoint = coordinatePlane()->translate( QPointF( nextValueX, nextValueY ) ); 00561 lineList.append( LineAttributesInfo( index, fromPoint, toPoint ) ); 00562 ptNorthEast = 00563 (bDisplayCellArea && ! isPositive) 00564 ? coordinatePlane()->translate( QPointF( nextValueX, 0.0 ) ) 00565 : toPoint; 00566 ptSouthEast = 00567 (bDisplayCellArea && isPositive) 00568 ? coordinatePlane()->translate( QPointF( nextValueX, 0.0 ) ) 00569 : toPoint; 00570 // we can't take as a condition the line attributes 00571 // to be different from a cell to another. 00572 // e.g the user should be able to have different brush 00573 // which is not reflected in the line attributes 00574 // see examples/Area which show such an option 00575 if( areas.count() /*&& laCell != laPreviousCell*/ ){ 00576 paintAreas( ctx, indexPreviousCell, areas, laPreviousCell.transparency() ); 00577 areas.clear(); 00578 } 00579 if( bDisplayCellArea ){ 00580 QPolygonF poly; 00581 poly << ptNorthWest << ptNorthEast << ptSouthEast << ptSouthWest; 00582 //qDebug() << "ptNorthWest:" << ptNorthWest; 00583 //qDebug() << "ptNorthEast:" << ptNorthEast; 00584 //qDebug() << "ptSouthEast:" << ptSouthEast; 00585 //qDebug() << "ptSouthWest:" << ptSouthWest; 00586 //qDebug() << "polygon:" << poly; 00587 areas << poly; 00588 laPreviousCell = laCell; 00589 indexPreviousCell = index; 00590 } 00591 }else{ 00592 ptNorthEast = ptNorthWest; 00593 ptSouthEast = ptSouthWest; 00594 } 00595 00596 const PositionPoints pts( ptNorthWest, ptNorthEast, ptSouthEast, ptSouthWest ); 00597 d->appendDataValueTextInfoToList( this, list, index, pts, 00598 Position::NorthWest, Position::SouthWest, 00599 valueY ); 00600 } 00601 } 00602 } 00603 if( areas.count() ){ 00604 paintAreas( ctx, indexPreviousCell, areas, laPreviousCell.transparency() ); 00605 areas.clear(); 00606 } 00607 } 00608 } 00609 break; 00610 case LineDiagram::Stacked: 00611 // fall-through intended 00612 case LineDiagram::Percent: 00613 { 00614 //FIXME(khz): add LineAttributes::MissingValuesPolicy support for LineDiagram::Stacked and ::Percent 00615 00616 const bool isPercentMode = type() == LineDiagram::Percent; 00617 double maxValue = 100; // always 100% 00618 double sumValues = 0; 00619 QVector <double > percentSumValues; 00620 00621 //calculate sum of values for each column and store 00622 if( isPercentMode ){ 00623 for ( int j=0; j<rowCount ; ++j ) { 00624 for( int i = datasetDimension()-1; 00625 i <= lastVisibleColumn; 00626 i += datasetDimension() ) { 00627 double tmpValue = valueForCell( j, i ); 00628 if ( tmpValue > 0 ) 00629 sumValues += tmpValue; 00630 if ( i == lastVisibleColumn ) { 00631 percentSumValues << sumValues ; 00632 sumValues = 0; 00633 } 00634 } 00635 } 00636 } 00637 00638 QList<QPointF> bottomPoints; 00639 bool bFirstDataset = true; 00640 00641 for( int iColumn = datasetDimension()-1; 00642 iColumn <= lastVisibleColumn; 00643 iColumn += datasetDimension() ) { 00644 00645 //display area can be set by dataset ( == column) and/or by cell 00646 LineAttributes laPreviousCell; // by default no area is drawn 00647 QModelIndex indexPreviousCell; 00648 QList<QPolygonF> areas; 00649 QList<QPointF> points; 00650 00651 for ( int iRow = 0; iRow< rowCount; ++iRow ) { 00652 const QModelIndex index = model()->index( iRow, iColumn, rootIndex() ); 00653 const LineAttributes laCell = lineAttributes( index ); 00654 const bool bDisplayCellArea = laCell.displayArea(); 00655 00656 double stackedValues = 0, nextValues = 0; 00657 for ( int iColumn2 = iColumn; 00658 iColumn2 >= datasetDimension()-1; 00659 iColumn2 -= datasetDimension() ) 00660 { 00661 const double val = valueForCell( iRow, iColumn2 ); 00662 if( val > 0 || ! isPercentMode ) 00663 stackedValues += val; 00664 //qDebug() << valueForCell( iRow, iColumn2 ); 00665 if ( iRow+1 < rowCount ){ 00666 const double val = valueForCell( iRow+1, iColumn2 ); 00667 if( val > 0 || ! isPercentMode ) 00668 nextValues += val; 00669 } 00670 } 00671 if( isPercentMode ){ 00672 if ( percentSumValues.at( iRow ) != 0 ) 00673 stackedValues = stackedValues / percentSumValues.at( iRow ) * maxValue; 00674 else 00675 stackedValues = 0.0; 00676 } 00677 //qDebug() << stackedValues << endl; 00678 QPointF nextPoint = coordinatePlane()->translate( QPointF( iRow, stackedValues ) ); 00679 points << nextPoint; 00680 00681 const QPointF ptNorthWest( nextPoint ); 00682 const QPointF ptSouthWest( 00683 bDisplayCellArea 00684 ? ( bFirstDataset 00685 ? coordinatePlane()->translate( QPointF( iRow, 0.0 ) ) 00686 : bottomPoints.at( iRow ) 00687 ) 00688 : nextPoint ); 00689 QPointF ptNorthEast; 00690 QPointF ptSouthEast; 00691 00692 if ( iRow+1 < rowCount ){ 00693 if( isPercentMode ){ 00694 if ( percentSumValues.at( iRow+1 ) != 0 ) 00695 nextValues = nextValues / percentSumValues.at( iRow+1 ) * maxValue; 00696 else 00697 nextValues = 0.0; 00698 } 00699 QPointF toPoint = coordinatePlane()->translate( QPointF( iRow+1, nextValues ) ); 00700 lineList.append( LineAttributesInfo( index, nextPoint, toPoint ) ); 00701 ptNorthEast = toPoint; 00702 ptSouthEast = 00703 bDisplayCellArea 00704 ? ( bFirstDataset 00705 ? coordinatePlane()->translate( QPointF( iRow+1, 0.0 ) ) 00706 : bottomPoints.at( iRow+1 ) 00707 ) 00708 : toPoint; 00709 if( areas.count() && laCell != laPreviousCell ){ 00710 paintAreas( ctx, indexPreviousCell, areas, laPreviousCell.transparency() ); 00711 areas.clear(); 00712 } 00713 if( bDisplayCellArea ){ 00714 QPolygonF poly; 00715 poly << ptNorthWest << ptNorthEast << ptSouthEast << ptSouthWest; 00716 areas << poly; 00717 laPreviousCell = laCell; 00718 indexPreviousCell = index; 00719 }else{ 00720 //qDebug() << "no area shown for row"<<iRow<<" column"<<iColumn; 00721 } 00722 }else{ 00723 ptNorthEast = ptNorthWest; 00724 ptSouthEast = ptSouthWest; 00725 } 00726 00727 const PositionPoints pts( ptNorthWest, ptNorthEast, ptSouthEast, ptSouthWest ); 00728 d->appendDataValueTextInfoToList( this, list, index, pts, 00729 Position::NorthWest, Position::SouthWest, 00730 valueForCell( iRow, iColumn ) ); 00731 } 00732 if( areas.count() ){ 00733 paintAreas( ctx, indexPreviousCell, areas, laPreviousCell.transparency() ); 00734 areas.clear(); 00735 } 00736 bottomPoints = points; 00737 bFirstDataset = false; 00738 } 00739 } 00740 break; 00741 default: 00742 Q_ASSERT_X ( false, "paint()", 00743 "Type item does not match a defined line chart Type." ); 00744 } 00745 // paint all lines and their attributes 00746 { 00747 PainterSaver painterSaver( ctx->painter() ); 00748 if ( antiAliasing() ) 00749 ctx->painter()->setRenderHint ( QPainter::Antialiasing ); 00750 LineAttributesInfoListIterator itline ( lineList ); 00751 00752 //qDebug() << "Rendering 1 in: " << t.msecsTo( QTime::currentTime() ) << endl; 00753 00754 QBrush curBrush; 00755 QPen curPen; 00756 QPolygonF points; 00757 while ( itline.hasNext() ) { 00758 const LineAttributesInfo& lineInfo = itline.next(); 00759 const QModelIndex& index = lineInfo.index; 00760 const ThreeDLineAttributes td = threeDLineAttributes( index ); 00761 if( td.isEnabled() ){ 00762 paintThreeDLines( ctx, index, lineInfo.value, lineInfo.nextValue, td.depth() ); 00763 }else{ 00764 const QBrush br( brush( index ) ); 00765 const QPen pn( pen( index ) ); 00766 if( points.count() && points.last() == lineInfo.value && curBrush == br && curPen == pn ){ 00767 points << lineInfo.nextValue; 00768 }else{ 00769 if( points.count() ) 00770 paintPolyline( ctx, curBrush, curPen, points ); 00771 curBrush = br; 00772 curPen = pn; 00773 points.clear(); 00774 points << lineInfo.value << lineInfo.nextValue; 00775 } 00776 } 00777 } 00778 if( points.count() ) 00779 paintPolyline( ctx, curBrush, curPen, points ); 00780 } 00781 // paint all data value texts and the point markers 00782 d->paintDataValueTextsAndMarkers( this, ctx, list, true ); 00783 //qDebug() << "Rendering 2 in: " << t.msecsTo( QTime::currentTime() ) << endl; 00784 } |
|
Definition at line 474 of file KDChartAbstractDiagram.cpp. References KDChart::RelativePosition::alignment(), KDChart::TextAttributes::calculatedFont(), d, KDChart::DataValueAttributes::dataLabel(), KDChart::AbstractDiagram::dataValueAttributes(), KDChart::DataValueAttributes::decimalDigits(), KDChart::TextAttributes::isVisible(), KDChart::DataValueAttributes::isVisible(), KDChart::TextAttributes::pen(), KDChart::DataValueAttributes::position(), KDChart::DataValueAttributes::prefix(), KDChart::TextAttributes::rotation(), KDChart::DataValueAttributes::showRepetitiveDataLabels(), KDChart::DataValueAttributes::suffix(), and KDChart::DataValueAttributes::textAttributes(). Referenced by KDChart::RingDiagram::paint(), and KDChart::PolarDiagram::paint().
00476 { 00477 // paint one data series 00478 const DataValueAttributes a( dataValueAttributes(index) ); 00479 if ( !a.isVisible() ) return; 00480 00481 // handle decimal digits 00482 int decimalDigits = a.decimalDigits(); 00483 int decimalPos = QString::number( value ).indexOf( QLatin1Char( '.' ) ); 00484 QString roundedValue; 00485 if ( a.dataLabel().isNull() ) { 00486 if ( decimalPos > 0 && value != 0 ) 00487 roundedValue = roundValues ( value, decimalPos, decimalDigits ); 00488 else 00489 roundedValue = QString::number( value ); 00490 } else 00491 roundedValue = a.dataLabel(); 00492 // handle prefix and suffix 00493 if ( !a.prefix().isNull() ) 00494 roundedValue.prepend( a.prefix() ); 00495 00496 if ( !a.suffix().isNull() ) 00497 roundedValue.append( a.suffix() ); 00498 00499 const TextAttributes ta( a.textAttributes() ); 00500 // FIXME draw the non-text bits, background, etc 00501 if ( ta.isVisible() ) { 00502 00503 QPointF pt( pos ); 00504 /* for debugging: 00505 PainterSaver painterSaver( painter ); 00506 painter->setPen( Qt::black ); 00507 painter->drawLine( pos - QPointF( 1,1), pos + QPointF( 1,1) ); 00508 painter->drawLine( pos - QPointF(-1,1), pos + QPointF(-1,1) ); 00509 */ 00510 00511 // adjust the text start point position, if alignment is not Bottom/Left 00512 const RelativePosition relPos( a.position( value >= 0.0 ) ); 00513 const Qt::Alignment alignBottomLeft = Qt::AlignBottom | Qt::AlignLeft; 00514 const QFont calculatedFont( ta.calculatedFont( d->plane, KDChartEnums::MeasureOrientationMinimum ) ); 00515 //qDebug() << "calculatedFont's point size:" << calculatedFont.pointSizeF(); 00516 if( (relPos.alignment() & alignBottomLeft) != alignBottomLeft ){ 00517 const QRectF boundRect( 00518 d->cachedFontMetrics( calculatedFont, this )->boundingRect( roundedValue ) ); 00519 if( relPos.alignment() & Qt::AlignRight ) 00520 pt.rx() -= boundRect.width(); 00521 else if( relPos.alignment() & Qt::AlignHCenter ) 00522 pt.rx() -= 0.5 * boundRect.width(); 00523 00524 if( relPos.alignment() & Qt::AlignTop ) 00525 pt.ry() += boundRect.height(); 00526 else if( relPos.alignment() & Qt::AlignVCenter ) 00527 pt.ry() += 0.5 * boundRect.height(); 00528 } 00529 00530 // FIXME draw the non-text bits, background, etc 00531 00532 if ( a.showRepetitiveDataLabels() || 00533 pos.x() <= d->lastX || 00534 d->lastRoundedValue != roundedValue ) { 00535 d->lastRoundedValue = roundedValue; 00536 d->lastX = pos.x(); 00537 00538 PainterSaver painterSaver( painter ); 00539 painter->setPen( ta.pen() ); 00540 painter->setFont( calculatedFont ); 00541 painter->translate( pt ); 00542 painter->rotate( ta.rotation() ); 00543 painter->drawText( QPointF(0, 0), roundedValue ); 00544 } 00545 } 00546 } 00547 00548 |
|
Definition at line 576 of file KDChartAbstractDiagram.cpp.
00579 { 00580 for ( int j=0; j< rowCount; ++j ) { 00581 const QModelIndex index = model()->index( j, i, rootIndex() ); 00582 double value = model()->data( index ).toDouble(); 00583 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) ); 00584 paintDataValueText( painter, index, pos, value ); 00585 } 00586 } 00587 } 00588 00589 |
|
Definition at line 371 of file KDChartLineDiagram.cpp. References paint(), KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().
00372 { 00373 //qDebug() << "starting LineDiagram::paintEvent ( QPaintEvent*)"; 00374 QPainter painter ( viewport() ); 00375 PaintContext ctx; 00376 ctx.setPainter ( &painter ); 00377 ctx.setRectangle ( QRectF ( 0, 0, width(), height() ) ); 00378 paint ( &ctx ); 00379 //qDebug() << " LineDiagram::paintEvent ( QPaintEvent*) ended."; 00380 } |
|
|
Definition at line 614 of file KDChartAbstractDiagram.cpp. References KDChart::MarkerAttributes::markerStyle(). Referenced by KDChart::MarkerLayoutItem::paintIntoRect(), and KDChart::AbstractDiagram::paintMarker().
00618 { 00619 00620 const QPen oldPen( painter->pen() ); 00621 // Pen is used to paint 4Pixels - 1 Pixel - Ring and FastCross types. 00622 // make sure to use the brush color - see above in those cases. 00623 const bool isFourPixels = (markerAttributes.markerStyle() == MarkerAttributes::Marker4Pixels); 00624 if( isFourPixels || (markerAttributes.markerStyle() == MarkerAttributes::Marker1Pixel) ){ 00625 // for high-performance point charts with tiny point markers: 00626 painter->setPen( QPen( brush.color().light() ) ); 00627 if( isFourPixels ){ 00628 const qreal x = pos.x(); 00629 const qreal y = pos.y(); 00630 painter->drawLine( QPointF(x-1.0,y-1.0), 00631 QPointF(x+1.0,y-1.0) ); 00632 painter->drawLine( QPointF(x-1.0,y), 00633 QPointF(x+1.0,y) ); 00634 painter->drawLine( QPointF(x-1.0,y+1.0), 00635 QPointF(x+1.0,y+1.0) ); 00636 } 00637 painter->drawPoint( pos ); 00638 }else{ 00639 PainterSaver painterSaver( painter ); 00640 // we only a solid line surrounding the markers 00641 QPen painterPen( pen ); 00642 painterPen.setStyle( Qt::SolidLine ); 00643 painter->setPen( painterPen ); 00644 painter->setBrush( brush ); 00645 painter->setRenderHint ( QPainter::Antialiasing ); 00646 painter->translate( pos ); 00647 switch ( markerAttributes.markerStyle() ) { 00648 case MarkerAttributes::MarkerCircle: 00649 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2, 00650 maSize.height(), maSize.width()) ); 00651 break; 00652 case MarkerAttributes::MarkerSquare: 00653 { 00654 QRectF rect( 0 - maSize.width()/2, 0 - maSize.height()/2, 00655 maSize.width(), maSize.height() ); 00656 painter->drawRect( rect ); 00657 painter->fillRect( rect, brush.color() ); 00658 break; 00659 } 00660 case MarkerAttributes::MarkerDiamond: 00661 { 00662 QVector <QPointF > diamondPoints; 00663 QPointF top, left, bottom, right; 00664 top = QPointF( 0, 0 - maSize.height()/2 ); 00665 left = QPointF( 0 - maSize.width()/2, 0 ); 00666 bottom = QPointF( 0, maSize.height()/2 ); 00667 right = QPointF( maSize.width()/2, 0 ); 00668 diamondPoints << top << left << bottom << right; 00669 painter->drawPolygon( diamondPoints ); 00670 break; 00671 } 00672 // both handled on top of the method: 00673 case MarkerAttributes::Marker1Pixel: 00674 case MarkerAttributes::Marker4Pixels: 00675 break; 00676 case MarkerAttributes::MarkerRing: 00677 { 00678 painter->setPen( QPen( brush.color() ) ); 00679 painter->setBrush( Qt::NoBrush ); 00680 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2, 00681 maSize.height(), maSize.width()) ); 00682 break; 00683 } 00684 case MarkerAttributes::MarkerCross: 00685 { 00686 QRectF rect( maSize.width()*-0.5, maSize.height()*-0.2, 00687 maSize.width(), maSize.height()*0.4 ); 00688 painter->drawRect( rect ); 00689 rect.setTopLeft(QPointF( maSize.width()*-0.2, maSize.height()*-0.5 )); 00690 rect.setSize(QSizeF( maSize.width()*0.4, maSize.height() )); 00691 painter->drawRect( rect ); 00692 break; 00693 } 00694 case MarkerAttributes::MarkerFastCross: 00695 { 00696 QPointF left, right, top, bottom; 00697 left = QPointF( -maSize.width()/2, 0 ); 00698 right = QPointF( maSize.width()/2, 0 ); 00699 top = QPointF( 0, -maSize.height()/2 ); 00700 bottom= QPointF( 0, maSize.height()/2 ); 00701 painter->setPen( QPen( brush.color() ) ); 00702 painter->drawLine( left, right ); 00703 painter->drawLine( top, bottom ); 00704 break; 00705 } 00706 default: 00707 Q_ASSERT_X ( false, "paintMarkers()", 00708 "Type item does not match a defined Marker Type." ); 00709 } 00710 } 00711 painter->setPen( oldPen ); 00712 } 00713 00714 void AbstractDiagram::paintMarkers( QPainter* painter ) |
|
Definition at line 716 of file KDChartAbstractDiagram.cpp.
00719 { 00720 for ( int j=0; j< rowCount; ++j ) { 00721 const QModelIndex index = model()->index( j, i, rootIndex() ); 00722 double value = model()->data( index ).toDouble(); 00723 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) ); 00724 paintMarker( painter, index, pos ); 00725 } 00726 } 00727 } 00728 00729 |
|
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Definition at line 770 of file KDChartAbstractDiagram.cpp.
00777 { |
|
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.
Definition at line 762 of file KDChartAbstractDiagram.cpp.
00769 { |
|
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 756 of file KDChartAbstractDiagram.cpp. Referenced by KDChart::PieDiagram::paint(), and paint().
00761 { |
|
Definition at line 468 of file KDChartAbstractDiagram.cpp. References d. Referenced by KDChart::CartesianCoordinatePlane::getDataDimensionsList(). |
|
Emitted upon change of a property of the Diagram.
Referenced by resetLineAttributes(), KDChart::AbstractDiagram::setDataValueAttributes(), setLineAttributes(), setThreeDLineAttributes(), and setType(). |
|
Definition at line 146 of file KDChartAbstractCartesianDiagram.cpp. References d. Referenced by paint(), and referenceDiagramIsBarDiagram().
00147 { 00148 return d->referenceDiagram; 00149 } |
|
Definition at line 151 of file KDChartAbstractCartesianDiagram.cpp. References d.
00152 { 00153 return d->referenceDiagramOffset; 00154 } |
|
Remove any explicit line attributes settings that might have been specified before.
Definition at line 161 of file KDChartLineDiagram.cpp. References d, KDChart::LineAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00162 { 00163 d->attributesModel->resetData( 00164 d->attributesModel->mapFromSource(index), LineAttributesRole ); 00165 emit propertiesChanged(); 00166 } |
|
Definition at line 140 of file KDChartLineDiagram.cpp. References d, KDChart::LineAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00141 { 00142 d->attributesModel->resetHeaderData( 00143 column, Qt::Vertical, LineAttributesRole ); 00144 emit propertiesChanged(); 00145 } |
|
Called by the widget's sizeEvent. Adjust all internal structures, that are calculated, dependending on the size of the widget.
Implements KDChart::AbstractDiagram. Definition at line 895 of file KDChartLineDiagram.cpp.
00896 { 00897 } |
|
Definition at line 263 of file KDChartLineDiagram.cpp.
00264 { 00265 } |
|
[reimplemented]
Definition at line 830 of file KDChartAbstractDiagram.cpp.
00832 { return QModelIndex(); }
|
|
Set whether data value labels are allowed to overlap.
Definition at line 440 of file KDChartAbstractDiagram.cpp. References d.
00445 { |
|
Set whether anti-aliasing is to be used while rendering this diagram.
Definition at line 451 of file KDChartAbstractDiagram.cpp. References d.
00456 { |
|
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:
Wrong:
Definition at line 261 of file KDChartAbstractDiagram.cpp. References d, and KDChart::AbstractDiagram::modelsChanged().
00262 { 00263 if( amodel->sourceModel() != model() ) { 00264 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: " 00265 "Trying to set an attributesmodel which works on a different " 00266 "model than the diagram."); 00267 return; 00268 } 00269 if( qobject_cast<PrivateAttributesModel*>(amodel) ) { 00270 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: " 00271 "Trying to set an attributesmodel that is private to another diagram."); 00272 return; 00273 } 00274 d->setAttributesModel(amodel); 00275 scheduleDelayedItemsLayout(); 00276 d->databoundariesDirty = true; 00277 emit modelsChanged(); 00278 } |
|
Definition at line 301 of file KDChartAbstractDiagram.cpp. References d. |
|
Set the brush to be used, for painting all datasets in the model.
Definition at line 786 of file KDChartAbstractDiagram.cpp.
00792 { |
|
Set the brush to be used, for painting the given dataset.
Definition at line 793 of file KDChartAbstractDiagram.cpp.
00801 { |
|
Set the brush to be used, for painting the datapoint at the given index.
Definition at line 778 of file KDChartAbstractDiagram.cpp.
00785 { |
|
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 from KDChart::AbstractDiagram. Definition at line 123 of file KDChartAbstractCartesianDiagram.cpp. References KDChart::AbstractDiagram::coordinatePlane(), and KDChart::AbstractDiagram::setCoordinatePlane().
00124 { 00125 if( coordinatePlane() ) disconnect( coordinatePlane() ); 00126 AbstractDiagram::setCoordinatePlane(plane); 00127 00128 // show the axes, after all have been adjusted 00129 // (because they might be dependend on each other) 00130 /* 00131 if( plane ) 00132 Q_FOREACH( CartesianAxis* axis, d->axesList ) 00133 axis->show(); 00134 else 00135 Q_FOREACH( CartesianAxis* axis, d->axesList ) 00136 axis->hide(); 00137 */ 00138 } |
|
Definition at line 240 of file KDChartAbstractDiagram.cpp. References d. Referenced by KDChart::BarDiagram::setThreeDBarAttributes(), setThreeDLineAttributes(), setType(), and KDChart::BarDiagram::setType().
00241 { 00242 d->databoundariesDirty = true; 00243 } |
|
Sets the dataset dimension of the diagram.
Definition at line 947 of file KDChartAbstractDiagram.cpp. References d.
00954 { |
|
Set the DataValueAttributes for all datapoints in the model.
Definition at line 434 of file KDChartAbstractDiagram.cpp. References d.
00439 { |
|
Set the DataValueAttributes for the given dataset.
Definition at line 406 of file KDChartAbstractDiagram.cpp. References d.
00413 { |
|
Set the DataValueAttributes for the given index.
Definition at line 395 of file KDChartAbstractDiagram.cpp. References d, KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00395 { 00396 d->attributesModel->setData( 00397 d->attributesModel->mapFromSource( index ), 00398 qVariantFromValue( a ), 00399 DataValueLabelAttributesRole ); 00400 emit propertiesChanged(); 00401 } 00402 00403 |
|
Hide (or unhide, resp.) all datapoints in the model.
Definition at line 365 of file KDChartAbstractDiagram.cpp. References d.
00372 { |
|
Hide (or unhide, resp.) a dataset.
Definition at line 356 of file KDChartAbstractDiagram.cpp. References d.
00364 { |
|
Hide (or unhide, resp.) a data cell.
Definition at line 347 of file KDChartAbstractDiagram.cpp. References d, and KDChart::DataHiddenRole.
00355 { |
|
Definition at line 147 of file KDChartLineDiagram.cpp. References d, KDChart::LineAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00150 { 00151 d->attributesModel->setData( 00152 d->attributesModel->mapFromSource(index), 00153 qVariantFromValue( ta ), 00154 LineAttributesRole ); 00155 emit propertiesChanged(); 00156 } |
|
Definition at line 128 of file KDChartLineDiagram.cpp. References d, KDChart::LineAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00131 { 00132 d->attributesModel->setHeaderData( 00133 column, 00134 Qt::Vertical, 00135 qVariantFromValue( ta ), 00136 LineAttributesRole ); 00137 emit propertiesChanged(); 00138 } |
|
Definition at line 120 of file KDChartLineDiagram.cpp. References d, KDChart::LineAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().
00121 { 00122 d->attributesModel->setModelData( 00123 qVariantFromValue( ta ), 00124 LineAttributesRole ); 00125 emit propertiesChanged(); 00126 } |
|
Associate a model with the diagram.
Definition at line 245 of file KDChartAbstractDiagram.cpp. References d, KDChart::AttributesModel::initFrom(), and KDChart::AbstractDiagram::modelsChanged().
00246 { 00247 QAbstractItemView::setModel( newModel ); 00248 AttributesModel* amodel = new PrivateAttributesModel( newModel, this ); 00249 amodel->initFrom( d->attributesModel ); 00250 d->setAttributesModel(amodel); 00251 scheduleDelayedItemsLayout(); 00252 d->databoundariesDirty = true; 00253 emit modelsChanged(); 00254 } |
|
Set the pen to be used, for painting all datasets in the model.
Definition at line 740 of file KDChartAbstractDiagram.cpp.
00746 { |
|
Set the pen to be used, for painting the given dataset.
Definition at line 747 of file KDChartAbstractDiagram.cpp.
00755 { |
|
Set the pen to be used, for painting the datapoint at the given index.
Definition at line 732 of file KDChartAbstractDiagram.cpp.
00739 { |
|
Definition at line 462 of file KDChartAbstractDiagram.cpp. References d. Referenced by setType(), and KDChart::BarDiagram::setType().
00467 { |
|
Definition at line 140 of file KDChartAbstractCartesianDiagram.cpp. References d.
|
|
Set the root index in the model, where the diagram starts referencing data for display. [reimplemented] Definition at line 294 of file KDChartAbstractDiagram.cpp. References d. |
|
[reimplemented]
Definition at line 848 of file KDChartAbstractDiagram.cpp.
00850 { return QRegion(); }
|
|
Definition at line 214 of file KDChartLineDiagram.cpp. References d, KDChart::AbstractDiagram::propertiesChanged(), KDChart::AbstractDiagram::setDataBoundariesDirty(), and KDChart::ThreeDLineAttributesRole.
00217 { 00218 setDataBoundariesDirty(); 00219 d->attributesModel->setData( 00220 d->attributesModel->mapFromSource(index), 00221 qVariantFromValue( ta ), 00222 ThreeDLineAttributesRole ); 00223 emit propertiesChanged(); 00224 } |
|
Definition at line 201 of file KDChartLineDiagram.cpp. References d, KDChart::AbstractDiagram::propertiesChanged(), KDChart::AbstractDiagram::setDataBoundariesDirty(), and KDChart::ThreeDLineAttributesRole.
00204 { 00205 setDataBoundariesDirty(); 00206 d->attributesModel->setHeaderData( 00207 column, 00208 Qt::Vertical, 00209 qVariantFromValue( ta ), 00210 ThreeDLineAttributesRole ); 00211 emit propertiesChanged(); 00212 } |
|
Definition at line 191 of file KDChartLineDiagram.cpp. References d, KDChart::AbstractDiagram::propertiesChanged(), KDChart::AbstractDiagram::setDataBoundariesDirty(), and KDChart::ThreeDLineAttributesRole.
00193 { 00194 setDataBoundariesDirty(); 00195 d->attributesModel->setModelData( 00196 qVariantFromValue( ta ), 00197 ThreeDLineAttributesRole ); 00198 emit propertiesChanged(); 00199 } |
|
Definition at line 99 of file KDChartLineDiagram.cpp. References d, KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::propertiesChanged(), KDChart::AbstractDiagram::setDataBoundariesDirty(), and KDChart::AbstractDiagram::setPercentMode().
00100 { 00101 if ( d->lineType == type ) return; 00102 if ( type != LineDiagram::Normal && datasetDimension() > 1 ) { 00103 Q_ASSERT_X ( false, "setType()", 00104 "This line chart type can't be used with multi-dimensional data." ); 00105 return; 00106 } 00107 d->lineType = type; 00108 // AbstractAxis settings - see AbstractDiagram and CartesianAxis 00109 setPercentMode( type == LineDiagram::Percent ); 00110 setDataBoundariesDirty(); 00111 emit layoutChanged( this ); 00112 emit propertiesChanged(); 00113 } |
|
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.
Definition at line 98 of file KDChartAbstractCartesianDiagram.cpp. References d, KDChart::AbstractAxis::deleteObserver(), KDChart::AbstractCartesianDiagram::layoutPlanes(), and KDChart::AbstractLayoutItem::setParentWidget(). Referenced by KDChart::CartesianAxis::~CartesianAxis().
00099 { 00100 const int idx = d->axesList.indexOf( axis ); 00101 if( idx != -1 ) 00102 d->axesList.takeAt( idx ); 00103 axis->deleteObserver( this ); 00104 axis->setParentWidget( 0 ); 00105 layoutPlanes(); 00106 } |
|
Implements KDChart::AbstractCartesianDiagram. Definition at line 254 of file KDChartLineDiagram.cpp. References d.
00255 { 00256 return qVariantValue<ThreeDLineAttributes>( 00257 d->attributesModel->headerData ( 00258 column, 00259 Qt::Vertical, 00260 KDChart::ThreeDLineAttributesRole ) ).validDepth(); 00261 } |
|
Implements KDChart::AbstractCartesianDiagram. Definition at line 249 of file KDChartLineDiagram.cpp. References threeDLineAttributes(), and KDChart::AbstractThreeDAttributes::validDepth().
00250 { 00251 return threeDLineAttributes( index ).validDepth(); 00252 } |
|
Definition at line 240 of file KDChartLineDiagram.cpp. References d.
|
|
Definition at line 232 of file KDChartLineDiagram.cpp. References d.
00233 { 00234 return qVariantValue<ThreeDLineAttributes>( 00235 d->attributesModel->data( 00236 d->attributesModel->mapFromSource( columnToIndex( column ) ), 00237 KDChart::ThreeDLineAttributesRole ) ); 00238 } |
|
Definition at line 226 of file KDChartLineDiagram.cpp. References d. Referenced by paint(), and threeDItemDepth().
00227 { 00228 return qVariantValue<ThreeDLineAttributes>( 00229 d->attributesModel->data( KDChart::ThreeDLineAttributesRole ) ); 00230 } |
|
Definition at line 115 of file KDChartLineDiagram.cpp. References d. Referenced by calculateDataBoundaries(), and paint().
00116 { 00117 return d->lineType; 00118 } |
|
Definition at line 961 of file KDChartAbstractDiagram.cpp. References d. Referenced by KDChart::AbstractDiagram::doItemsLayout(). |
|
Set the palette to be used, for painting datasets to the default palette.
Definition at line 855 of file KDChartAbstractDiagram.cpp. References d.
00859 { |
|
Set the palette to be used, for painting datasets to the rainbow palette.
Definition at line 865 of file KDChartAbstractDiagram.cpp. References d.
00869 { |
|
Returns whether the diagram is using its own built-in attributes model or an attributes model that was set via setAttributesModel.
Definition at line 280 of file KDChartAbstractDiagram.cpp. References d.
00281 { 00282 return d->usesExternalAttributesModel(); 00283 } |
|
Set the palette to be used, for painting datasets to the subdued palette.
Definition at line 860 of file KDChartAbstractDiagram.cpp. References d.
00864 { |
|
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Definition at line 955 of file KDChartAbstractDiagram.cpp. References KDChart::AbstractDiagram::attributesModelRootIndex(), and d. Referenced by paint().
00960 { |
|
Definition at line 383 of file KDChartLineDiagram.cpp. References d, and KDChart::AbstractDiagram::isHidden(). Referenced by calculateDataBoundaries(), and getCellValues().
00386 { 00387 double value; 00388 if( showHiddenCellsAsInvalid && isHidden( model()->index( row, column, rootIndex() ) ) ) 00389 bOK = false; 00390 else 00391 value = d->attributesModel->data( 00392 d->attributesModel->index( row, column, attributesModelRootIndex() ) 00393 ).toDouble( &bOK ); 00394 return bOK ? value : 0.0; 00395 } |
|
[reimplemented]
Definition at line 842 of file KDChartAbstractDiagram.cpp.
00844 { return true; } |
|
[reimplemented]
Definition at line 825 of file KDChartAbstractDiagram.cpp.
00829 {} |
|
[reimplemented]
Definition at line 851 of file KDChartAbstractDiagram.cpp. |
|
Definition at line 589 of file KDChartAbstractDiagram.h. |