getBarChartData method
- ScienceAnalysis analysis,
- Color color
The package:fl_chart
helper class for the summary charts.
Implementation
BarChartData getBarChartData(ScienceAnalysis analysis, Color color) => BarChartData(
barGroups: [
BarChartGroupData(x: 0, barRods: [BarChartRodData(color: color, fromY: 0, toY: analysis.data.min ?? 0)]),
BarChartGroupData(x: 1, barRods: [BarChartRodData(color: color, fromY: 0, toY: analysis.data.average ?? 0)]),
BarChartGroupData(x: 2, barRods: [BarChartRodData(color: color, fromY: 0, toY: analysis.data.max ?? 0)]),
],
titlesData: FlTitlesData(
topTitles: const AxisTitles(),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (double value, TitleMeta meta) => SideTitleWidget(
axisSide: AxisSide.bottom,
space: 3,
child: Text(["Min", "Avg", "Max"][value.toInt()]),
),
),
),
),
barTouchData: BarTouchData(touchTooltipData: BarTouchTooltipData(fitInsideVertically: true, fitInsideHorizontally: true)),
);