AbstractBarSeries QML Type

Series type for creating a bar chart. More...

Properties

Signals

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

The x axis used for the series. If you leave both axisX and axisXTop undefined, a BarCategoriesAxis is created for the series.

See also axisXTop.


axisXTop : AbstractAxis

The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or axisXTop, but not both.

See also axisX.


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 y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY or axisYRight, but not both.

See also axisY.


barWidth : real

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.


count : int

Holds the number of sets in series.


labelsFormat : string

The format used for showing labels in series.

See also QAbstractBarSeries::labelsFormat, labelsVisible, and labelsPosition.


labelsPosition : string

Defines the position of value labels.

See also labelsVisible and labelsFormat.


labelsVisible : bool

Defines the visibility of the labels in series


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


onCountChanged()

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.


onLabelsAngleChanged(qreal angle)

Signal is emitted when the angle of the value labels is changed.


onLabelsPositionChanged(LabelsPosition position)

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.


clear()

Removes all barsets from the series.


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.


© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.