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

update: add color value mapping

parent a1305843
No related branches found
No related tags found
1 merge request!10Clhp map
......@@ -66,7 +66,29 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
shapeDataField: 'sub_div_id',
dataCount: count,
primaryValueMapper: (int index) => subdivisions[index].sub_div_id,
shapeColorValueMapper: (int index) => subdivisions[index].color,
shapeColorValueMapper: (int index) => subdivisions[index].avgThickness,
shapeColorMappers: const [
MapColorMapper(
from: 0,
to: 4,
color: Color(0xFFff0000),
text: '{0},{25}'),
MapColorMapper(
from: 4,
to: 7,
color: Color(0xffff6a00),
text: '75'),
MapColorMapper(
from: 7,
to: 10,
color: Color(0xFFb1ff00),
text: '150'),
MapColorMapper(
from: 10,
to: 400,
color: Color(0xff4fa8d7),
text: '400'),
],
),
zoomPanBehavior: _zoomPanBehavior,
strokeColor: Colors.blue.shade50,
......@@ -75,12 +97,13 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
onSelectionChanged: (int index) {
setState(() {
selectedIndex = index;
for (int i = 0; i < subdivisions.length; i++) {
subdivisions[i].color = i == index ? Colors.red : subdivisions[i].savedColor;
}
});
widget.onSelectionChanged(selectedIndex);
},
selectionSettings: const MapSelectionSettings(
strokeWidth: 3.0, // Increase stroke width
color: Colors.black,
),
),
],
),
......
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