BarCategoryAxis QML Type

Adds categories to a graph's axes. 更多...

import 語句: import QtGraphs
在 C++: QBarCategoryAxis
繼承:

AbstractAxis

特性

信號

方法

詳細描述

The BarCategoryAxis type can be set up to show an axis line with tick marks, grid lines, and shades. Categories are drawn between the ticks.

The following QML snippet illustrates how to use BarCategoryAxis:

GraphsView {
    anchors.fill: parent
    axisX: BarCategoryAxis {
        categories: ["2023", "2024", "2025"]
        lineVisible: false
    }
    axisY: ValueAxis { }
    BarSeries {
        BarSet {
            values: [7, 6, 9]
        }
    }
}
					

特性文檔編製

categories : list

The categories of an axis.

count : int [read-only]

The number of categories of an axis.

max : string

The maximum value on the axis. The given value should be contained in categories .

min : string

The minimum value on the axis. The given value should be contained in categories .

信號文檔編製

categoriesChanged ()

This signal is emitted when the categories of the axis change.

注意: 相應處理程序是 onCategoriesChanged .

categoryRangeChanged ( string min , string max )

This signal is emitted when the range of categories of the axis changes. min and max are the min and max of the new range.

注意: 相應處理程序是 onCategoryRangeChanged .

countChanged ()

This signal is emitted when the number of categories of an axis changes.

注意: 相應處理程序是 onCountChanged .

maxChanged ( string max )

This signal is emitted when the axis maximum value changes to max .

注意: 相應處理程序是 onMaxChanged .

minChanged ( string min )

This signal is emitted when the axis minimum value changes to min .

注意: 相應處理程序是 onMinChanged .

方法文檔編製

append ( list categories )

追加 categories to an axis. The maximum value on the axis will be changed to match the last category in categories . If no categories were previously defined, the minimum value on the axis will also be changed to match the first category in categories .

A category has to be a valid QString and it cannot be duplicated. Duplicated categories will not be appended.

append ( string category )

追加 category to an axis. The maximum value on the axis will be changed to match the last category . If no categories were previously defined, the minimum value on the axis will also be changed to match category .

A category has to be a valid QString and it cannot be duplicated. Duplicated categories will not be appended.

string at ( int index )

Returns the category at index .

clear ()

Removes all categories. Sets the maximum and minimum values of the axis range to QString::null.

insert ( int index , string category )

插入 category to the axis at index . category has to be a valid QString and it cannot be duplicated. If category is prepended or appended to other categories, the minimum and maximum values on the axis are updated accordingly.

remove ( int index )

Removes a category at index from the axis. Removing a category that currently sets the maximum or minimum value on the axis will affect the axis range.

remove ( string category )

移除 category from the axis. Removing a category that currently sets the maximum or minimum value on the axis will affect the axis range.

replace ( string oldCategory , string newCategory )

替換 oldCategory with newCategory 。若 oldCategory does not exist on the axis, nothing is done. newCategory has to be a valid QString and it cannot be duplicated. If the minimum or maximum category is replaced, the minimum and maximum values on the axis are updated accordingly.