Sometimes you want to view the same data with 2 different charts. However this can take up a lot of space on the dashboard. One way to deal with this problem is using a parameter to give the user the ability to swap between charts. In this blog I’ll explain how to switch charts on a dashboard with a parameter.

The viz

For the viz we will use rainfall data from weather stations across Victoria. One chart will show a map that has a point for each weather station, sized and coloured by the average rainfall measured at this location. The other chart will be a bar chart that shows the top 10 weather stations by average rainfall detected. We need to layout the charts in a vertical or horizontal container and set them both to “fit: Entire view”

This allows us to view the data through different lenses, however in a large dashboard with lots of charts, the amount of space this takes up isn’t warranted given the amount of information being shown. So lets make a parameter that has a value for each chart.

Now we just need to filter out all of the data from a chart depending on the parameter, the easiest way to do this is with a conditional filter on station.

This expression returns true or false based on the parameter, meaning that it will either filter out all of the data or none of it. We need to do the same conditional filter on station for the bar chart except for the bar chart set the filter to “[Chart Type] = 2”.

Now the parameter allows the user to switch between charts depending on how they want to view it.