KD Chart API Documentation  3.1
Public Types | Public Member Functions | Protected Member Functions | List of all members
KDChart::LineDiagram Class Reference

LineDiagram defines a common line diagram. More...

#include <KDChartLineDiagram.h>

Inheritance diagram for KDChart::LineDiagram:
KDChart::AbstractCartesianDiagram KDChart::AbstractDiagram KDChart::LeveyJenningsDiagram

Public Types

enum  LineType { Normal = 0 , Stacked = 1 , Percent = 2 }
 

Public Member Functions

 LineDiagram (QWidget *parent=nullptr, CartesianCoordinatePlane *plane=nullptr)
 
 ~LineDiagram () override
 
bool centerDataPoints () const
 
virtual LineDiagramclone () const
 
bool compare (const LineDiagram *other) const
 
LineAttributes lineAttributes () const
 
LineAttributes lineAttributes (const QModelIndex &index) const
 
LineAttributes lineAttributes (int column) const
 
qreal lineTension () const
 
int numberOfAbscissaSegments () const override
 
int numberOfOrdinateSegments () const override
 
void resetLineAttributes (const QModelIndex &index)
 
void resetLineAttributes (int column)
 
void resize (const QSizeF &area) override
 
bool reverseDatasetOrder () const
 
void setCenterDataPoints (bool center)
 
void setLineAttributes (const LineAttributes &a)
 
void setLineAttributes (const QModelIndex &index, const LineAttributes &a)
 
void setLineAttributes (int column, const LineAttributes &a)
 
void setLineTension (qreal tenson)
 
void setReverseDatasetOrder (bool reverse)
 
void setThreeDLineAttributes (const QModelIndex &index, const ThreeDLineAttributes &a)
 
void setThreeDLineAttributes (const ThreeDLineAttributes &a)
 
void setThreeDLineAttributes (int column, const ThreeDLineAttributes &a)
 
void setType (const LineType type)
 
void setValueTrackerAttributes (const QModelIndex &index, const ValueTrackerAttributes &a)
 
ThreeDLineAttributes threeDLineAttributes () const
 
ThreeDLineAttributes threeDLineAttributes (const QModelIndex &index) const
 
ThreeDLineAttributes threeDLineAttributes (int column) const
 
LineType type () const
 
ValueTrackerAttributes valueTrackerAttributes (const QModelIndex &index) const
 
- Public Member Functions inherited from KDChart::AbstractCartesianDiagram
 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 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
 
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...
 
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 Member Functions

const QPair< QPointF, QPointF > calculateDataBoundaries () const override
 
void paint (PaintContext *paintContext) override
 
void paintEvent (QPaintEvent *) override
 
void resizeEvent (QResizeEvent *) override
 
qreal threeDItemDepth (const QModelIndex &index) const override
 
qreal threeDItemDepth (int column) const override
 
- 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 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 ()
 
- Protected Slots inherited from KDChart::AbstractCartesianDiagram
void connectAttributesModel (AttributesModel *)
 
- Protected Slots inherited from KDChart::AbstractDiagram
void setDataBoundariesDirty () const
 

Detailed Description

LineDiagram defines a common line diagram.

It provides different subtypes which are set using setType.

Definition at line 32 of file KDChartLineDiagram.h.

Member Enumeration Documentation

◆ LineType

Enumerator
Normal 
Stacked 
Percent 

Definition at line 55 of file KDChartLineDiagram.h.

Constructor & Destructor Documentation

◆ LineDiagram()

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

Definition at line 45 of file KDChartLineDiagram.cpp.

Referenced by clone().

◆ ~LineDiagram()

LineDiagram::~LineDiagram ( )
override

Definition at line 61 of file KDChartLineDiagram.cpp.

References d.

Member Function Documentation

◆ calculateDataBoundaries()

const QPair< QPointF, QPointF > LineDiagram::calculateDataBoundaries ( ) const
overrideprotectedvirtual

Reimplemented for internal purposes.

Implements KDChart::AbstractDiagram.

Definition at line 374 of file KDChartLineDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), and d.

◆ centerDataPoints()

bool LineDiagram::centerDataPoints ( ) const
Returns
option set by setCenterDataPoints()

Definition at line 151 of file KDChartLineDiagram.cpp.

References d.

Referenced by compare().

◆ clone()

LineDiagram * LineDiagram::clone ( ) const
virtual

Creates an exact copy of this diagram.

Reimplemented in KDChart::LeveyJenningsDiagram.

Definition at line 71 of file KDChartLineDiagram.cpp.

References LineDiagram(), d, and type().

◆ compare()

bool LineDiagram::compare ( const LineDiagram other) const

Returns true if both diagrams have the same settings.

Definition at line 78 of file KDChartLineDiagram.cpp.

References centerDataPoints(), reverseDatasetOrder(), and type().

◆ lineAttributes() [1/3]

LineAttributes LineDiagram::lineAttributes ( ) const
Returns
the global line attribute set

Definition at line 224 of file KDChartLineDiagram.cpp.

References d, and KDChart::LineAttributesRole.

Referenced by lineAttributes().

◆ lineAttributes() [2/3]

LineAttributes LineDiagram::lineAttributes ( const QModelIndex &  index) const
Returns
the line attribute set of the model index index

Definition at line 243 of file KDChartLineDiagram.cpp.

References d, and KDChart::LineAttributesRole.

◆ lineAttributes() [3/3]

LineAttributes LineDiagram::lineAttributes ( int  column) const
Returns
the line attribute set of data set column

Definition at line 232 of file KDChartLineDiagram.cpp.

References d, lineAttributes(), and KDChart::LineAttributesRole.

◆ lineTension()

qreal LineDiagram::lineTension ( ) const

Returns whether the lines are drawn smoothed

Definition at line 359 of file KDChartLineDiagram.cpp.

References d.

◆ numberOfAbscissaSegments()

int LineDiagram::numberOfAbscissaSegments ( ) const
overridevirtual

◆ numberOfOrdinateSegments()

int LineDiagram::numberOfOrdinateSegments ( ) const
overridevirtual

◆ paint()

void LineDiagram::paint ( PaintContext paintContext)
overrideprotectedvirtual

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

Parameters
paintContextAll information needed for painting.

Implements KDChart::AbstractDiagram.

Definition at line 399 of file KDChartLineDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::PaintContext::coordinatePlane(), d, KDChart::AbstractDiagram::dataBoundaries(), KDChart::AbstractGrid::isBoundariesValid(), KDChart::PaintContext::painter(), KDChart::PaintContext::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::sharedAxisMasterPlane().

Referenced by paintEvent().

◆ paintEvent()

void LineDiagram::paintEvent ( QPaintEvent *  )
overrideprotected

◆ resetLineAttributes() [1/2]

void LineDiagram::resetLineAttributes ( const QModelIndex &  index)

Remove any explicit line attributes settings that might have been specified before.

Definition at line 214 of file KDChartLineDiagram.cpp.

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

◆ resetLineAttributes() [2/2]

void LineDiagram::resetLineAttributes ( int  column)

Resets the line attributes of data set column

Definition at line 191 of file KDChartLineDiagram.cpp.

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

◆ resize()

void LineDiagram::resize ( const QSizeF &  area)
overridevirtual

Called by the widget's sizeEvent. Adjust all internal structures, that are calculated, depending on the size of the widget.

Parameters
areaSize of the widget

Implements KDChart::AbstractDiagram.

Definition at line 420 of file KDChartLineDiagram.cpp.

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

◆ resizeEvent()

void LineDiagram::resizeEvent ( QResizeEvent *  )
overrideprotected

Definition at line 370 of file KDChartLineDiagram.cpp.

◆ reverseDatasetOrder()

bool LineDiagram::reverseDatasetOrder ( ) const
See also
setReverseDatasetOrder

Definition at line 161 of file KDChartLineDiagram.cpp.

References d.

Referenced by compare().

◆ setCenterDataPoints()

void LineDiagram::setCenterDataPoints ( bool  center)

If centerDataPoints() is true, all data points are moved by an offset of 0.5 to the right. This is useful in conjunction with bar diagrams, since data points are then centered just like bars.

See also
centerDataPoints()

Definition at line 136 of file KDChartLineDiagram.cpp.

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

◆ setLineAttributes() [1/3]

void LineDiagram::setLineAttributes ( const LineAttributes la)

Sets the global line attributes to la

Definition at line 169 of file KDChartLineDiagram.cpp.

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

◆ setLineAttributes() [2/3]

void LineDiagram::setLineAttributes ( const QModelIndex &  index,
const LineAttributes la 
)

Sets the line attributes for the model index index to la

Definition at line 200 of file KDChartLineDiagram.cpp.

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

◆ setLineAttributes() [3/3]

void LineDiagram::setLineAttributes ( int  column,
const LineAttributes la 
)

Sets the line attributes of data set column to la

Definition at line 180 of file KDChartLineDiagram.cpp.

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

◆ setLineTension()

void LineDiagram::setLineTension ( qreal  tenson)

This property defines the strength of the line curvature - 0 for straight lines between data points, 1 for a smooth curve through the data points

Definition at line 364 of file KDChartLineDiagram.cpp.

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

◆ setReverseDatasetOrder()

void LineDiagram::setReverseDatasetOrder ( bool  reverse)

With this property set to true, data sets in a normal line diagram are drawn in reversed order. More clearly, the first (top-most) data set in the source model will then appear in front. This is mostly due to historical reasons.

Definition at line 156 of file KDChartLineDiagram.cpp.

References d.

◆ setThreeDLineAttributes() [1/3]

void LineDiagram::setThreeDLineAttributes ( const QModelIndex &  index,
const ThreeDLineAttributes la 
)

Sets the 3D line attributes of model index index to la

Definition at line 280 of file KDChartLineDiagram.cpp.

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

◆ setThreeDLineAttributes() [2/3]

void LineDiagram::setThreeDLineAttributes ( const ThreeDLineAttributes la)

◆ setThreeDLineAttributes() [3/3]

void LineDiagram::setThreeDLineAttributes ( int  column,
const ThreeDLineAttributes la 
)

Sets the 3D line attributes of data set column to ta

Definition at line 268 of file KDChartLineDiagram.cpp.

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

◆ setType()

void LineDiagram::setType ( const LineType  type)

◆ setValueTrackerAttributes()

void LineDiagram::setValueTrackerAttributes ( const QModelIndex &  index,
const ValueTrackerAttributes va 
)

Sets the value tracker attributes of the model index index to va

Definition at line 335 of file KDChartLineDiagram.cpp.

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

◆ threeDItemDepth() [1/2]

qreal LineDiagram::threeDItemDepth ( const QModelIndex &  index) const
overrideprotectedvirtual
Returns
the 3D item depth of the model index index

Implements KDChart::AbstractCartesianDiagram.

Definition at line 322 of file KDChartLineDiagram.cpp.

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

◆ threeDItemDepth() [2/2]

qreal LineDiagram::threeDItemDepth ( int  column) const
overrideprotectedvirtual
Returns
the 3D item depth of the data set column

Implements KDChart::AbstractCartesianDiagram.

Definition at line 327 of file KDChartLineDiagram.cpp.

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

◆ threeDLineAttributes() [1/3]

ThreeDLineAttributes LineDiagram::threeDLineAttributes ( ) const
Returns
the global 3D line attributes

Definition at line 295 of file KDChartLineDiagram.cpp.

References d, and KDChart::ThreeDLineAttributesRole.

Referenced by threeDItemDepth(), and threeDLineAttributes().

◆ threeDLineAttributes() [2/3]

ThreeDLineAttributes LineDiagram::threeDLineAttributes ( const QModelIndex &  index) const
Returns
the 3D line attributes of the model index index

Definition at line 314 of file KDChartLineDiagram.cpp.

References d, and KDChart::ThreeDLineAttributesRole.

◆ threeDLineAttributes() [3/3]

ThreeDLineAttributes LineDiagram::threeDLineAttributes ( int  column) const
Returns
the 3D line attributes of data set column

Definition at line 303 of file KDChartLineDiagram.cpp.

References d, threeDLineAttributes(), and KDChart::ThreeDLineAttributesRole.

◆ type()

LineDiagram::LineType LineDiagram::type ( ) const
Returns
the type of the line diagram

Definition at line 131 of file KDChartLineDiagram.cpp.

References d.

Referenced by clone(), compare(), KDChart::LeveyJenningsDiagram::drawDataPointSymbol(), and setType().

◆ valueTrackerAttributes()

ValueTrackerAttributes LineDiagram::valueTrackerAttributes ( const QModelIndex &  index) const

Returns the value tracker attributes of the model index index

Definition at line 347 of file KDChartLineDiagram.cpp.

References d, and KDChart::ValueTrackerAttributesRole.


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