BarComponent QML Type | Qt Graphs 6.8.0
Description: A base element for custom bar components.

- Qt 6.8
- Qt Graphs
- QML Types
- QtGraphs
- BarComponent
- Qt Graphs | Commercial or GPLv3

# BarComponent QML Type

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

Import Statement: | import QtGraphs

- List of all members, including inherited members
- BarComponent is part of Qt Graphs QML Types for 2D.

## Properties

- barBorderColor : color
- barBorderWidth : real
- barColor : color
- barLabel : string
- barSelected : bool
- barValue : real

## 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.