Skip to content

Class QAccelPlot::TickLabelFormatter

ClassList > QAccelPlot > TickLabelFormatter

Abstract base class for tick label formatters. More...

  • #include <TickLabelFormatter.hpp>

Inherits the following classes: QObject

Inherited by the following classes: QAccelPlot::DateTimeTickLabelFormatter, QAccelPlot::NumericTickLabelFormatter, QAccelPlot::TextTickLabelFormatter

Inheritance diagram

flowchart TB
  classQAccelPlot_1_1TickLabelFormatter["QAccelPlot::TickLabelFormatter"]

  external_base_classQAccelPlot_1_1TickLabelFormatter_1["QObject"]
  external_base_classQAccelPlot_1_1TickLabelFormatter_1 --> classQAccelPlot_1_1TickLabelFormatter

  classQAccelPlot_1_1DateTimeTickLabelFormatter["QAccelPlot::DateTimeTickLabelFormatter"]
  classQAccelPlot_1_1TickLabelFormatter --> classQAccelPlot_1_1DateTimeTickLabelFormatter
  click classQAccelPlot_1_1DateTimeTickLabelFormatter "../classQAccelPlot_1_1DateTimeTickLabelFormatter/" "Open QAccelPlot::DateTimeTickLabelFormatter"

  classQAccelPlot_1_1NumericTickLabelFormatter["QAccelPlot::NumericTickLabelFormatter"]
  classQAccelPlot_1_1TickLabelFormatter --> classQAccelPlot_1_1NumericTickLabelFormatter
  click classQAccelPlot_1_1NumericTickLabelFormatter "../classQAccelPlot_1_1NumericTickLabelFormatter/" "Open QAccelPlot::NumericTickLabelFormatter"

  classQAccelPlot_1_1TextTickLabelFormatter["QAccelPlot::TextTickLabelFormatter"]
  classQAccelPlot_1_1TickLabelFormatter --> classQAccelPlot_1_1TextTickLabelFormatter
  click classQAccelPlot_1_1TextTickLabelFormatter "../classQAccelPlot_1_1TextTickLabelFormatter/" "Open QAccelPlot::TextTickLabelFormatter"

Public Properties

Type Name
property QML_ANONYMOUSQJSValue tickLabel
Optional JavaScript callback function(value, tickStep) that overridesdoFormat() .

Public Signals

Type Name
signal void formatChanged
Emitted whenever a property that affects formatted output changes.
signal void tickLabelChanged
Emitted when the tickLabel property changes.

Public Functions

Type Name
TickLabelFormatter (QObject * parent=nullptr)
Constructs an TickLabelFormatter with the given__parent .
QString format (qreal value, qreal tickStep) const
Returns the display string for value at the given__tickStep .
QString formatLogTick (qreal value) const
Returns the display string for a major tick at value on a logarithmic axis.
virtual qreal minimumTickStep () const
Returns the smallest major tick step a linear axis may use with this formatter.
void setTickLabel (const QJSValue & tickLabel)
Sets the JavaScript override callback to tickLabel .
QJSValue tickLabel () const
Returns the optional JavaScript override callback.

Protected Functions

Type Name
virtual QString doFormat (qreal value, qreal tickStep) const = 0
Subclass entry point — returns the formatted label for value .
virtual QString doFormatLogTick (qreal value) const
Subclass entry point for log-scale major ticks — returns the label for value .

Detailed Description

Subclasses implement doFormat() to produce a display string for each tick value. An optional tickLabel JavaScript callback can override the default formatting at the QML level.

See also: NumericTickLabelFormatter, DateTimeTickLabelFormatter, TextTickLabelFormatter

Public Properties Documentation

property tickLabel

Optional JavaScript callback function(value, tickStep) that overridesdoFormat() .

QML_ANONYMOUSQJSValue QAccelPlot::TickLabelFormatter::tickLabel;


Public Signals Documentation

signal formatChanged

Emitted whenever a property that affects formatted output changes.

void QAccelPlot::TickLabelFormatter::formatChanged;


signal tickLabelChanged

Emitted when the tickLabel property changes.

void QAccelPlot::TickLabelFormatter::tickLabelChanged;


Public Functions Documentation

function TickLabelFormatter

Constructs an TickLabelFormatter with the given__parent .

explicit QAccelPlot::TickLabelFormatter::TickLabelFormatter (
    QObject * parent=nullptr
) 


function format

Returns the display string for value at the given__tickStep .

QString QAccelPlot::TickLabelFormatter::format (
    qreal value,
    qreal tickStep
) const

Calls the tickLabel JS callback if set; otherwise delegates to doFormat().


function formatLogTick

Returns the display string for a major tick at value on a logarithmic axis.

QString QAccelPlot::TickLabelFormatter::formatLogTick (
    qreal value
) const

Log-scale ticks have no single step, so the tickLabel JS callback receives value as its tickStep. Without a callback this delegates to doFormatLogTick().


function minimumTickStep

Returns the smallest major tick step a linear axis may use with this formatter.

virtual qreal QAccelPlot::TickLabelFormatter::minimumTickStep () const

The axis raises a smaller "nice" step to this value. The default is 0, no minimum. Called from the scene graph sync as well as the GUI thread, so overrides must not call into QML.


function setTickLabel

Sets the JavaScript override callback to tickLabel .

void QAccelPlot::TickLabelFormatter::setTickLabel (
    const QJSValue & tickLabel
) 


function tickLabel

Returns the optional JavaScript override callback.

QJSValue QAccelPlot::TickLabelFormatter::tickLabel () const


Protected Functions Documentation

function doFormat

Subclass entry point — returns the formatted label for value .

virtual QString QAccelPlot::TickLabelFormatter::doFormat (
    qreal value,
    qreal tickStep
) const = 0


function doFormatLogTick

Subclass entry point for log-scale major ticks — returns the label for value .

virtual QString QAccelPlot::TickLabelFormatter::doFormatLogTick (
    qreal value
) const

The default implementation returns doFormat(value, value), using the tick's own magnitude as a proxy for the precision it needs.



The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/formatters/TickLabelFormatter.hpp