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

#include <KDChartTernaryGrid.h>

Inheritance diagram for KDChart::TernaryGrid:
KDChart::AbstractGrid

Public Member Functions

 TernaryGrid ()
 
 ~TernaryGrid () override
 
DataDimensionsList calculateGrid (const DataDimensionsList &rawDataDimensions) const override
 Calculates the grid start/end/step width values. More...
 
void drawGrid (PaintContext *context) override
 
QPair< QSizeF, QSizeF > requiredMargins () const
 
const QVector< TickInfo > & tickInfo () const
 
- Public Member Functions inherited from KDChart::AbstractGrid
virtual ~AbstractGrid ()
 
void setNeedRecalculate ()
 
DataDimensionsList updateData (AbstractCoordinatePlane *plane)
 Returns the cached result of data calculation. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from KDChart::AbstractGrid
static const DataDimension adjustedLowerUpperRange (const DataDimension &dim, bool adjustLower, bool adjustUpper)
 
static void adjustLowerUpperRange (qreal &start, qreal &end, qreal stepWidth, bool adjustLower, bool adjustUpper)
 
static bool isBoundariesValid (const DataDimensionsList &l)
 
static bool isBoundariesValid (const QPair< QPointF, QPointF > &b)
 
static bool isBoundariesValid (const QRectF &r)
 
static bool isValueValid (const qreal &r)
 
- Public Attributes inherited from KDChart::AbstractGrid
GridAttributes gridAttributes
 
- Protected Member Functions inherited from KDChart::AbstractGrid
 AbstractGrid ()
 
- Protected Attributes inherited from KDChart::AbstractGrid
DataDimensionsList mDataDimensions
 
AbstractCoordinatePlanemPlane = nullptr
 

Detailed Description

Definition at line 33 of file KDChartTernaryGrid.h.

Constructor & Destructor Documentation

◆ TernaryGrid()

TernaryGrid::TernaryGrid ( )

Definition at line 43 of file KDChartTernaryGrid.cpp.

◆ ~TernaryGrid()

TernaryGrid::~TernaryGrid ( )
override

Definition at line 48 of file KDChartTernaryGrid.cpp.

Member Function Documentation

◆ calculateGrid()

DataDimensionsList TernaryGrid::calculateGrid ( const DataDimensionsList rawDataDimensions) const
overridevirtual

Calculates the grid start/end/step width values.

Gets the raw data dimensions - e.g. the data model's boundaries, together with their isCalculated flags.

Returns the calculated start/end values for the grid, and their respective step widths. If at least one of the step widths is Zero, all dimensions of the returned list are considered invalid!

Note
This function needs to be implemented by all derived classes, like CartesianGrid, PolarGrid, ...

Implements KDChart::AbstractGrid.

Definition at line 184 of file KDChartTernaryGrid.cpp.

◆ drawGrid()

void TernaryGrid::drawGrid ( PaintContext context)
overridevirtual

Doing the actual drawing.

Every derived class must implement this.

Note
When implementing drawGrid(): Before you start drawing, make sure to call updateData(), to get the data boundaries recalculated. For an example, see the implementation of CartesianGrid:drawGrid().

Implements KDChart::AbstractGrid.

Definition at line 52 of file KDChartTernaryGrid.cpp.

References AxisVector_B_A, AxisVector_C_A, KDChart::PaintContext::coordinatePlane(), KDChart::TickInfo::depth, FullMarkerDistanceAC, FullMarkerDistanceBA, FullMarkerDistanceBC, KDChart::PaintContext::painter(), KDChart::PrintingParameters::scalePen(), translate(), TriangleBottomLeft, TriangleBottomRight, and TriangleTop.

◆ requiredMargins()

QPair< QSizeF, QSizeF > TernaryGrid::requiredMargins ( ) const

Returns two QSizeF objects specifying the dimension of the margins needed between each corner of the diagram and the border of the drawing area. Margins are required because the tick marks are placed outside of the triangles containing rectangle. The margins are returned in diagram coordinates, since the grid does not know about widget coordinates.

Definition at line 189 of file KDChartTernaryGrid.cpp.

References FullMarkerDistanceBA, and FullMarkerDistanceBC.

Referenced by KDChart::TernaryCoordinatePlane::layoutDiagrams().

◆ tickInfo()

const QVector< TickInfo > & TernaryGrid::tickInfo ( ) const

Return the locations of the grid lines, so that axes can draw axis rulers at the correct positions. This information is valid after the grid has been painted (that is, the axes need to be painted after the grid.

Definition at line 206 of file KDChartTernaryGrid.cpp.


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