Change the Map Type Based on a Toggle Widget

You can dynamically change the map type based on selections in a toggle widget. For example, you can create a toggle that switches between two different types of maps.

Let’s say you want to analyze your company's performance globally and in the United States. You add a toggle that switches from a world map by country to a country map by state. And you show the world map by default if no selection is made.

The Country and State toggle options allow you to change the map.

When you click State, the dashboard shows your results for each state.

The map of the United States shows because the State toggle option is selected.

The custom query (static_1) provides the "Country" and "State" values that appear in the toggle widget. The chart widget has a Map Type property so you can select the type of map to display. To dynamically set the map type based on a selection in the custom query (static_1), bind the Map Type property in the query (State__c_1) of the chart widget to the custom query (static_1). For more information about maps, see Map Charts.

Here’s the dashboard JSON. Focus on the values attribute of static_1, the groups attribute of the State__c_1 query, and the maps parameter of the chart_1 widget.