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

#include <KDChartStockDiagram.h>

Inheritance diagram for KDChart::StockDiagram:
KDChart::AbstractCartesianDiagram KDChart::AbstractDiagram

Public Types

enum  Type { HighLowClose , OpenHighLowClose , Candlestick }
 

Public Member Functions

 StockDiagram (QWidget *parent=nullptr, CartesianCoordinatePlane *plane=nullptr)
 
 ~StockDiagram () override
 
QBrush downTrendCandlestickBrush () const
 
QBrush downTrendCandlestickBrush (int column) const
 
QPen downTrendCandlestickPen () const
 
QPen downTrendCandlestickPen (int column) const
 
QPen lowHighLinePen () const
 
QPen lowHighLinePen (int column) const
 
int numberOfAbscissaSegments () const override
 
int numberOfOrdinateSegments () const override
 
void paint (PaintContext *paintContext) override
 
void resize (const QSizeF &size) override
 
void setDownTrendCandlestickBrush (const QBrush &brush)
 
void setDownTrendCandlestickBrush (int column, const QBrush &brush)
 
void setDownTrendCandlestickPen (const QPen &pen)
 
void setDownTrendCandlestickPen (int column, const QPen &pen)
 
void setLowHighLinePen (const QPen &pen)
 
void setLowHighLinePen (int column, const QPen &pen)
 
void setStockBarAttributes (const StockBarAttributes &attr)
 
void setStockBarAttributes (int column, const StockBarAttributes &attr)
 
void setThreeDBarAttributes (const ThreeDBarAttributes &attr)
 
void setThreeDBarAttributes (int column, const ThreeDBarAttributes &attr)
 
void setType (Type type)
 
void setUpTrendCandlestickBrush (const QBrush &brush)
 
void setUpTrendCandlestickBrush (int column, const QBrush &brush)
 
void setUpTrendCandlestickPen (const QPen &pen)
 
void setUpTrendCandlestickPen (int column, const QPen &pen)
 
StockBarAttributes stockBarAttributes () const
 
StockBarAttributes stockBarAttributes (int column) const
 
ThreeDBarAttributes threeDBarAttributes () const
 
ThreeDBarAttributes threeDBarAttributes (int column) const
 
qreal threeDItemDepth (const QModelIndex &index) const override
 
qreal threeDItemDepth (int column) const override
 
Type type () const
 
QBrush upTrendCandlestickBrush () const
 
QBrush upTrendCandlestickBrush (int column) const
 
QPen upTrendCandlestickPen () const
 
QPen upTrendCandlestickPen (int column) 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
 
- 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

Definition at line 22 of file KDChartStockDiagram.h.

Member Enumeration Documentation

◆ Type

Enumerator
HighLowClose 
OpenHighLowClose 
Candlestick 

Definition at line 31 of file KDChartStockDiagram.h.

Constructor & Destructor Documentation

◆ StockDiagram()

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

Definition at line 21 of file KDChartStockDiagram.cpp.

◆ ~StockDiagram()

StockDiagram::~StockDiagram ( )
override

Definition at line 27 of file KDChartStockDiagram.cpp.

Member Function Documentation

◆ calculateDataBoundaries()

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

◆ downTrendCandlestickBrush() [1/2]

QBrush StockDiagram::downTrendCandlestickBrush ( ) const

Definition at line 190 of file KDChartStockDiagram.cpp.

References d.

◆ downTrendCandlestickBrush() [2/2]

QBrush StockDiagram::downTrendCandlestickBrush ( int  column) const

Definition at line 212 of file KDChartStockDiagram.cpp.

References d.

◆ downTrendCandlestickPen() [1/2]

QPen StockDiagram::downTrendCandlestickPen ( ) const

Definition at line 234 of file KDChartStockDiagram.cpp.

References d.

◆ downTrendCandlestickPen() [2/2]

QPen StockDiagram::downTrendCandlestickPen ( int  column) const

Definition at line 256 of file KDChartStockDiagram.cpp.

References d.

◆ lowHighLinePen() [1/2]

QPen StockDiagram::lowHighLinePen ( ) const

Definition at line 158 of file KDChartStockDiagram.cpp.

References d.

◆ lowHighLinePen() [2/2]

QPen StockDiagram::lowHighLinePen ( int  column) const

Definition at line 168 of file KDChartStockDiagram.cpp.

References d.

◆ numberOfAbscissaSegments()

int StockDiagram::numberOfAbscissaSegments ( ) const
overridevirtual

Implements KDChart::AbstractCartesianDiagram.

Definition at line 267 of file KDChartStockDiagram.cpp.

◆ numberOfOrdinateSegments()

int StockDiagram::numberOfOrdinateSegments ( ) const
overridevirtual

Implements KDChart::AbstractCartesianDiagram.

Definition at line 276 of file KDChartStockDiagram.cpp.

◆ paint()

void StockDiagram::paint ( PaintContext paintContext)
overridevirtual

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 281 of file KDChartStockDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), Candlestick, KDChart::AttributesModel::columnCount(), d, HighLowClose, OpenHighLowClose, KDChart::PaintContext::painter(), and KDChart::AttributesModel::rowCount().

◆ resize()

void StockDiagram::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 333 of file KDChartStockDiagram.cpp.

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

◆ setDownTrendCandlestickBrush() [1/2]

void StockDiagram::setDownTrendCandlestickBrush ( const QBrush &  brush)

Definition at line 185 of file KDChartStockDiagram.cpp.

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

◆ setDownTrendCandlestickBrush() [2/2]

void StockDiagram::setDownTrendCandlestickBrush ( int  column,
const QBrush &  brush 
)

Definition at line 207 of file KDChartStockDiagram.cpp.

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

◆ setDownTrendCandlestickPen() [1/2]

void StockDiagram::setDownTrendCandlestickPen ( const QPen &  pen)

Definition at line 229 of file KDChartStockDiagram.cpp.

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

◆ setDownTrendCandlestickPen() [2/2]

void StockDiagram::setDownTrendCandlestickPen ( int  column,
const QPen &  pen 
)

Definition at line 251 of file KDChartStockDiagram.cpp.

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

◆ setLowHighLinePen() [1/2]

void StockDiagram::setLowHighLinePen ( const QPen &  pen)

Definition at line 153 of file KDChartStockDiagram.cpp.

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

◆ setLowHighLinePen() [2/2]

void StockDiagram::setLowHighLinePen ( int  column,
const QPen &  pen 
)

Definition at line 163 of file KDChartStockDiagram.cpp.

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

◆ setStockBarAttributes() [1/2]

void StockDiagram::setStockBarAttributes ( const StockBarAttributes attr)

◆ setStockBarAttributes() [2/2]

void StockDiagram::setStockBarAttributes ( int  column,
const StockBarAttributes attr 
)

◆ setThreeDBarAttributes() [1/2]

void StockDiagram::setThreeDBarAttributes ( const ThreeDBarAttributes attr)

Sets the 3D attributes for all bars (i.e. candlesticks)

Parameters
attrThe 3D attributes to set

Definition at line 103 of file KDChartStockDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::propertiesChanged(), KDChart::AttributesModel::setModelData(), and KDChart::ThreeDBarAttributesRole.

◆ setThreeDBarAttributes() [2/2]

void StockDiagram::setThreeDBarAttributes ( int  column,
const ThreeDBarAttributes attr 
)

Sets the 3D attributes for the bar (i.e. candlestick) in certain column of the diagram

Note: Every column in a StockDiagram is represented by a row in the model

Parameters
columnThe column to set the 3D bar attributes for
attrThe 3D attributes to set

Definition at line 130 of file KDChartStockDiagram.cpp.

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

◆ setType()

void StockDiagram::setType ( Type  type)

Switches between the supported types of stock charts, depending on type

Definition at line 57 of file KDChartStockDiagram.cpp.

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

◆ setUpTrendCandlestickBrush() [1/2]

void StockDiagram::setUpTrendCandlestickBrush ( const QBrush &  brush)

Definition at line 175 of file KDChartStockDiagram.cpp.

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

◆ setUpTrendCandlestickBrush() [2/2]

void StockDiagram::setUpTrendCandlestickBrush ( int  column,
const QBrush &  brush 
)

Definition at line 195 of file KDChartStockDiagram.cpp.

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

◆ setUpTrendCandlestickPen() [1/2]

void StockDiagram::setUpTrendCandlestickPen ( const QPen &  pen)

Definition at line 219 of file KDChartStockDiagram.cpp.

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

◆ setUpTrendCandlestickPen() [2/2]

void StockDiagram::setUpTrendCandlestickPen ( int  column,
const QPen &  pen 
)

Definition at line 239 of file KDChartStockDiagram.cpp.

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

◆ stockBarAttributes() [1/2]

StockBarAttributes StockDiagram::stockBarAttributes ( ) const

◆ stockBarAttributes() [2/2]

StockBarAttributes StockDiagram::stockBarAttributes ( int  column) const

Definition at line 90 of file KDChartStockDiagram.cpp.

References d, stockBarAttributes(), and KDChart::StockBarAttributesRole.

◆ threeDBarAttributes() [1/2]

ThreeDBarAttributes StockDiagram::threeDBarAttributes ( ) const

Returns the 3D attributes for all bars (i.e. candlesticks)

Returns
the 3D bar attributes

Definition at line 116 of file KDChartStockDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::modelData(), and KDChart::ThreeDBarAttributesRole.

Referenced by threeDBarAttributes().

◆ threeDBarAttributes() [2/2]

ThreeDBarAttributes StockDiagram::threeDBarAttributes ( int  column) const

Returns the 3D attributes for a bars (i.e. candlestick) in a certain column of the diagram

Note: Every column in a StockDiagram is represented by a row in the model

Parameters
columnThe column to get the 3D bar attributes for
Returns
The 3D attributes for the specified column

Definition at line 145 of file KDChartStockDiagram.cpp.

References d, threeDBarAttributes(), and KDChart::ThreeDBarAttributesRole.

◆ threeDItemDepth() [1/2]

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

Implements KDChart::AbstractCartesianDiagram.

Definition at line 348 of file KDChartStockDiagram.cpp.

◆ threeDItemDepth() [2/2]

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

Implements KDChart::AbstractCartesianDiagram.

Definition at line 341 of file KDChartStockDiagram.cpp.

◆ type()

StockDiagram::Type StockDiagram::type ( ) const
Returns
the type of this diagram

Definition at line 66 of file KDChartStockDiagram.cpp.

References d.

Referenced by setType().

◆ upTrendCandlestickBrush() [1/2]

QBrush StockDiagram::upTrendCandlestickBrush ( ) const

Definition at line 180 of file KDChartStockDiagram.cpp.

References d.

◆ upTrendCandlestickBrush() [2/2]

QBrush StockDiagram::upTrendCandlestickBrush ( int  column) const

Definition at line 200 of file KDChartStockDiagram.cpp.

References d.

◆ upTrendCandlestickPen() [1/2]

QPen StockDiagram::upTrendCandlestickPen ( ) const

Definition at line 224 of file KDChartStockDiagram.cpp.

References d.

◆ upTrendCandlestickPen() [2/2]

QPen StockDiagram::upTrendCandlestickPen ( int  column) const

Definition at line 244 of file KDChartStockDiagram.cpp.

References d.


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