This is Part II of a two-part post. Part I talks about scraping data from SGDI while Part II outlines the process of presenting the data using Tableau.
Capabilities of Tableau:
- Including images within tooltip. i.e. when hovering/ clicking on a dot, the logo image of the organisation will appear.
We first set up the map with each dot representing an organisation after reading in the dataset. Contact details and addresses etc are included in the tooltip.
With the logo images that we have downloaded, we save it in a particular folder (called GovSG Logo, in this case) within the Shapes sub-folder of My Tableau Repository folder.
We drag the variable "Acronym" to Rows. Under Marks, choose Shape under dropdown and then drag Acronym to Shape (indicated by the arrow). By default, shapes like triangles/ circles/ squares etc. will be assigned.
To change to what you see above, click on Shape (indicated by the arrow above), and click Reload Shape in the pop-up, then select the folder where you saved the images. Some manual effort here in assigning the images to the corresponding organisation because of the different file types. If they are the same type, clicking Assign Palette will do the job as the names of the images are in alphabetical order following the sequence of the data item.
Then go back to the Worksheet containing the map, and click on Tooltip to insert the logo. What you will see is the first line within the tooltip box (that was previously not there).
- Dashboard actions to send email or go to a website (based on a url).
To do that, we create the dashboard first.
In total, we have to create three types of actions.
For all three, we click on Add Action > URL.... We do each action separately, so three times in total.
Under URL, to email, we have to include mailto:. The variable to be included can be selected by clicking on the arrow beside the box under URL.
For Enquiry/ Feedback Form as well as website, no additional text needs to be added. Indicating the variable itself under URL will suffice.
The code for scraping the data (and automating the downloading of images) can be found here.
The dataset GovSG.csv can be found here.
The visualization on the one-stop guide to Government agencies in Singapore can be found here.