The plugin includes 2 different approaches to include an interactive legend.
- Using only one map and the legends can be for the different types of data entries
(markers, regions, vector icons, text labels);
- Using multiple overlaid maps where you can filter through the same type of data on different maps.
Using Overlay Maps
The process is not the most direct, but it shouldn’t be very complicated. The important things to consider:
- Each legend entry will correspond to a different map entry.
- There should be a ‘parent’ map and then all other maps should be added in the ‘Overlay’ section.
- For each individual map you can set the markers and regions to display or not in the legend.
- The colour in the legend will be the ‘default’ colour of the regions or markers.
- Clicking the legend entries will show/hide the entries from that map.
Consider for example that you want to have a map with markers divided by categories and have a clickable legend to show/hide those different groups of markers. You should have a map for each category and have the markers on the different maps. Then you should create a ‘parent’ map to display the entries from the different maps. Consider the following example:
In the example above we have a total of 3 maps. The base map and the map for ‘Cheese’ and ‘Wines’.
In the base map we have actually coloured some of the countries and enabled the legend in the ‘Map Features’ section of the map.
With this setup you’re able to filter through markers of the different maps, giving the illusion of one full map where markers from different categories can be shown/hidden.
Legend of a unique map
You can also enable the legend of a single map and choose to display coloured legend for the data in your map, divided by the different types:
- Round Coloured Markers
- Vector Icons
- Image Markers
- Text Labels
This approach is less versitile, since you can’t group markers or regions in different ‘categories’, you would be filtering them all together.
Remember to enable the ‘Show in Legend’ option
For each type of data (regions, markers, etc) you’ll need to enable the option ‘Show in Legend’ for them to display in the legend.
Here you can set the title for this data set in the legend also.
And then also enable the actual legend in the Map Features tab.