The QValueAxis 类将值添加到图表轴。 更多...
头: | #include <QValueAxis> |
实例化: | ValueAxis |
继承: | QAbstractAxis |
继承者: | QCategoryAxis |
|
|
QValueAxis (QObject * parent = Q_NULLPTR) | |
~QValueAxis () | |
QString | labelFormat () const |
qreal | max () const |
qreal | min () const |
int | minorTickCount () const |
void | setLabelFormat (const QString & format ) |
void | setMax (qreal max ) |
void | setMin (qreal min ) |
void | setMinorTickCount (int count ) |
void | setRange (qreal min , qreal max ) |
void | setTickCount (int count ) |
int | tickCount () const |
virtual AxisType | type () const |
void | applyNiceNumbers () |
void | labelFormatChanged (const QString & format ) |
void | maxChanged (qreal max ) |
void | minChanged (qreal min ) |
void | minorTickCountChanged (int minorTickCount ) |
void | rangeChanged (qreal min , qreal max ) |
void | tickCountChanged (int tickCount ) |
The QValueAxis 类将值添加到图表轴。
A value axis can be set up to show an axis line with tick marks, grid lines, and shades. The values on the axis are drawn at the positions of tick marks.
以下范例代码阐明如何使用 QValueAxis 类:
QChartView *chartView = new QChartView; QLineSeries *series = new QLineSeries; // ... chartView->chart()->addSeries(series); QValueAxis *axisX = new QValueAxis; axisX->setRange(10, 20.5); axisX->setTickCount(10); axisX->setLabelFormat("%.2f"); chartView->chart()->setAxisX(axisX, series);
此特性保持轴的标签格式。
格式字符串支持的以下转换说明符、长度修饰符和标志的提供通过
printf()
在标准 C++ 库:d、i、o、x、X、f、F、e、E、g、G、c。
若
QChart::localizeNumbers
is
true
,支持的说明符限于:d、e、E、f、g、G 和 i。另外,仅支持精度修饰符。其余格式来自默认
QLocale
对于应用程序。
访问函数:
QString | labelFormat () const |
void | setLabelFormat (const QString & format ) |
通知程序信号:
void | labelFormatChanged (const QString & format ) |
另请参阅 QString::asprintf ().
此特性保持轴的最大值。
When setting this property, the minimum value is adjusted if necessary, to ensure that the range remains valid.
访问函数:
qreal | max () const |
void | setMax (qreal max ) |
通知程序信号:
void | maxChanged (qreal max ) |
此特性保持轴的最小值。
When setting this property, the maximum value is adjusted if necessary, to ensure that the range remains valid.
访问函数:
qreal | min () const |
void | setMin (qreal min ) |
通知程序信号:
void | minChanged (qreal min ) |
此特性保持轴的次要刻度标记数。这指示在图表主要刻度之间要绘制多少栅格线。次要刻度不绘制标签。默认值为 0。
访问函数:
int | minorTickCount () const |
void | setMinorTickCount (int count ) |
通知程序信号:
void | minorTickCountChanged (int minorTickCount ) |
This property holds the number of tick marks on the axis. This indicates how many grid lines are drawn on the chart. The default value is 5, and the number cannot be less than 2.
访问函数:
int | tickCount () const |
void | setTickCount (int count ) |
通知程序信号:
void | tickCountChanged (int tickCount ) |
Constructs an axis object that is a child of parent .
销毁对象。
[slot]
void
QValueAxis::
applyNiceNumbers
()
修改轴的当前范围和刻度标记数,以使看起来 nice . The algorithm considers numbers that can be expressed as a form of 1*10^n, 2* 10^n, or 5*10^n to be nice numbers. These numbers are used for setting spacing for the tick marks.
另请参阅 setRange () 和 setTickCount ().
[signal]
void
QValueAxis::
labelFormatChanged
(const
QString
&
format
)
此信号被发射当 format 对于轴标签改变。
注意: 通知程序信号对于特性 labelFormat .
[signal]
void
QValueAxis::
maxChanged
(
qreal
max
)
This signal is emitted when the maximum value of the axis, specified by max ,改变。
注意: 通知程序信号对于特性 max .
[signal]
void
QValueAxis::
minChanged
(
qreal
min
)
This signal is emitted when the minimum value of the axis, specified by min ,改变。
注意: 通知程序信号对于特性 min .
[signal]
void
QValueAxis::
minorTickCountChanged
(
int
minorTickCount
)
This signal is emitted when the number of minor tick marks on the axis, specified by minorTickCount ,改变。
注意: 通知程序信号对于特性 minorTickCount .
[signal]
void
QValueAxis::
rangeChanged
(
qreal
min
,
qreal
max
)
This signal is emitted when the minimum or maximum value of the axis, specified by min and max ,改变。
设置范围从 min to max 在轴。若 min 大于 max ,此函数返回不做任何改变。
[signal]
void
QValueAxis::
tickCountChanged
(
int
tickCount
)
This signal is emitted when the number of tick marks on the axis, specified by tickCount ,改变。
注意: 通知程序信号对于特性 tickCount .
[虚拟]
AxisType
QValueAxis::
type
() const
重实现自 QAbstractAxis::type ().
返回轴的类型。