KD Chart API Documentation  3.1
Public Member Functions | Protected Slots | Protected Member Functions | List of all members
KDChart::AbstractCartesianDiagram Class Referenceabstract

Base class for diagrams based on a cartesian coordianate system. More...

#include <KDChartAbstractCartesianDiagram.h>

Inheritance diagram for KDChart::AbstractCartesianDiagram:
KDChart::AbstractDiagram KDChart::BarDiagram KDChart::LineDiagram KDChart::Plotter KDChart::StockDiagram KDChart::LeveyJenningsDiagram

Public Member Functions

 AbstractCartesianDiagram (QWidget *parent=nullptr, CartesianCoordinatePlane *plane=nullptr)
 
 ~AbstractCartesianDiagram () override
 
virtual void addAxis (CartesianAxis *axis)
 
virtual KDChart::CartesianAxisList axes () const
 
bool compare (const AbstractCartesianDiagram *other) const
 
virtual void layoutPlanes ()
 
virtual int numberOfAbscissaSegments () const =0
 
virtual int numberOfOrdinateSegments () const =0
 
virtual AbstractCartesianDiagramreferenceDiagram () const
 
virtual QPointF referenceDiagramOffset () const
 
void setAttributesModel (AttributesModel *amodel) override
 Sets an external AttributesModel on this diagram. More...
 
void setCoordinatePlane (AbstractCoordinatePlane *plane) override
 
void setModel (QAbstractItemModel *model) override
 
virtual void setReferenceDiagram (AbstractCartesianDiagram *diagram, const QPointF &offset=QPointF())
 
void setRootIndex (const QModelIndex &index) override
 
virtual void takeAxis (CartesianAxis *axis)
 
- Public Member Functions inherited from KDChart::AbstractDiagram
 ~AbstractDiagram () override
 
bool allowOverlappingDataValueTexts () const
 
bool antiAliasing () const
 
virtual AttributesModelattributesModel () const
 
QBrush brush () const
 
QBrush brush (const QModelIndex &index) const
 
QBrush brush (int dataset) const
 
bool compare (const AbstractDiagram *other) const
 
AbstractCoordinatePlanecoordinatePlane () const
 
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). More...
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >()) override
 
QList< QBrush > datasetBrushes () const
 
int datasetDimension () const
 
QStringList datasetLabels () const
 
QList< MarkerAttributesdatasetMarkers () const
 
QList< QPen > datasetPens () const
 
DataValueAttributes dataValueAttributes () const
 
DataValueAttributes dataValueAttributes (const QModelIndex &index) const
 
DataValueAttributes dataValueAttributes (int dataset) const
 
void doItemsLayout () override
 
int horizontalOffset () const override
 
QModelIndex indexAt (const QPoint &point) const override
 
QModelIndexList indexesAt (const QPoint &point) const
 
QModelIndexList indexesIn (const QRect &rect) const
 
bool isHidden () const
 
bool isHidden (const QModelIndex &index) const
 
bool isHidden (int dataset) const
 
bool isIndexHidden (const QModelIndex &index) const override
 
QStringList itemRowLabels () const
 
QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
 
virtual void paint (PaintContext *paintContext)=0
 
void paintDataValueText (QPainter *painter, const QModelIndex &index, const QPointF &pos, qreal value)
 
void paintMarker (QPainter *painter, const DataValueAttributes &a, const QModelIndex &index, const QPointF &pos)
 
virtual void paintMarker (QPainter *painter, const MarkerAttributes &markerAttributes, const QBrush &brush, const QPen &, const QPointF &point, const QSizeF &size)
 
void paintMarker (QPainter *painter, const QModelIndex &index, const QPointF &pos)
 
QPen pen () const
 
QPen pen (const QModelIndex &index) const
 
QPen pen (int dataset) const
 
bool percentMode () const
 Returns whether this diagram is drawn in percent mode. More...
 
virtual void resize (const QSizeF &area)=0
 
void scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible) override
 
void setAllowOverlappingDataValueTexts (bool allow)
 
void setAntiAliasing (bool enabled)
 
void setBrush (const QBrush &brush)
 
void setBrush (const QModelIndex &index, const QBrush &brush)
 
void setBrush (int dataset, const QBrush &brush)
 
Q_DECL_DEPRECATED void setDatasetDimension (int dimension)
 
void setDataValueAttributes (const DataValueAttributes &a)
 
void setDataValueAttributes (const QModelIndex &index, const DataValueAttributes &a)
 
void setDataValueAttributes (int dataset, const DataValueAttributes &a)
 
void setHidden (bool hidden)
 
void setHidden (const QModelIndex &index, bool hidden)
 
void setHidden (int dataset, bool hidden)
 
void setModel (QAbstractItemModel *model) override
 
void setPen (const QModelIndex &index, const QPen &pen)
 
void setPen (const QPen &pen)
 
void setPen (int dataset, const QPen &pen)
 
Q_DECL_DEPRECATED void setPercentMode (bool percent)
 Deprecated method that turns the percent mode of this diagram on or off. More...
 
void setRootIndex (const QModelIndex &idx) override
 Reimplemented for internal purposes. More...
 
void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command) override
 
void setSelectionModel (QItemSelectionModel *selectionModel) override
 
void setUnitPrefix (const QString &prefix, int column, Qt::Orientation orientation)
 
void setUnitPrefix (const QString &prefix, Qt::Orientation orientation)
 
void setUnitSuffix (const QString &suffix, int column, Qt::Orientation orientation)
 
void setUnitSuffix (const QString &suffix, Qt::Orientation orientation)
 
QString unitPrefix (int column, Qt::Orientation orientation, bool fallback=false) const
 
QString unitPrefix (Qt::Orientation orientation) const
 
QString unitSuffix (int column, Qt::Orientation orientation, bool fallback=false) const
 
QString unitSuffix (Qt::Orientation orientation) const
 
void update () const
 
void useDefaultColors ()
 
void useRainbowColors ()
 
virtual bool usesExternalAttributesModel () const
 
void useSubduedColors ()
 
int verticalOffset () const override
 
QRect visualRect (const QModelIndex &index) const override
 
virtual QRegion visualRegion (const QModelIndex &index) const
 
QRegion visualRegionForSelection (const QItemSelection &selection) const override
 

Protected Slots

void connectAttributesModel (AttributesModel *)
 
- Protected Slots inherited from KDChart::AbstractDiagram
void setDataBoundariesDirty () const
 

Protected Member Functions

virtual qreal threeDItemDepth (const QModelIndex &index) const =0
 
virtual qreal threeDItemDepth (int column) const =0
 
- Protected Member Functions inherited from KDChart::AbstractDiagram
 AbstractDiagram (Private *p, QWidget *parent, AbstractCoordinatePlane *plane)
 
 AbstractDiagram (QWidget *parent=nullptr, AbstractCoordinatePlane *plane=nullptr)
 
QModelIndex attributesModelRootIndex () const
 returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram. More...
 
virtual const QPair< QPointF, QPointF > calculateDataBoundaries () const =0
 
virtual bool checkInvariants (bool justReturnTheStatus=false) const
 
virtual Q_DECL_DEPRECATED void paintDataValueTexts (QPainter *painter)
 
virtual Q_DECL_DEPRECATED void paintMarkers (QPainter *painter)
 
void setAttributesModelRootIndex (const QModelIndex &)
 
void setDatasetDimensionInternal (int dimension)
 
Q_DECL_DEPRECATED qreal valueForCell (int row, int column) const
 

Additional Inherited Members

- Signals inherited from KDChart::AbstractDiagram
void aboutToBeDestroyed ()
 
void attributesModelAboutToChange (AttributesModel *newModel, AttributesModel *oldModel)
 
void boundariesChanged ()
 
void dataHidden ()
 
void layoutChanged (AbstractDiagram *)
 
void modelDataChanged ()
 
void modelsChanged ()
 
void propertiesChanged ()
 
void viewportCoordinateSystemChanged ()
 

Detailed Description

Base class for diagrams based on a cartesian coordianate system.

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

Definition at line 29 of file KDChartAbstractCartesianDiagram.h.

Constructor & Destructor Documentation

◆ AbstractCartesianDiagram()

AbstractCartesianDiagram::AbstractCartesianDiagram ( QWidget *  parent = nullptr,
CartesianCoordinatePlane plane = nullptr 
)
explicit

Definition at line 41 of file KDChartAbstractCartesianDiagram.cpp.

◆ ~AbstractCartesianDiagram()

KDChart::AbstractCartesianDiagram::~AbstractCartesianDiagram ( )
override

Definition at line 47 of file KDChartAbstractCartesianDiagram.cpp.

References d.

Member Function Documentation

◆ addAxis()

void AbstractCartesianDiagram::addAxis ( CartesianAxis axis)
virtual

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

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

See also
takeAxis

Definition at line 69 of file KDChartAbstractCartesianDiagram.cpp.

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

◆ axes()

KDChart::CartesianAxisList AbstractCartesianDiagram::axes ( ) const
virtual
Returns
a list of all axes added to the diagram

Definition at line 88 of file KDChartAbstractCartesianDiagram.cpp.

References d.

◆ compare()

bool AbstractCartesianDiagram::compare ( const AbstractCartesianDiagram other) const

Returns true if both diagrams have the same settings.

Definition at line 26 of file KDChartAbstractCartesianDiagram.cpp.

References referenceDiagram(), and referenceDiagramOffset().

◆ connectAttributesModel

void AbstractCartesianDiagram::connectAttributesModel ( AttributesModel newModel)
protectedslot

Definition at line 171 of file KDChartAbstractCartesianDiagram.cpp.

References d.

Referenced by KDChart::Plotter::connectAttributesModel().

◆ layoutPlanes()

void KDChart::AbstractCartesianDiagram::layoutPlanes ( )
virtual

Triggers layouting of all coordinate planes on the current chart. Normally you don't need to call this method. It's handled automatically for you.

Definition at line 93 of file KDChartAbstractCartesianDiagram.cpp.

References KDChart::AbstractCoordinatePlane::layoutPlanes().

Referenced by addAxis(), and takeAxis().

◆ numberOfAbscissaSegments()

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

◆ numberOfOrdinateSegments()

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

◆ referenceDiagram()

AbstractCartesianDiagram * AbstractCartesianDiagram::referenceDiagram ( ) const
virtual
Returns
this diagram's reference diagram
See also
setReferenceDiagram

Definition at line 139 of file KDChartAbstractCartesianDiagram.cpp.

References d.

Referenced by compare(), and KDChart::CartesianCoordinatePlane::getDataDimensionsList().

◆ referenceDiagramOffset()

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

Definition at line 144 of file KDChartAbstractCartesianDiagram.cpp.

References d.

Referenced by compare().

◆ setAttributesModel()

void AbstractCartesianDiagram::setAttributesModel ( AttributesModel amodel)
overridevirtual

Sets an external AttributesModel on this diagram.

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

Correct:

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

Wrong:

diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters
modelThe AttributesModel to use for this diagram.
See also
AttributesModel, usesExternalAttributesModel

By default, a diagram has it's own internal set of attributes, but an external one can be set. This can be used to share attributes between several diagrams. The diagram does not take ownership of the attributesmodel.

Parameters
amodelThe AttributesModel to use for this diagram.

Reimplemented from KDChart::AbstractDiagram.

Definition at line 163 of file KDChartAbstractCartesianDiagram.cpp.

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

◆ setCoordinatePlane()

void KDChart::AbstractCartesianDiagram::setCoordinatePlane ( AbstractCoordinatePlane plane)
overridevirtual

◆ setModel()

void AbstractCartesianDiagram::setModel ( QAbstractItemModel *  model)
override

◆ setReferenceDiagram()

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

Makes this diagram use another diagram diagram as reference diagram with relative offset offset. To share cartesian axes between different diagrams there might be cases when you need that. Normally you don't.

See also
examples/SharedAbscissa

Definition at line 133 of file KDChartAbstractCartesianDiagram.cpp.

References d.

◆ setRootIndex()

void AbstractCartesianDiagram::setRootIndex ( const QModelIndex &  index)
override

◆ takeAxis()

void AbstractCartesianDiagram::takeAxis ( CartesianAxis axis)
virtual

Removes the axis from the diagram, without deleting it.

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

See also
addAxis

Definition at line 78 of file KDChartAbstractCartesianDiagram.cpp.

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

◆ threeDItemDepth() [1/2]

virtual qreal KDChart::AbstractCartesianDiagram::threeDItemDepth ( const QModelIndex &  index) const
protectedpure virtual
Returns
the 3D item depth of the model index index

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

◆ threeDItemDepth() [2/2]

virtual qreal KDChart::AbstractCartesianDiagram::threeDItemDepth ( int  column) const
protectedpure virtual
Returns
the 3D item depth of the data set column

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


The documentation for this class was generated from the following files:

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated by doxygen 1.9.1