Toggle between map types in Wave dashboards
In Wave you can view your data on a world map; this is pretty cool if you want to see how your opportunities or cases are spreading across the world. However, it can quickly become be a lot of details if you work with opportunities or cases in the whole world. With a few tricks, you can allow your user to choose which map to view on the dashboard and thereby “zoom in” on certain areas using Wave’s different maps. This is done with a static step and modifications to your map widget.
First, we need to create our map. So create your lens and clip it to your new dashboard. In my example, the step behind my map has the measure as “Sum of Amount” and my grouping is “Billing Country”.
In the flex designer, drag your step to the canvas. In the widget section make sure to select the chart type “Maps”.
Now we need to create the static step. You can do this directly in the dashboard JSON or you can get a little help with step creator in the flex designer. The first step is to click on the “create step”.
Instead of choosing your dataset choose to create a static step.
Give your static step a name and enter the name of the map in the “display” and the “value” fields and click add. In this example, I am using “Europe” and “North America”.
New we need to portray the new static step on your dashboard. I have chosen the toggle widget.
With the static step added we now need to modify the dashboard JSON. To do this preview your dashboard and view the JSON by pressing command + e (for mac users) and control + e (for PC users).
Find your static step and modify it to look like this:
"StaticStepMapSelecto_1": { "type": "staticflex", "values": [ { "display": "Europe", "mapType": "Europe" }, { "display": "North America", "mapType": "North America" } ], "isFacet": false, "useGlobal": false, "isGlobal": false, "selectMode": "singlerequired", "label": "StaticStepMapSelector" },
Find your map widget and modify it to look like this:
"chart_1": { "type": "chart", "parameters": { "step": "StepTotalSalesCountr_1", "visualizationType": "choropleth", "title": { "label": "", "subtitleLabel": "", "align": "center" }, "theme": "light", "legend": { "show": true, "showHeader": true, "inside": false, "position": "right-top", "customSize": "auto" }, "trellis": { "enable": false, "type": "x", "chartsPerLine": 4 }, "exploreLink": true, "map": "{{coalesce(cell(StaticStepMapSelecto_1.selection, 0, "mapType"), cell(StaticStepMapSelecto_1.result, 0, "mapType")).asString()}}", "lowColor": "#C5DBF7", "highColor": "#1674D9", "binValues": false, "bins": { "breakpoints": { "low": 0, "high": 100 }, "bands": { "low": { "label": "", "color": "#B22222" }, "medium": { "label": "", "color": "#ffa500" }, "high": { "label": "", "color": "#008000" } } } } },
Go back to preview your dashboard. Now you can toggle between the maps on your dashboard.
Thank you so much for this. Would have been really stuck without it! Really appreciate all your detailed blog posts.
Rikke, this is good reading. I had to go back and forth looking looking for step but eventually found out it is a custom query with the new release.
I did a copy & paste of the last bold code, but it was throwing a JSON error. After some search, finally found this as the right syntax
“map”: “{{coalesce(cell(StaticStepMapSelecto_1.selection, 0, \”mapType\”), cell(StaticStepMapSelecto_1.result, 0, \”mapType\”)).asString()}}”,