AbstractBarSeries QML Type
Series type for creating a bar chart. More...
Import Statement: | import QtCharts 2.1 |
Instantiates: | QAbstractBarSeries |
Inherits: | |
Inherited By: | BarSeries, HorizontalBarSeries, HorizontalPercentBarSeries, HorizontalStackedBarSeries, PercentBarSeries, and StackedBarSeries |
Properties
- axisX : AbstractAxis
- axisXTop : AbstractAxis
- axisY : AbstractAxis
- axisYRight : AbstractAxis
- barWidth : real
- count : int
- labelsFormat : string
- labelsPosition : string
- labelsVisible : bool
Signals
- onBarsetsAdded(BarSet barset)
- onBarsetsRemoved(BarSet barset)
- onClicked(int index, BarSet barset)
- onCountChanged()
- onDoubleClicked(int index, BarSet barset)
- onHovered(bool status, int index, BarSet barset)
- onLabelsAngleChanged(qreal angle)
- onLabelsPositionChanged(LabelsPosition position)
- onPressed(int index, BarSet barset)
- onReleased(int index, BarSet barset)
Methods
- BarSet append(string label, VariantList values)
- BarSet at(int index)
- clear()
- BarSet insert(int index, string label, VariantList values)
- bool remove(BarSet barset)
Detailed Description
The following QML shows how to create a simple bar chart:
ChartView { title: "Bar series" anchors.fill: parent legend.alignment: Qt.AlignBottom antialiasing: true BarSeries { id: mySeries axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } } }
Property Documentation
axisX : AbstractAxis |
axisXTop : AbstractAxis |
axisY : AbstractAxis |
The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for the series.
See also axisYRight.
axisYRight : AbstractAxis |
The width of the bars of the series. The unit of width is the unit of x-axis. The minimum width for bars is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. Note that with QBarSeries this value means the width of one group of bars instead of just one bar.
The format used for showing labels in series.
See also QAbstractBarSeries::labelsFormat, labelsVisible, and labelsPosition.
Defines the position of value labels.
See also labelsVisible and labelsFormat.
Signal Documentation
onBarsetsAdded(BarSet barset) |
Emitted when barset has been added to the series.
onBarsetsRemoved(BarSet barset) |
Emitted when barset has been removed from the series.
onClicked(int index, BarSet barset) |
The signal is emitted if the user clicks with a mouse on top of BarSet. Clicked bar inside set is indexed by index
This signal is emitted when barset count has been changed, for example by append or remove.
onDoubleClicked(int index, BarSet barset) |
The signal is emitted if the user doubleclicks with a mouse on top of BarSet. Doubleclicked bar inside set is indexed by index
onHovered(bool status, int index, BarSet barset) |
The signal is emitted if mouse is hovered on top of series. Parameter barset is the pointer of barset, where hover happened. Parameter status is true, if mouse entered on top of series, false if mouse left from top of series. Hovered bar inside the set is indexed by index.
Signal is emitted when the position of value labels is changed.
onPressed(int index, BarSet barset) |
The signal is emitted if the user presses with a mouse on top of BarSet. Pressed bar inside set is indexed by index
onReleased(int index, BarSet barset) |
The signal is emitted if the user releases with a mouse on top of BarSet. Released bar inside set is indexed by index
Method Documentation
BarSet append(string label, VariantList values) |
Adds a new bar set with label and values to index. Values is a list of reals. For example:
myBarSeries.append("set 1", [0, 0.2, 0.2, 0.5, 0.4, 1.5, 0.9]);
BarSet at(int index) |
Returns bar set at index. Returns null if the index is not valid.
BarSet insert(int index, string label, VariantList values) |
Inserts a new bar set with label and values to index. Values can be a list of reals or a list of XYPoints. If index is zero or smaller, the new barset is prepended. If the index is count or bigger, the new barset is appended.
See also AbstractBarSeries::append().
bool remove(BarSet barset) |
Removes the barset from the series. Returns true if successful, false otherwise.