Presents data in bar graphs. 更多...
| import 语句: |
import QtGraphs
|
| 在 C++: | QBarSeries |
| 继承: |
Draws data by default as a series of bars grouped by category, with one bar per category from each bar set added to the series. It also supports horizontal bars and grouping bars as stacked.
|
barDelegate : 组件 |
A custom QML component used for visualizing each of the bars. Instance of this component is created for each of the bar. When this is not defined, a default rectangle visualization for bars is used.
The dynamic properties available for this component are:
| 类型 | 名称 | 描述 |
|---|---|---|
| color | barColor | The fill color of the bar. This value comes either from the GraphsTheme or from BarSet::color 若 BarSet overrides the color. |
| color | barBorderColor | The border color of the bar. This value comes either from the GraphsTheme or from BarSet::borderColor 若 BarSet overrides the color. |
| real | barBorderWidth | The width of the bar border. This value comes either from the GraphsTheme or from BarSet::borderWidth 若 BarSet overrides the width. |
| real | barValue | The value of the bar. This value comes from the BarSet::values . |
| string | barLabel | The label of the bar. This value comes from the BarSet::label . |
| bool | barSelected | This value is true when the bar is selected, meaning that the bar index is in BarSet::selectedBars . |
To use any of these, add property with the defined name into your custom component. For example
"property color barColor"
and
"property real barValue"
.
A list of sets added to the series.
|
barWidth : real |
宽度单位是 X 轴的单位。条形的最小宽度为 0,且负值被视为 0。将宽度设为 0 意味着屏幕中的条形宽度为 1 像素,不管 X 轴的刻度。宽于 0 的条形按 X 轴的刻度比例缩放。
By default, the barWidth is 0.5 (bars will take 50% of the available width). The valid values range from 0.0 (0%) to 1.0 (100%).
注意: When used with the BarSeries type, this value specifies the width of a group of bars instead of that of a single bar.
|
barsType : enumeration |
The type of the bar series:
| 常量 | 描述 |
|---|---|
BarSeries.BarsType.Groups
|
Bar sets are grouped by category. This is the default value. |
BarSeries.BarsType.Stacked
|
Bar sets are stacked after each other by category. |
BarSeries.BarsType.StackedPercent
|
Bar sets are stacked after each other by category. The segment size corresponds to the percentage of the segment value compared with the total value of all segments in the stack. |
The list of border colors to be used for all the objects in the series.
If there are more series than colors, the color list wraps and starts again with the first color in the list. If this is not set (default), colors from the GraphsTheme::borderColors 会被使用。
|
count
:
int
|
The number of bar sets in a bar series.
|
labelsAngle : real |
The angle of the value labels in degrees.
|
labelsFormat : string |
The format used for showing labels in a bar series.
另请参阅 QBarSeries::labelsFormat , labelsVisible ,和 labelsPosition .
|
labelsMargin : real |
The margin of the value labels in pixels.
This margin from side is used when
labelsPosition
is set to something else than
LabelsPosition.Center
。默认值为
0
.
|
labelsPosition : enumeration |
The position of the data value labels:
| 常量 | 描述 |
|---|---|
BarSeries.LabelsPosition.Center
|
Label is located in the center of the bar. |
BarSeries.LabelsPosition.InsideEnd
|
Label is located inside the bar at the top. |
BarSeries.LabelsPosition.InsideBase
|
Label is located inside the bar at the bottom. |
BarSeries.LabelsPosition.OutsideEnd
|
Label is located outside the bar at the top. |
另请参阅 labelsVisible and labelsFormat .
|
labelsPrecision : real |
The maximum amount of significant digits shown in value labels.
默认值为 6。
|
labelsVisible : bool |
The visibility of the labels in a bar series. The default label visibility is
false
.
The list of base colors to be used for all the objects in the series.
If there are more series than colors, the color list wraps and starts again with the first color in the list. If this is not set (default), colors from the GraphsTheme::seriesColors 会被使用。
|
barsetsAdded () |
This signal is emitted when bar sets are added to the series.
注意:
相应处理程序是
onBarsetsAdded
.
|
barsetsRemoved () |
This signal is emitted when bar sets are removed from the series.
注意:
相应处理程序是
onBarsetsRemoved
.
Returns the bar set at index . Returns null if the index is not valid.
|
Barset at ( int index ) |
Returns the bar set specified by
index
from the series. Returns
null
否则。
|
clear () |
Removes all bar sets from the series.
Returns the index of the bar set specified by
barset
from the series. Returns
-1
if not found.
Adds a new bar set with label and values to index . values can be a list of real values or a list of XYPoint 类型。
If the index value is equal to or less than zero, the new bar set is prepended to the bar series. If the index value is equal to or greater than the number of bar sets in the bar series, the new bar set is appended to the bar series.
另请参阅 append().
Removes the bar set specified by
barset
from the series. Returns
true
若成功,
false
否则。
Removes the bar set specified by
index
from the series. Returns
true
if the removal was successful,
false
否则。
Removes a range of bar sets as specified by the index and count . The call traverses over all sets even if removal of one fails.
Completely replaces all current bar set with sets . The size does not need to match. Returns false if any of the bar set in sets are invalid.
Replaces the bar set specified by
oldSet
with newSet. Returns
true
if the removal was successful,
false
否则。
oldSet
is destroyed if this is successful.
Replaces the bar set at the position specified by
index
from the series and replaces it with
barset
。返回
true
若成功,
false
否则。