Skip to content
Snippets Groups Projects
Commit f5237bc0 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

add: 4th layer on bar chart

parent 34cffbf1
No related branches found
No related tags found
1 merge request!12Clhp map
......@@ -16,14 +16,15 @@ class _BarDataState extends State<BarData> {
// NB should be allocated values dynamically
// Bar items show data for 10 previous days
static const barData = <int, List<double>>{
0: [1.5, 4, 2.5],
1: [1.8, 5.6, 3],
2: [1.5, 3.1, 3.5],
3: [1.5, 1.5, 4],
4: [2, 2, 5],
5: [1.2, 1.5, 4.3],
6: [1.2, 4.8, 5],
0: [1.5, 3.2, 1.5, 2.2],
1: [1.8, 4.6, 2, 3.1],
2: [1.5, 2.1, 2.5, 1.8],
3: [1.5, 1, 3, 2.6],
4: [2, 2, 3.9, 2.3],
5: [1.2, 1.2, 3.3, 2.9],
6: [1.2, 2.3, 3.3, 3.2],
};
int touchedIndex = -1;
@override
......@@ -36,8 +37,9 @@ class _BarDataState extends State<BarData> {
double value1,
double value2,
double value3,
double value4,
) {
final sum = value1 + value2 + value3;
final sum = value1 + value2 + value3 + value4;
final isTouched = touchedIndex == x;
return BarChartGroupData(
x: x,
......@@ -64,6 +66,11 @@ class _BarDataState extends State<BarData> {
BarChartRodStackItem(
value1 + value2,
value1 + value2 + value3,
const Color(0xFF3766E0),
),
BarChartRodStackItem(
value1 + value2 + value3,
value1 + value2 + value3 + value4,
Colors.white60,
),
],
......@@ -144,6 +151,7 @@ class _BarDataState extends State<BarData> {
e.value[0],
e.value[1],
e.value[2],
e.value[3],
),
).toList(),
),
......@@ -156,8 +164,9 @@ class _BarDataState extends State<BarData> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildLegendItem(Colors.white60, "Snow"),
_buildLegendItem(const Color(0xFF3766E0), "Slush ice"),
_buildLegendItem(const Color(0xFF000085), "Black ice"),
_buildLegendItem(const Color(0xFF13dbff), "Slush ice"),
_buildLegendItem(const Color(0xFF13dbff), "Steel ice"),
],
),
),
......
......@@ -60,7 +60,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
void handleSelection(int index) {
String indexString = index.toString();
setState(() {
// NB should be optimalised
// NB should be optimised
for (Measurement measurement in widget.markerList) {
for (SubDiv subdivision in measurement.subDivs) {
if (subdivision.sub_div_id == indexString) {
......@@ -283,8 +283,8 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
const SizedBox(width: 10),
Expanded(
child: Text(
'For every x of y, there has to be z cm of '
'q for every kg of applied weight to ensure ?',
'There may be multiple layers of black ice and slush ice stacked'
' between the snow and the steel ice.',
style: regTextStyle,
),
),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment