Sizing Marks on a Dashboard – datavis.blog
source link: https://datavis.blog/2021/07/31/sizing-marks-on-a-dashboard/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The problem
You’ve added a pie chart to a dashboard and need to resize the pie to fit a particular need – perhaps it’s floating over other elements or needs to fit into a certain space. Resizing the whole sheet is not always an option, so you switch back to the sheet and use the size slider. Unfortunately, you can’t see the changes in size in context with the other elements on your dashboard, which can lead to some back and forth to get to the right size.
For example, let’s say I want the pie chart in the below dashboard to sit on the floating pink bar for some reason. Here’s me trying to make that happen:
One solution is to add a parameter to the size shelf. Let’s walk through the process.
Create a Size Parameter
First, create a Range based parameter (Min: 0, Max:100) with a small Step size:
Add the Parameter to the Size Shelf
When you first place the parameter on the size shelf and change the value you’ll see the mark size doesn’t change:
Fix the Start and End values
To make this work you need to fix the start and end values from the size legend:
Why 400? Usually this can be set to 100, but for pie charts you want this to be 100 (the max size allowable for the parameter) multiplied by the number of segments in the pie chart, which is four in this case.
Now it works:
You can then add the chart to a dashboard, show the parameter and resize the pie chart as needed in context with all other elements on your dashboard.
Resizing Other Mark Types
This technique also works for bar widths, shape sizes and so on. Below is a dashboard with various mark types all being resized with one parameter. You could, of course, use separate parameters if needed:
Custom Calculation for Size
In the case of the shapes example above, the shapes are also being sized with a measure (sum of sales), so in this case a custom calculation is used in place of the parameter that normalises the sales value to a value between 0 and 1 and then multiples that by the parameter value:
I hope this is helpful for those custom sizing requirements.
Thanks for reading.
Marc Reid
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK