QValue3DAxisFormatter Class

The QValue3DAxisFormatter class is a base class for value axis formatters. More...

Header: #include <QValue3DAxisFormatter>
CMake: find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)
qmake: QT += datavisualization
Since: QtDataVisualization 1.1
Instantiated By: ValueAxis3DFormatter
Inherited By:

QLogValue3DAxisFormatter

Public Functions

Protected Functions

bool allowNegatives() const
bool allowZero() const
QValue3DAxis *axis() const
virtual QValue3DAxisFormatter *createNewInstance() const
QList<float> &gridPositions() const
QList<float> &labelPositions() const
QStringList &labelStrings() const
QLocale locale() const
virtual void recalculate()
QList<float> &subGridPositions() const

Detailed Description

This class provides formatting rules for a linear value 3D axis. Subclass it if you want to implement custom value axes.

The base class has no public API beyond constructors and destructors. It is meant to be only used internally. However, subclasses may implement public properties as needed.

See also QValue3DAxis and QLogValue3DAxisFormatter.

Member Function Documentation

[virtual] QValue3DAxisFormatter::~QValue3DAxisFormatter()

Deletes the value 3D axis formatter.

[protected] bool QValue3DAxisFormatter::allowNegatives() const

Returns true if negative values are valid values for the parent axis. The default implementation always returns true.

[protected] bool QValue3DAxisFormatter::allowZero() const

Returns true if zero is a valid value for the parent axis. The default implementation always returns true.

[protected] QValue3DAxis *QValue3DAxisFormatter::axis() const

Returns the parent axis. The parent axis must only be accessed in the recalculate() method to maintain thread safety in environments using a threaded renderer.

See also recalculate().

[virtual protected] QValue3DAxisFormatter *QValue3DAxisFormatter::createNewInstance() const

Creates a new empty value 3D axis formatter. Must be reimplemented in a subclass.

Returns the new formatter. The renderer uses this method to cache a copy of the formatter. The ownership of the new copy is transferred to the caller.

[protected] QList<float> &QValue3DAxisFormatter::gridPositions() const

Returns a reference to the array of normalized grid line positions. The default array size is equal to the segment count of the parent axis plus one, but a subclassed implementation of the recalculate() method may resize the array differently. The values should be between 0.0 (the minimum value) and 1.0 (the maximum value), inclusive.

See also QValue3DAxis::segmentCount and recalculate().

[protected] QList<float> &QValue3DAxisFormatter::labelPositions() const

Returns a reference to the array of normalized label positions. The default array size is equal to the segment count of the parent axis plus one, but a subclassed implementation of the recalculate() method may resize the array differently. The values should be between 0.0 (the minimum value) and 1.0 (the maximum value), inclusive. By default, the label at the index zero corresponds to the minimum value of the axis.

See also QValue3DAxis::segmentCount, QAbstract3DAxis::labels, and recalculate().

[protected] QStringList &QValue3DAxisFormatter::labelStrings() const

Returns a reference to the string list containing formatter label strings. The array size must be equal to the size of the label positions array, which the indexes also correspond to.

See also labelPositions().

[protected] QLocale QValue3DAxisFormatter::locale() const

Returns the current locale this formatter is using.

[virtual protected] void QValue3DAxisFormatter::recalculate()

Resizes and populates the label and grid line position arrays and the label strings array, as well as calculates any values needed to map a value to its position. The parent axis can be accessed from inside this function.

This method must be reimplemented in a subclass if the default array contents are not suitable.

See gridPositions(), subGridPositions(), labelPositions(), and labelStrings() methods for documentation about the arrays that need to be resized and populated.

See also gridPositions(), subGridPositions(), labelPositions(), labelStrings(), and axis().

[protected] QList<float> &QValue3DAxisFormatter::subGridPositions() const

Returns a reference to the array of normalized subgrid line positions. The default array size is equal to the segment count of the parent axis times the sub-segment count of the parent axis minus one, but a subclassed implementation of the recalculate() method may resize the array differently. The values should be between 0.0 (the minimum value) and 1.0 (the maximum value), inclusive.

See also QValue3DAxis::segmentCount, QValue3DAxis::subSegmentCount, and recalculate().