BarComponent QML Type

A base element for custom bar components. More...

Import Statement: import QtGraphs

Properties

Detailed Description

In bar graphs, bars are by default rendered as rectangles with specified fill color, border color etc. By using this element, it is possible to render the bars using custom QML elements.

Here is an example of how to create bars that show backgroundImage, overlay the bar with selectionImage once selected and render also the value of the bar into the center of each bar.

BarSeries {
    barComponent: BarComponent {
        id: comp
        BarImage {
            id: backgroundImage
            anchors.fill: parent
            source: "images/bar_background.png"
        }
        BarImage {
            id: selectionImage
            anchors.fill: parent
            source: "images/bar_selection.png"
            visible: comp.selected
        }
        Text {
            anchors.centerIn: parent
            text: comp.barLabel
        }
    }
}

Property Documentation

barBorderColor : color

The border color of the bar. This value comes either from the SeriesTheme or from BarSet::borderColor if the BarSet overrides the color.


barBorderWidth : real

The width of the bar border. This value comes either from the SeriesTheme or from BarSet::borderWidth if the BarSet overrides the width.


barColor : color

The fill color of the bar. This value comes either from the SeriesTheme or from BarSet::color if the BarSet overrides the color.


barLabel : string

The label of the bar. This value comes either from the BarSet::label.


barSelected : bool

This value is true when the bar is selected, meaning that the bar index is in BarSet::selectedBars.


barValue : real

The value of the bar. This value comes either from the BarSet::values.


© 2024 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.