Data + Science

[ad_1]


10/29/2018
Zoom In Tooltip in Tableau


In Tableau Tips Volume 13 (Tip #2) I showed a zoom in feature on a map. In that example I used a small map on a Dashboard canvas and set the tooltip using a larger map with labels. This creates a zoom feature on the map, keeping the map small on the dashboard, but zooming in on hover. In this example, I will show a zoom feature on a scatterplot to zoom in on dots that are very close to each other or on top of each other. This is done using Bins.

Step 1: Build a Scatter Plot

Using the World Indicators Data:

     Double-click Life Expectancy Female to move it to Rows.
     Double-click Birth Rate to move it to Columns.
     Right-click on Life Expectancy Female on the Rows, select “Measures (Sum)” and change it to Average.
     Right-click on Birth Rate on the Rows, select “Measures (Sum)” and change it to Average.
     Double-click Country to move it to Details on the Marks card.
     Move Region to Color on the Marks card.
     Move Year to Filters and select “Year”. Check “2012” to filter the data to 2012.
     Move Population Total to Size on the Marks card.
     Right-click on Population on the Marks Card, select “Measures (Sum)” and change it to Average.
     Using the dropdown box on the Marks card, select “Circles”.
     Select Size on the Marks card and adjust the size to make the circles larger.
     Select Color on the Marks card and set Opacity to 65%.
     Select Border and pick a medium gray color.
     Double-click the y-axis and select “Fixed” and set the “Fixed Start” to 40.
     Select the “Tick Marks” tab and select “Fixed” and set the fixed “Tick Interval” to 10.
     Double-click the x-axis and select “Fixed” and set the “Fixed Start” to .01.
     Select the “Tick Marks” tab and select “Fixed” and set the fixed “Tick Interval” to .01 (which is 1%).

You should now have a scatter plot similar to the image below.

Step 2: Build the Zoom Worksheet

     Right-click on the worksheet tab at the bottom and select “Duplicate”. This will make a second copy of the exact same worksheet.
     Right-click on the new worksheet tab at the bottom and select “Rename”. Rename the worksheet “Zoom”.

On the new Zoom worksheet:

     Double-click the y-axis and select “Automatic” and uncheck “Include Zero”.
     Double-click the x-axis and select “Automatic” and uncheck “Include Zero”.
     Set the Size on the Mark’s Card bigger.

Step 3: Create Two Bins


     Right-click on Life Expectancy Female in the Data pane, select “Create” and “Bins…”. Set the Bin Size to 10. Click OK.
     Right-click on Birth Rate in the Data pane, select “Create” and “Bins…”. Set the Bin Size to .01. Click OK.

Step 4: Build the Tooltip

On the original scatter plot worksheet:

     Drag Life Exectancy Female (Bin) to Details on the Marks Card.
     Drag Birth Rate (Bin) to Details on the Marks Card.
     Select Tooltip on the Marks Card.
     Add two line breaks at the bottom of the tooltip.
     Select “Insert” and “Sheets” and select the new “Zoom” worksheet. This will insert the Zoom sheet into the tooltip.
     Change the value of maxwidth and maxheight to 600 (or desired size).
     Erase &ltAll Fields&gt in the filter quotes.
     While inside the Filter quotes, click “Insert” and select Life Exectancy Female (Bin).
     Type a comma and then click “Insert” and select Birth Rate (Bin).

The new sheet added in the Tooltip should look like this:
&ltSheet name=”Zoom” maxwidth=”600″ maxheight=”600″ filter=”&ltLife Expectancy Female (bin)&gt,&ltBirth Rate (bin)&gt”&gt

The final result is a Tooltip with a zoom into a quadrant the size of each bin. Note – the bin size can also be controlled by a parameter, which would allow the user to control the zoom level.

Map Zoom Example


In this map example I bin the Latitude and Longitude (X & Y in this dataset) to achieve a map zoom from a density map, down to the points on the map inside a few blocks.

Tooltip:
&ltSheet name=”Zoom” maxwidth=”500″ maxheight=”500″ filter=”&ltX (bin)&gt,&ltY (bin)&gt”&gt

I hope you find this information useful. If you have any questions feel free to email me at Jeff@DataPlusScience.com

Jeffrey A. Shaffer

Follow on Twitter @HighVizAbility



Read More …

[ad_2]


Write a comment