QCPAxisTickerLog specialisation that formats tick labels using SI (metric) prefixes and Wireshark size/packet units, with optional logarithmic tick placement.
More...
#include <qcp_axis_ticker_si.h>
|
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) override |
| | Returns the SI-prefixed, unit-annotated label for the tick at tick.
|
| |
| virtual int | getSubTickCount (double tickStep) override |
| | Returns the number of sub-ticks to place between two major ticks.
|
| |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) override |
| | Generates the vector of major tick positions for the given range.
|
| |
QCPAxisTickerLog specialisation that formats tick labels using SI (metric) prefixes and Wireshark size/packet units, with optional logarithmic tick placement.
◆ QCPAxisTickerSi()
Constructs a QCPAxisTickerSi.
- Parameters
-
| unit | The unit system to use for label formatting (default: packets). |
| customUnit | Optional custom unit suffix string; used when unit is FORMAT_SIZE_UNIT_CUSTOM. |
| log | true to use logarithmic tick spacing; false for linear. |
◆ createTickVector()
| QVector< double > QCPAxisTickerSi::createTickVector |
( |
double |
tickStep, |
|
|
const QCPRange & |
range |
|
) |
| |
|
overrideprotectedvirtual |
Generates the vector of major tick positions for the given range.
Delegates to the logarithmic or linear strategy depending on mLog, then rounds positions to clean SI-prefix boundaries where possible.
- Parameters
-
| tickStep | Ideal distance between ticks as computed by the base class. |
| range | Visible axis range for which ticks are needed. |
- Returns
- Ordered vector of major tick positions in axis coordinates.
◆ getSubTickCount()
| int QCPAxisTickerSi::getSubTickCount |
( |
double |
tickStep | ) |
|
|
overrideprotectedvirtual |
Returns the number of sub-ticks to place between two major ticks.
Adjusts sub-tick count based on whether logarithmic or linear spacing is active and the magnitude of tickStep.
- Parameters
-
| tickStep | Distance between two adjacent major ticks in axis coordinates. |
- Returns
- Number of sub-tick intervals between each pair of major ticks.
◆ getTickLabel()
| QString QCPAxisTickerSi::getTickLabel |
( |
double |
tick, |
|
|
const QLocale & |
locale, |
|
|
QChar |
formatChar, |
|
|
int |
precision |
|
) |
| |
|
overrideprotectedvirtual |
Returns the SI-prefixed, unit-annotated label for the tick at tick.
- Parameters
-
| tick | Axis coordinate of the tick to label. |
| locale | Locale used for number formatting. |
| formatChar | printf-style format character for numeric values. |
| precision | Number of significant digits for the formatted value. |
- Returns
- Formatted tick label string (e.g. "1.2 MB", "500 pkts").
◆ getUnit()
Returns the current unit system used for label formatting.
- Returns
- The active format_size_units_e value.
◆ setCustomUnit()
| void QCPAxisTickerSi::setCustomUnit |
( |
QString |
unit | ) |
|
Sets a custom unit suffix used when the unit is FORMAT_SIZE_UNIT_CUSTOM.
- Parameters
-
| unit | Custom unit string to append to tick labels. |
◆ setLog()
| void QCPAxisTickerSi::setLog |
( |
bool |
log | ) |
|
Enables or disables logarithmic tick spacing.
- Parameters
-
| log | true for logarithmic spacing; false for linear spacing. |
◆ setUnit()
Sets the unit system used for label formatting and invalidates cached ticks.
- Parameters
-
| unit | The format_size_units_e value to apply. |
◆ mCustomUnit
| QString QCPAxisTickerSi::mCustomUnit |
|
protected |
Custom unit suffix, active when mUnit is FORMAT_SIZE_UNIT_CUSTOM.
◆ mLog
| bool QCPAxisTickerSi::mLog |
|
protected |
true when logarithmic tick spacing is enabled.
◆ mUnit
Unit system applied to tick label formatting.
The documentation for this class was generated from the following files: