Grouped Countries Map
Sometimes you need to group countries on a map based on some criteria. In the most simple case you can just set the same fill color for countries in a group. But in this demo we go a step further and make all countries in a group react to pointer events jointly and also create a legend that switches the whole group off and back on.
Key implementation details
We create a separate MapPolygonSeries
for each country group on the map. For each pointerover
and pointerout
event on an individual country, we switch the state
on all countries in the group. Finally, we add our map polygon series as data items of the Legend
.