BarChartData constructor
- List<
BarChartGroupData> ? barGroups, - double? groupsSpace,
- BarChartAlignment? alignment,
- FlTitlesData? titlesData,
- BarTouchData? barTouchData,
- double? maxY,
- double? minY,
- double? baselineY,
- FlGridData? gridData,
- FlBorderData? borderData,
- RangeAnnotations? rangeAnnotations,
- Color? backgroundColor,
- ExtraLinesData? extraLinesData,
BarChart draws some barGroups
and aligns them using alignment
,
if alignment
is BarChartAlignment.center, you can define groupsSpace
to apply space between them.
It draws some titles on left, top, right, bottom sides per each axis number,
you can modify titlesData
to have your custom titles,
also you can define the axis title (one text per axis) for each side
using axisTitleData
, you can restrict the y axis using minX, and maxY
values.
It draws a color as a background behind everything you can set it using backgroundColor
,
then a grid over it, you can customize it using gridData
,
and it draws 4 borders around your chart, you can customize it using borderData
.
You can annotate some regions with a highlight color using rangeAnnotations
.
You can modify barTouchData
to customize touch behaviors and responses.
Horizontal lines are drawn with extraLinesData
. Vertical lines will not be painted if received.
Please see issue #1149 (https://github.com/imaNNeo/fl_chart/issues/1149) for vertical lines.
Implementation
BarChartData({
List<BarChartGroupData>? barGroups,
double? groupsSpace,
BarChartAlignment? alignment,
FlTitlesData? titlesData,
BarTouchData? barTouchData,
double? maxY,
double? minY,
super.baselineY,
FlGridData? gridData,
super.borderData,
RangeAnnotations? rangeAnnotations,
super.backgroundColor,
ExtraLinesData? extraLinesData,
}) : barGroups = barGroups ?? const [],
groupsSpace = groupsSpace ?? 16,
alignment = alignment ?? BarChartAlignment.spaceEvenly,
barTouchData = barTouchData ?? BarTouchData(),
super(
titlesData: titlesData ??
const FlTitlesData(
topTitles: AxisTitles(),
),
gridData: gridData ?? const FlGridData(),
rangeAnnotations: rangeAnnotations ?? const RangeAnnotations(),
touchData: barTouchData ?? BarTouchData(),
extraLinesData: extraLinesData ?? const ExtraLinesData(),
minX: 0,
maxX: 1,
maxY: maxY ?? double.nan,
minY: minY ?? double.nan,
);