Styling
All styling in the BarChart
and other chart widgets are Hierarchical from Top to Bottom. This means that the Bottom/Child level styling will override the Top/Parent level styling.
The class BarDataStyle
provides the styling options for the BarChart
.
Let's take an example to see how it works.
Above example will draw a collection of Single and MultiGroup Bars. Now let's add styling to our bars in this example.
Series Styling
To provide uniform styling for All the Bars in the BarChart
, we provide the styling at Series Level to the seriesStyle
property of the BarSeries
class.
Group Styling
If you wish to provide a specific uniform styling for all the bars in a group, you can provide styling at Group Level to the groupStyle
property for any BarGroup
.
The groupStyle
has overridden the styling at the seriesStyle
for Group 2 Multi Bars. groupStyle
property is available for every subclass that extends a BarGroup.
Theoretically, you can also provide groupStyle
to a SimpleBar
, even tough you only have one bar.
Bar Styling
Besides seriesStyle
and groupStyle
, you can can also customize each individual bars with the property barStyle for every BarData
. This is the bottom most styling property and will override any of the parent group or series level styling.
The above example provides a clear picture of the Hierarchical Structure for styling across the widget tree classes.
BarDataStyle Properties
barColor
Color?
false
null
gradient
Gradient?
false
null
strokeWidth
double?
false
null
strokeColor
Color?
false
null
cornerRadius
BorderRadius?
false
null
Last updated