Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

KDChart::BarDiagram Class Reference

#include <KDChartBarDiagram.h>

Inheritance diagram for KDChart::BarDiagram:

[legend]
Collaboration diagram for KDChart::BarDiagram:
[legend]
List of all members.

Public Types

enum  BarType {
  Normal,
  Stacked,
  Percent,
  Rows
}

Public Member Functions

virtual void addAxis (CartesianAxis *axis)
 Add the axis to the diagram.

bool allowOverlappingDataValueTexts () const
bool antiAliasing () const
virtual AttributesModelattributesModel () const
 Returns the AttributesModel, that is used by this diagram.

virtual KDChart::CartesianAxisList axes () const
BarAttributes barAttributes (const QModelIndex &index) const
BarAttributes barAttributes (int column) const
BarAttributes barAttributes () const
 BarDiagram (QWidget *parent=0, CartesianCoordinatePlane *plane=0)
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 BarDiagramclone () 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.

AbstractCoordinatePlanecoordinatePlane () const
 The coordinate plane associated with the diagram.

const QPair< QPointF, QPointF > dataBoundaries () const
 Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these values).

virtual void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 [reimplemented]

QList< QBrush > datasetBrushes () const
 The set of dataset brushes currently used, for use in legends, etc.

int datasetDimension () const
 The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to have.

QStringList datasetLabels () const
 The set of dataset labels currently displayed, for use in legends, etc.

QList< MarkerAttributesdatasetMarkers () const
 The set of dataset markers currently used, for use in legends, etc.

QList< QPen > datasetPens () const
 The set of dataset pens currently used, for use in legends, etc.

DataValueAttributes dataValueAttributes (const QModelIndex &index) const
 Retrieve the DataValueAttributes for the given index.

DataValueAttributes dataValueAttributes (int 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 ()
virtual QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
 [reimplemented]

const int numberOfAbscissaSegments () const
 [reimplemented]

const int numberOfOrdinateSegments () const
 [reimplemented]

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 AbstractCartesianDiagramreferenceDiagram () const
virtual QPointF referenceDiagramOffset () const
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 setBarAttributes (const QModelIndex &index, const BarAttributes &a)
void setBarAttributes (int column, const BarAttributes &a)
void setBarAttributes (const BarAttributes &a)
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.

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 setThreeDBarAttributes (const QModelIndex &index, const ThreeDBarAttributes &a)
void setThreeDBarAttributes (int column, const ThreeDBarAttributes &a)
void setThreeDBarAttributes (const ThreeDBarAttributes &a)
void setType (BarType type)
virtual void takeAxis (CartesianAxis *axis)
 Removes the axis from the diagram, without deleting it.

ThreeDBarAttributes threeDBarAttributes (const QModelIndex &index) const
ThreeDBarAttributes threeDBarAttributes (int column) const
ThreeDBarAttributes threeDBarAttributes () const
BarType 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 ~BarDiagram ()

Protected Member Functions

QModelIndex attributesModelRootIndex () const
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.

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)
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.


Protected Attributes

Q_SIGNALS __pad0__: void layoutChanged( AbstractDiagram* )

Member Enumeration Documentation

enum KDChart::BarDiagram::BarType
 

Enumeration values:
Normal 
Stacked 
Percent 
Rows 

Definition at line 55 of file KDChartBarDiagram.h.

00055                  { Normal,
00056                    Stacked,
00057                    Percent,
00058                    Rows };


Constructor & Destructor Documentation

BarDiagram::BarDiagram QWidget parent = 0,
CartesianCoordinatePlane plane = 0
[explicit]
 

Definition at line 52 of file KDChartBarDiagram.cpp.

Referenced by clone().

00052                                                                          :
00053     AbstractCartesianDiagram( new Private(), parent, plane )
00054 {
00055     init();
00056 }

BarDiagram::~BarDiagram  )  [virtual]
 

Definition at line 62 of file KDChartBarDiagram.cpp.

00063 {
00064 }


Member Function Documentation

void AbstractCartesianDiagram::addAxis CartesianAxis axis  )  [virtual, inherited]
 

Add the axis to the diagram.

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

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

See also:
takeAxis

Definition at line 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 }

bool AbstractDiagram::allowOverlappingDataValueTexts  )  const [inherited]
 

Returns:
Whether data value labels are allowed to overlap.

Definition at line 446 of file KDChartAbstractDiagram.cpp.

References d.

00450 {

bool AbstractDiagram::antiAliasing  )  const [inherited]
 

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

Definition at line 457 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::LineDiagram::paint().

00461 {

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

Returns the AttributesModel, that is used by this diagram.

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

Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel

Definition at line 286 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), and setBarAttributes().

00287 {
00288     return d->attributesModel;
00289 }

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 310 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::LineDiagram::calculateDataBoundaries(), calculateDataBoundaries(), KDChart::LineDiagram::numberOfAbscissaSegments(), numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(), numberOfOrdinateSegments(), KDChart::LineDiagram::paint(), paint(), and KDChart::AbstractDiagram::valueForCell().

00316 {

KDChart::CartesianAxisList AbstractCartesianDiagram::axes  )  const [virtual, inherited]
 

Definition at line 108 of file KDChartAbstractCartesianDiagram.cpp.

References KDChart::CartesianAxisList, and d.

00109 {
00110     return d->axesList;
00111 }

BarAttributes BarDiagram::barAttributes const QModelIndex &  index  )  const
 

Definition at line 122 of file KDChartBarDiagram.cpp.

References d.

00123 {
00124     return qVariantValue<BarAttributes>(
00125         d->attributesModel->data(
00126             d->attributesModel->mapFromSource( index ),
00127             KDChart::BarAttributesRole ) );
00128 }

BarAttributes BarDiagram::barAttributes int  column  )  const
 

Definition at line 114 of file KDChartBarDiagram.cpp.

References d.

00115 {
00116     return qVariantValue<BarAttributes>(
00117         d->attributesModel->data(
00118             d->attributesModel->mapFromSource( columnToIndex( column ) ),
00119             KDChart::BarAttributesRole ) );
00120 }

BarAttributes BarDiagram::barAttributes  )  const
 

Definition at line 108 of file KDChartBarDiagram.cpp.

References d.

Referenced by paint().

00109 {
00110     return qVariantValue<BarAttributes>(
00111         d->attributesModel->data( KDChart::BarAttributesRole ) );
00112 }

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

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

Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.

Definition at line 816 of file KDChartAbstractDiagram.cpp.

00822                               :
QRect AbstractDiagram::visualRect(const QModelIndex &) const

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

Retrieve the brush to be used for the given dataset.

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

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

Definition at line 808 of file KDChartAbstractDiagram.cpp.

00815 {

QBrush AbstractDiagram::brush  )  const [inherited]
 

Retrieve the brush to be used for painting datapoints globally.

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

Returns:
The brush to use for painting.

Definition at line 802 of file KDChartAbstractDiagram.cpp.

Referenced by KDChart::PieDiagram::paint(), KDChart::LineDiagram::paint(), and KDChart::AbstractDiagram::paintMarker().

00807 {

const QPair< QPointF, QPointF > BarDiagram::calculateDataBoundaries  )  const [protected, virtual]
 

[reimplemented]

Implements KDChart::AbstractDiagram.

Definition at line 198 of file KDChartBarDiagram.cpp.

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

00199 {
00200     if ( !checkInvariants(true) ) return QPair<QPointF, QPointF>( QPointF( 0, 0 ), QPointF( 0, 0 ) );
00201     const int rowCount = d->attributesModel->rowCount(attributesModelRootIndex());
00202     const int colCount = d->attributesModel->columnCount(attributesModelRootIndex());
00203 
00204     double xMin = 0;
00205     double xMax = rowCount;
00206     double yMin = 0, yMax = 0;
00207     //double maxThreeDDepth   = 0.0;
00208 
00209 
00210     // calculate boundaries for  different line types Normal - Stacked - Percent - Default Normal
00211     switch ( type() ){
00212         case BarDiagram::Normal:
00213         {
00214             bool bStarting = true;
00215             for ( int i=0; i<colCount; ++i ) {
00216                 for ( int j=0; j< rowCount; ++j ) {
00217                     const double value = d->attributesModel->data( d->attributesModel->index( j, i, attributesModelRootIndex() ) ).toDouble();
00218                     // this is always true yMin can be 0 in case all values
00219                     // are the same
00220                     // same for yMax it can be zero if all values are negative
00221                     if( bStarting ){
00222                         yMin = value;
00223                         yMax = value;
00224                         bStarting = false;
00225                     }else{
00226                         yMin = qMin( yMin, value );
00227                         yMax = qMax( yMax, value );
00228                     }
00229                 }
00230             }
00231         }
00232             break;
00233         case BarDiagram::Stacked:
00234         {
00235             bool bStarting = true;
00236             for ( int j=0; j< rowCount; ++j ) {
00237                 // calculate sum of values per column - Find out stacked Min/Max
00238                 double stackedValues = 0;
00239                 for ( int i=0; i<colCount ; ++i ) {
00240                     QModelIndex idx = model()->index( j, i, rootIndex() );
00241                     stackedValues +=  model()->data( idx ).toDouble();
00242                     // this is always true yMin can be 0 in case all values
00243                     // are the same
00244                     // same for yMax it can be zero if all values are negative
00245                     if( bStarting ){
00246                         yMin = stackedValues;
00247                         yMax = stackedValues;
00248                         bStarting = false;
00249                     }else{
00250                         yMin = qMin( yMin, stackedValues );
00251                         yMax = qMax( yMax, stackedValues );
00252                     }
00253                 }
00254             }
00255         }
00256             break;
00257         case BarDiagram::Percent:
00258         {
00259             for ( int i=0; i<colCount; ++i ) {
00260                 for ( int j=0; j< rowCount; ++j ) {
00261                     // Ordinate should begin at 0 the max value being the 100% pos
00262                     QModelIndex idx = model()->index( j, i, rootIndex() );
00263                     // only positive values are handled
00264                     double value = model()->data( idx ).toDouble();
00265                     if ( value > 0 )
00266                         yMax = qMax( yMax, value );
00267                 }
00268             }
00269         }
00270             break;
00271         case BarDiagram::Rows:
00272         {
00273             qDebug()<< "KDChartBarDiagram::calculateDataBoundaries"
00274                     << "Sorry Type Rows not implemented yet";
00275             break;
00276         }
00277 
00278 
00279         default:
00280              Q_ASSERT_X ( false, "calculateDataBoundaries()",
00281                          "Type item does not match a defined bar chart Type." );
00282     }
00283 
00284     // special cases
00285     if (  yMax == yMin ) {
00286         if ( yMin == 0.0 )
00287             yMax = 0.1; //we need at list a range
00288         else
00289             yMax = 0.0; // they are the same but negative
00290     }
00291     QPointF bottomLeft ( QPointF( xMin, yMin ) );
00292     QPointF topRight ( QPointF( xMax, yMax ) );
00293 
00294     //qDebug() << "BarDiagram::calculateDataBoundaries () returns ( " << bottomLeft << topRight <<")";
00295     return QPair<QPointF, QPointF> ( bottomLeft,  topRight );
00296 }

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

Definition at line 930 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::coordinatePlane().

Referenced by KDChart::RingDiagram::calculateDataBoundaries(), KDChart::PolarDiagram::calculateDataBoundaries(), KDChart::PieDiagram::calculateDataBoundaries(), KDChart::LineDiagram::calculateDataBoundaries(), calculateDataBoundaries(), KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), KDChart::PieDiagram::paint(), KDChart::LineDiagram::paint(), 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

BarDiagram * BarDiagram::clone  )  const [virtual]
 

Definition at line 66 of file KDChartBarDiagram.cpp.

References BarDiagram(), and d.

00067 {
00068     return new BarDiagram( new Private( *d ) );
00069 }

QModelIndex AbstractDiagram::columnToIndex int  column  )  const [protected, inherited]
 

Definition at line 317 of file KDChartAbstractDiagram.cpp.

00323 {

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

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 }

bool AbstractCartesianDiagram::compare const AbstractCartesianDiagram other  )  const [inherited]
 

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 }

AbstractCoordinatePlane * AbstractDiagram::coordinatePlane  )  const [inherited]
 

The coordinate plane associated with the diagram.

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

Returns:
The coordinate plane associated with the diagram.

Definition at line 226 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractCartesianDiagram::layoutPlanes(), KDChart::PolarDiagram::paint(), KDChart::LineDiagram::paint(), paint(), KDChart::AbstractPolarDiagram::polarCoordinatePlane(), and KDChart::AbstractCartesianDiagram::setCoordinatePlane().

00227 {
00228     return d->plane;
00229 }

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 231 of file KDChartAbstractDiagram.cpp.

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

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

00232 {
00233     if( d->databoundariesDirty ){
00234         d->databoundaries = calculateDataBoundaries ();
00235         d->databoundariesDirty = false;
00236     }
00237     return d->databoundaries;
00238 }

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

[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 

void KDChart::AbstractDiagram::dataHidden  )  [protected, inherited]
 

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

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

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

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

Definition at line 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

int AbstractDiagram::datasetDimension  )  const [inherited]
 

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

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

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

Returns:
The dataset dimension of the diagram.

Definition at line 942 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::LineDiagram::calculateDataBoundaries(), KDChart::LineDiagram::getCellValues(), KDChart::CartesianCoordinatePlane::getDataDimensionsList(), KDChart::LineDiagram::paint(), and KDChart::LineDiagram::setType().

00946 {

QStringList AbstractDiagram::datasetLabels  )  const [inherited]
 

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

Returns:
The set of dataset labels currently displayed.

Definition at line 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

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

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

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

Definition at line 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

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

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

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

Definition at line 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

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

Retrieve the DataValueAttributes for the given index.

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

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

Definition at line 427 of file KDChartAbstractDiagram.cpp.

00433 {

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.

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

Definition at line 420 of file KDChartAbstractDiagram.cpp.

00426 {

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.

Returns:
The global DataValueAttributes.

Definition at line 414 of file KDChartAbstractDiagram.cpp.

Referenced by KDChart::AbstractDiagram::paintDataValueText(), and KDChart::AbstractDiagram::paintMarker().

00419 {

void AbstractDiagram::doItemsLayout  )  [virtual, inherited]
 

[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,

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

[reimplemented]

Definition at line 839 of file KDChartAbstractDiagram.cpp.

00841 { return 0; }

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

[reimplemented]

Definition at line 833 of file KDChartAbstractDiagram.cpp.

00835 { return QModelIndex(); }

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

Retrieve the hidden status for the given index.

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

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

Definition at line 386 of file KDChartAbstractDiagram.cpp.

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.

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

Definition at line 379 of file KDChartAbstractDiagram.cpp.

00385 {

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.

Returns:
The global hidden status.

Definition at line 373 of file KDChartAbstractDiagram.cpp.

Referenced by KDChart::Legend::buildLegend(), KDChart::LineDiagram::paint(), and KDChart::LineDiagram::valueForCellTesting().

00378 {

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

[reimplemented]

Definition at line 845 of file KDChartAbstractDiagram.cpp.

00847 {}

QStringList AbstractDiagram::itemRowLabels  )  const [inherited]
 

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

Returns:
The set of item row labels currently displayed.

Definition at line 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

void KDChart::AbstractCartesianDiagram::layoutPlanes  )  [virtual, inherited]
 

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 }

void KDChart::AbstractDiagram::modelsChanged  )  [protected, 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]
 

[reimplemented]

Definition at line 836 of file KDChartAbstractDiagram.cpp.

00838 { return 0; }

const int BarDiagram::numberOfAbscissaSegments  )  const [virtual]
 

[reimplemented]

Implements KDChart::AbstractCartesianDiagram.

Definition at line 674 of file KDChartBarDiagram.cpp.

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

00675 {
00676     return d->attributesModel->rowCount(attributesModelRootIndex());
00677 }

const int BarDiagram::numberOfOrdinateSegments  )  const [virtual]
 

[reimplemented]

Implements KDChart::AbstractCartesianDiagram.

Definition at line 679 of file KDChartBarDiagram.cpp.

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

00680 {
00681     return d->attributesModel->columnCount(attributesModelRootIndex());
00682 }

void BarDiagram::paint PaintContext paintContext  )  [protected, virtual]
 

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

Parameters:
paintContext All information needed for painting.

Implements KDChart::AbstractDiagram.

Definition at line 341 of file KDChartBarDiagram.cpp.

References KDChart::AbstractDiagram::attributesModelRootIndex(), barAttributes(), KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), d, KDChart::AbstractDiagram::dataBoundaries(), KDChart::AbstractThreeDAttributes::depth(), KDChart::BarAttributes::fixedBarWidth(), KDChart::BarAttributes::fixedDataValueGap(), KDChart::BarAttributes::fixedValueBlockGap(), KDChart::AbstractThreeDAttributes::isEnabled(), KDChart::PaintContext::rectangle(), threeDBarAttributes(), KDChart::CartesianCoordinatePlane::translate(), type(), KDChart::BarAttributes::useFixedBarWidth(), KDChart::BarAttributes::useFixedDataValueGap(), and KDChart::BarAttributes::useFixedValueBlockGap().

00342 {
00343     // note: Not having any data model assigned is no bug
00344     //       but we can not draw a diagram then either.
00345     if ( !checkInvariants(true) )
00346         return;
00347 
00348     // Calculate width
00349     QPointF boundLeft, boundRight;
00350     QPair<QPointF,QPointF> boundaries = dataBoundaries();
00351     if( !AbstractGrid::isBoundariesValid(boundaries) ) return;
00352 
00353     CartesianCoordinatePlane* plane = dynamic_cast<KDChart::CartesianCoordinatePlane*>( coordinatePlane() );
00354     if( ! plane ) return;
00355 
00356     boundLeft = plane->translate( boundaries.first );
00357     boundRight = plane->translate( boundaries.second );
00358     double width = boundRight.x() - boundLeft.x();
00359     //calculates and stores the values
00360     const int rowCount = d->attributesModel->rowCount(attributesModelRootIndex());
00361     const int colCount = d->attributesModel->columnCount(attributesModelRootIndex());
00362     DataValueTextInfoList list;
00363     BarAttributes ba = barAttributes( model()->index( 0, 0, rootIndex() ) );
00364     double barWidth = 0;
00365     double maxDepth = 0;
00366     double spaceBetweenBars = 0;
00367     double spaceBetweenGroups = 0;
00368     double groupWidth =  /*ctx->rectangle().width() / ( rowCount + 2 )*/ width/ (rowCount + 2);
00369 
00370 
00371     if ( ba.useFixedBarWidth() ) {
00372         barWidth = ba.fixedBarWidth();
00373         groupWidth += barWidth;
00374 
00375         // Pending Michel set a min and max value for the groupWidth related to the area.width
00376         // FixMe
00377         if ( groupWidth < 0 )
00378             groupWidth = 0;
00379 
00380         if ( groupWidth  * rowCount > ctx->rectangle().width() )
00381             groupWidth = ctx->rectangle().width() / rowCount;
00382     }
00383 
00384     // maxLimit: allow the space between bars to be larger until area.width() is covered by the groups.
00385     double maxLimit = rowCount * (groupWidth + ((colCount-1) * ba.fixedDataValueGap()) );
00386 
00387     //Pending Michel: FixMe
00388     if ( ba.useFixedDataValueGap() ) {
00389         if ( ctx->rectangle().width() > maxLimit )
00390             spaceBetweenBars += ba.fixedDataValueGap();
00391         else
00392             spaceBetweenBars = ((ctx->rectangle().width()/rowCount) - groupWidth)/(colCount-1);
00393    }
00394 
00395     //Pending Michel: FixMe
00396     if ( ba.useFixedValueBlockGap() )
00397         spaceBetweenGroups += ba.fixedValueBlockGap();
00398 
00399     calculateValueAndGapWidths( rowCount, colCount,groupWidth,
00400                                 barWidth, spaceBetweenBars, spaceBetweenGroups );
00401 
00402     // paint different bar types: Normal - Stacked - Percent
00403     switch ( type() )
00404         {
00405         case BarDiagram::Normal:
00406         {
00407             // we paint the bars for all series next to each other, then move to the next value
00408             for ( int i=0; i<rowCount; ++i ) {
00409                 double offset = -groupWidth/2 + spaceBetweenGroups/2;
00410                 // case fixed data value gap - handles max and min limits as well
00411                 if ( ba.useFixedDataValueGap() ) {
00412                     if ( spaceBetweenBars > 0 ) {
00413                       if ( ctx->rectangle().width() > maxLimit )
00414                             offset -= ba.fixedDataValueGap();
00415                       else
00416                         offset -= ((ctx->rectangle().width()/rowCount) - groupWidth)/(colCount-1);
00417 
00418                     } else {
00419                         //allow reducing the gap until the bars are displayed next to each other - null gap
00420                         offset += barWidth/2;
00421                     }
00422                 }
00423 
00424                 for ( int j=0; j< colCount; ++j ) {
00425                     // paint one group
00426                     const qreal value = d->attributesModel->data( d->attributesModel->index( i, j, attributesModelRootIndex() ) ).toDouble();
00427                     QPointF topPoint = plane->translate( QPointF( i + 0.5, value ) );
00428                     QPointF bottomPoint = plane->translate( QPointF( i, 0 ) );
00429                     const double barHeight = bottomPoint.y() - topPoint.y();
00430                     topPoint.setX( topPoint.x() + offset );
00431 
00432                     const QModelIndex index = model()->index( i, j, rootIndex() );
00433 
00434                     //PENDING Michel: FIXME barWidth
00435                     const QRectF rect( topPoint, QSizeF( barWidth, barHeight ) );
00436                     d->appendDataValueTextInfoToList( this, list, index, PositionPoints( rect ),
00437                             Position::NorthWest, Position::SouthEast,
00438                             value );
00439                     paintBars( ctx, index, rect, maxDepth );
00440 
00441                     offset += barWidth + spaceBetweenBars;
00442                 }
00443             }
00444         }
00445             break;
00446         case BarDiagram::Stacked:
00447         {
00448            for ( int i = 0; i<colCount; ++i ) {
00449                double offset = spaceBetweenGroups;
00450                for ( int j = 0; j< rowCount; ++j ) {
00451                    QModelIndex index = model()->index( j, i, rootIndex() );
00452                    ThreeDBarAttributes threeDAttrs = threeDBarAttributes( index );
00453                    double value = 0, stackedValues = 0;
00454                    QPointF point, previousPoint;
00455 
00456                    if ( threeDAttrs.isEnabled() ) {
00457                        if ( barWidth > 0 )
00458                            barWidth =  (width - ((offset+(threeDAttrs.depth()))*rowCount))/ rowCount;
00459                        if ( barWidth <= 0 ) {
00460                            barWidth = 0;
00461                            maxDepth = offset - (width/rowCount);
00462                        }
00463                    } else
00464                        barWidth =  (ctx->rectangle().width() - (offset*rowCount))/ rowCount ;
00465 
00466                    value = model()->data( index ).toDouble();
00467                    for ( int k = i; k >= 0 ; --k )
00468                        stackedValues += model()->data( model()->index( j, k, rootIndex() ) ).toDouble();
00469                    point = plane->translate( QPointF( j, stackedValues ) );
00470                    point.setX( point.x() + offset/2 );
00471                    previousPoint = plane->translate( QPointF( j, stackedValues - value ) );
00472                    const double barHeight = previousPoint.y() - point.y();
00473 
00474                    const QRectF rect( point, QSizeF( barWidth , barHeight ) );
00475                    d->appendDataValueTextInfoToList( this, list, index, PositionPoints( rect ),
00476                            Position::NorthWest, Position::SouthEast,
00477                            value );
00478                    paintBars( ctx, index, rect, maxDepth );
00479                }
00480 
00481            }
00482         }
00483            break;
00484         case BarDiagram::Percent:
00485         {
00486             double maxValue = 100; // always 100 %
00487             double sumValues = 0;
00488             QVector <double > sumValuesVector;
00489 
00490             //calculate sum of values for each column and store
00491             for ( int j=0; j<rowCount; ++j ) {
00492                 for ( int i=0; i<colCount; ++i ) {
00493                     double tmpValue = model()->data( model()->index( j, i, rootIndex() ) ).toDouble();
00494                     if ( tmpValue > 0 )
00495                         sumValues += tmpValue;
00496                     if ( i == colCount-1 ) {
00497                         sumValuesVector <<  sumValues ;
00498                         sumValues = 0;
00499                     }
00500                 }
00501             }
00502 
00503             // calculate stacked percent value
00504             for ( int i = 0; i<colCount; ++i ) {
00505                 double offset = spaceBetweenGroups;
00506                 for ( int j=0; j<rowCount ; ++j ) {
00507                     double value = 0, stackedValues = 0;
00508                     QPointF point, previousPoint;
00509                     QModelIndex index = model()->index( j, i, rootIndex() );
00510                     ThreeDBarAttributes threeDAttrs = threeDBarAttributes( index );
00511 
00512                     if ( threeDAttrs.isEnabled() ){
00513                         if ( barWidth > 0 )
00514                             barWidth =  (width - ((offset+(threeDAttrs.depth()))*rowCount))/ rowCount;
00515                         if ( barWidth <= 0 ) {
00516                             barWidth = 0;
00517                             maxDepth = offset - ( width/rowCount);
00518                         }
00519                     }else{
00520                         barWidth = (ctx->rectangle().width() - (offset*rowCount))/ rowCount;
00521                     }
00522 
00523                     value = model()->data( index ).toDouble();
00524 
00525                     // calculate stacked percent value
00526                     // we only take in account positives values for now.
00527                     for ( int k = i; k >= 0 ; --k ) {
00528                         double val = model()->data( model()->index( j, k, rootIndex() ) ).toDouble();
00529                         if ( val > 0)
00530                             stackedValues += val;
00531                     }
00532 
00533                     if (  sumValuesVector.at( j ) != 0 && value > 0 ) {
00534                       point = plane->translate( QPointF( j,  stackedValues/sumValuesVector.at(j)* maxValue ) );
00535 
00536                         point.setX( point.x() + offset/2 );
00537 
00538                         previousPoint = plane->translate( QPointF( j, (stackedValues - value)/sumValuesVector.at(j)* maxValue ) );
00539                     }
00540                     const double barHeight = previousPoint.y() - point.y();
00541 
00542                     const QRectF rect( point, QSizeF( barWidth, barHeight ) );
00543                     d->appendDataValueTextInfoToList( this, list, index, PositionPoints( rect ),
00544                             Position::NorthWest, Position::SouthEast,
00545                             value );
00546                     paintBars( ctx, index, rect, maxDepth );
00547 
00548                 }
00549             }
00550         }
00551         break;
00552         default:
00553             Q_ASSERT_X ( false, "paint()",
00554                          "Type item does not match a defined bar chart Type." );
00555         }
00556 
00557     // paint all data value texts, but no point markers
00558     d->paintDataValueTextsAndMarkers( this, ctx, list, false );
00559 }

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

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 

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

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 

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

Definition at line 592 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::checkInvariants(), 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().

00593 {
00594 
00595     if ( !checkInvariants() ) return;
00596     DataValueAttributes a = dataValueAttributes(index);
00597     if ( !a.isVisible() ) return;
00598     const MarkerAttributes &ma = a.markerAttributes();
00599     if ( !ma.isVisible() ) return;
00600 
00601     PainterSaver painterSaver( painter );
00602     QSizeF maSize( ma.markerSize() );
00603     QBrush indexBrush( brush( index ) );
00604     QPen indexPen( ma.pen() );
00605     if ( ma.markerColor().isValid() )
00606         indexBrush.setColor( ma.markerColor() );
00607 
00608     paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
00609 }
00610 
00611 

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

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 )

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

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 

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

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

Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.

Definition at line 770 of file KDChartAbstractDiagram.cpp.

00777 {

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

Retrieve the pen to be used for the given dataset.

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

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

Definition at line 762 of file KDChartAbstractDiagram.cpp.

00769 {

QPen AbstractDiagram::pen  )  const [inherited]
 

Retrieve the pen to be used for painting datapoints globally.

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

Returns:
The pen to use for painting.

Definition at line 756 of file KDChartAbstractDiagram.cpp.

Referenced by KDChart::PieDiagram::paint(), and KDChart::LineDiagram::paint().

00761 {

bool AbstractDiagram::percentMode  )  const [inherited]
 

Definition at line 468 of file KDChartAbstractDiagram.cpp.

References d.

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

void KDChart::AbstractDiagram::propertiesChanged  )  [protected, inherited]
 

Emitted upon change of a property of the Diagram.

Referenced by KDChart::LineDiagram::resetLineAttributes(), KDChart::AbstractDiagram::setDataValueAttributes(), KDChart::LineDiagram::setLineAttributes(), KDChart::LineDiagram::setThreeDLineAttributes(), and KDChart::LineDiagram::setType().

AbstractCartesianDiagram * AbstractCartesianDiagram::referenceDiagram  )  const [virtual, inherited]
 

Definition at line 146 of file KDChartAbstractCartesianDiagram.cpp.

References d.

Referenced by KDChart::LineDiagram::paint(), and referenceDiagramIsBarDiagram().

00147 {
00148     return d->referenceDiagram;
00149 }

QPointF AbstractCartesianDiagram::referenceDiagramOffset  )  const [virtual, inherited]
 

Definition at line 151 of file KDChartAbstractCartesianDiagram.cpp.

References d.

00152 {
00153     return d->referenceDiagramOffset;
00154 }

void BarDiagram::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.

Parameters:
area 

Implements KDChart::AbstractDiagram.

Definition at line 670 of file KDChartBarDiagram.cpp.

00671 {
00672 }

void BarDiagram::resizeEvent QResizeEvent *   )  [protected]
 

Definition at line 193 of file KDChartBarDiagram.cpp.

00194 {
00195 
00196 }

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

[reimplemented]

Definition at line 830 of file KDChartAbstractDiagram.cpp.

00832 { return QModelIndex(); }

void AbstractDiagram::setAllowOverlappingDataValueTexts bool  allow  )  [inherited]
 

Set whether data value labels are allowed to overlap.

Parameters:
allow True means that overlapping labels are allowed.

Definition at line 440 of file KDChartAbstractDiagram.cpp.

References d.

00445 {

void AbstractDiagram::setAntiAliasing bool  enabled  )  [inherited]
 

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

Parameters:
enabled True means that AA is enabled.

Definition at line 451 of file KDChartAbstractDiagram.cpp.

References d.

00456 {

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() );

Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel, usesExternalAttributesModel

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 }

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

Definition at line 301 of file KDChartAbstractDiagram.cpp.

References d.

void BarDiagram::setBarAttributes const QModelIndex &  index,
const BarAttributes a
 

Definition at line 100 of file KDChartBarDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::BarAttributesRole, d, and KDChart::AttributesModel::setData().

00101 {
00102     attributesModel()->setData(
00103         d->attributesModel->mapFromSource( index ),
00104         qVariantFromValue( ta ),
00105         BarAttributesRole );
00106 }

void BarDiagram::setBarAttributes int  column,
const BarAttributes a
 

Definition at line 92 of file KDChartBarDiagram.cpp.

References KDChart::BarAttributesRole, and d.

00093 {
00094     d->attributesModel->setHeaderData(
00095         column, Qt::Vertical,
00096         qVariantFromValue( ta ),
00097         BarAttributesRole );
00098 }

void BarDiagram::setBarAttributes const BarAttributes a  ) 
 

Definition at line 87 of file KDChartBarDiagram.cpp.

References KDChart::BarAttributesRole, and d.

00088 {
00089     d->attributesModel->setModelData( qVariantFromValue( ta ), BarAttributesRole );
00090 }

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

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

Parameters:
brush The brush to use.

Definition at line 786 of file KDChartAbstractDiagram.cpp.

00792 {

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

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

Parameters:
dataset The dataset's column in the model.
pen The brush to use.

Definition at line 793 of file KDChartAbstractDiagram.cpp.

00801 {

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

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

Parameters:
index The datapoint's index in the model.
brush The brush to use.

Definition at line 778 of file KDChartAbstractDiagram.cpp.

00785 {

void KDChart::AbstractCartesianDiagram::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.

Returns:
The coordinate plane associated with the diagram.

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 }

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

Definition at line 240 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by setThreeDBarAttributes(), KDChart::LineDiagram::setThreeDLineAttributes(), KDChart::LineDiagram::setType(), and setType().

00241 {
00242     d->databoundariesDirty = true;
00243 }

void AbstractDiagram::setDatasetDimension int  dimension  )  [inherited]
 

Sets the dataset dimension of the diagram.

See also:
datasetDimension.
Parameters:
dimension 

Definition at line 947 of file KDChartAbstractDiagram.cpp.

References d.

00954 {

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

Set the DataValueAttributes for all datapoints in the model.

Parameters:
a The attributes to set.

Definition at line 434 of file KDChartAbstractDiagram.cpp.

References d.

00439 {

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

Set the DataValueAttributes for the given dataset.

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

Definition at line 406 of file KDChartAbstractDiagram.cpp.

References d.

00413 {

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

Set the DataValueAttributes for the given index.

Parameters:
index The datapoint to set the attributes for.
a The attributes to set.

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 

void AbstractDiagram::setHidden bool  hidden  )  [inherited]
 

Hide (or unhide, resp.) all datapoints in the model.

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

Definition at line 365 of file KDChartAbstractDiagram.cpp.

References d.

00372 {

void AbstractDiagram::setHidden int  column,
bool  hidden
[inherited]
 

Hide (or unhide, resp.) a dataset.

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

Definition at line 356 of file KDChartAbstractDiagram.cpp.

References d.

00364 {

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

Hide (or unhide, resp.) a data cell.

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

Definition at line 347 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::DataHiddenRole.

00355 {

void AbstractDiagram::setModel QAbstractItemModel *  model  )  [virtual, inherited]
 

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 }

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

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

Parameters:
pen The pen to use.

Definition at line 740 of file KDChartAbstractDiagram.cpp.

00746 {

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

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

Parameters:
dataset The dataset's row in the model.
pen The pen to use.

Definition at line 747 of file KDChartAbstractDiagram.cpp.

00755 {

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

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

Parameters:
index The datapoint's index in the model.
pen The pen to use.

Definition at line 732 of file KDChartAbstractDiagram.cpp.

00739 {

void AbstractDiagram::setPercentMode bool  percent  )  [inherited]
 

Definition at line 462 of file KDChartAbstractDiagram.cpp.

References d.

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

00467 {

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

Definition at line 140 of file KDChartAbstractCartesianDiagram.cpp.

References d.

00141 {
00142     d->referenceDiagram = diagram;
00143     d->referenceDiagramOffset = offset;
00144 }

void AbstractDiagram::setRootIndex const QModelIndex &  idx  )  [virtual, inherited]
 

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.

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

[reimplemented]

Definition at line 848 of file KDChartAbstractDiagram.cpp.

00850 { return QRegion(); }

void BarDiagram::setThreeDBarAttributes const QModelIndex &  index,
const ThreeDBarAttributes a
 

Definition at line 147 of file KDChartBarDiagram.cpp.

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

00148 {
00149     setDataBoundariesDirty();
00150     d->attributesModel->setData(
00151         d->attributesModel->mapFromSource(index),
00152         qVariantFromValue( threeDAttrs ),
00153         ThreeDBarAttributesRole );
00154     emit layoutChanged( this );
00155 }

void BarDiagram::setThreeDBarAttributes int  column,
const ThreeDBarAttributes a
 

Definition at line 137 of file KDChartBarDiagram.cpp.

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

00138 {
00139     setDataBoundariesDirty();
00140     d->attributesModel->setHeaderData(
00141         column, Qt::Vertical,
00142         qVariantFromValue( threeDAttrs ),
00143         ThreeDBarAttributesRole );
00144     emit layoutChanged( this );
00145 }

void BarDiagram::setThreeDBarAttributes const ThreeDBarAttributes a  ) 
 

Definition at line 130 of file KDChartBarDiagram.cpp.

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

00131 {
00132     setDataBoundariesDirty();
00133     d->attributesModel->setModelData( qVariantFromValue( threeDAttrs ), ThreeDBarAttributesRole );
00134     emit layoutChanged( this );
00135 }

void BarDiagram::setType BarType  type  ) 
 

Definition at line 71 of file KDChartBarDiagram.cpp.

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

00072 {
00073     if ( type == d->barType ) return;
00074 
00075     d->barType = type;
00076     // AbstractAxis settings - see AbstractDiagram and CartesianAxis
00077     setPercentMode( type == BarDiagram::Percent );
00078     setDataBoundariesDirty();
00079     emit layoutChanged( this );
00080 }

void AbstractCartesianDiagram::takeAxis CartesianAxis axis  )  [virtual, inherited]
 

Removes the axis from the diagram, without deleting it.

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

See also:
addAxis

Definition at line 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 }

ThreeDBarAttributes BarDiagram::threeDBarAttributes const QModelIndex &  index  )  const
 

Definition at line 171 of file KDChartBarDiagram.cpp.

References d.

00172 {
00173     return qVariantValue<ThreeDBarAttributes>(
00174         d->attributesModel->data(
00175             d->attributesModel->mapFromSource(index),
00176             KDChart::ThreeDBarAttributesRole ) );
00177 }

ThreeDBarAttributes BarDiagram::threeDBarAttributes int  column  )  const
 

Definition at line 163 of file KDChartBarDiagram.cpp.

References d.

00164 {
00165     return qVariantValue<ThreeDBarAttributes>(
00166         d->attributesModel->data(
00167             d->attributesModel->mapFromSource( columnToIndex( column ) ),
00168             KDChart::ThreeDBarAttributesRole ) );
00169 }

ThreeDBarAttributes BarDiagram::threeDBarAttributes  )  const
 

Definition at line 157 of file KDChartBarDiagram.cpp.

References d.

Referenced by paint(), and threeDItemDepth().

00158 {
00159     return qVariantValue<ThreeDBarAttributes>(
00160         d->attributesModel->data( KDChart::ThreeDBarAttributesRole ) );
00161 }

double BarDiagram::threeDItemDepth int  column  )  const [protected, virtual]
 

Implements KDChart::AbstractCartesianDiagram.

Definition at line 184 of file KDChartBarDiagram.cpp.

References d.

00185 {
00186     return qVariantValue<ThreeDBarAttributes>(
00187         d->attributesModel->headerData (
00188             column,
00189             Qt::Vertical,
00190             KDChart::ThreeDBarAttributesRole ) ).validDepth();
00191 }

double BarDiagram::threeDItemDepth const QModelIndex &  index  )  const [protected, virtual]
 

Implements KDChart::AbstractCartesianDiagram.

Definition at line 179 of file KDChartBarDiagram.cpp.

References threeDBarAttributes(), and KDChart::AbstractThreeDAttributes::validDepth().

00180 {
00181     return threeDBarAttributes( index ).validDepth();
00182 }

BarDiagram::BarType BarDiagram::type  )  const
 

Definition at line 82 of file KDChartBarDiagram.cpp.

References d.

Referenced by calculateDataBoundaries(), and paint().

00083 {
00084    return d->barType;
00085 }

void AbstractDiagram::update  )  const [inherited]
 

Definition at line 961 of file KDChartAbstractDiagram.cpp.

References d.

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

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

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

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

Definition at line 855 of file KDChartAbstractDiagram.cpp.

References d.

00859 {

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

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

See also:
KDChart::Palette.

Definition at line 865 of file KDChartAbstractDiagram.cpp.

References d.

00869 {

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

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

See also:
setAttributesModel

Definition at line 280 of file KDChartAbstractDiagram.cpp.

References d.

00281 {
00282     return d->usesExternalAttributesModel();
00283 }

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

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

See also:
KDChart::Palette.

Definition at line 860 of file KDChartAbstractDiagram.cpp.

References d.

00864 {

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

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

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

Definition at line 955 of file KDChartAbstractDiagram.cpp.

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

Referenced by KDChart::LineDiagram::paint().

00960 {

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

[reimplemented]

Definition at line 842 of file KDChartAbstractDiagram.cpp.

00844 { return true; }

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

[reimplemented]

Definition at line 825 of file KDChartAbstractDiagram.cpp.

00829 {}

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

[reimplemented]

Definition at line 851 of file KDChartAbstractDiagram.cpp.


Member Data Documentation

Q_SIGNALS KDChart::AbstractDiagram::__pad0__ [protected, inherited]
 

Definition at line 589 of file KDChartAbstractDiagram.h.


The documentation for this class was generated from the following files:
Generated on Thu May 10 11:06:31 2007 for KD Chart 2 by doxygen 1.3.6