For this week’s #WOW2021 challenge, Lorna tasked us with using dashboard extensions, some of which can also be used on Tableau Public (see here). I haven’t had an opportunity to use extensions before, so this was going to be a brand new learning experience for me.
Modelling the Data
In a break from the ‘norm’ Lorna provided us with a new set of data to use, which had to be retrieved from the sources Lorna provided in the challenge
- Emoji Sentiment – a csv file containing a summary of how often a particular emoji was used within tweets in 2015 and whether the tweets were classified as being positive, neutral, or negative in sentiment.
- Emoji Database – a link to a site where after registering, you can download a csv file which defines and classifies each emoji
The first part of the challenge requires these data sources to be modelled using relationships in Tableau Desktop. Lorna hinted that a join calculation would be required on the codepoint fields.
I found this a bit odd, as both data sources contained an Emoji field which was automatically set to be the relationship field, and seemed to work.
For the purpose of this blog though, I’m going to attempt to rebuild my solution as I type, and use the suggested fields. The Unicode codepoint field in the Emoji Sentiment data needs to map to the codepoint field in the Emoji Database, but they’re not an exact match. We can prefix ‘0x’ to the codepoint field and ensure the case of the letters match. We can use a relationship calculation for this.
Grouping the Groups
This chart shows the top 20 emojis based on Occurrences and should filter to the appropriate group when a ‘category’ is clicked on the dashboard extension image on the left hand side.
The Emjoi Database data has a Group field, but this doesn’t exactly match the groupings on the image – some groups are ‘grouped’ together. I used Tableau’s in built grouping functionality to group the entries as required (right click field -> create -> group).
I grouped People & Body and Smileys & Emotion together and named them Smileys and People
Filtering by Top 20
The list of Emojis needs to show the Top 20 based on Occurrences, but also filtered by Category. Build out a basic table of
- Emoji Sentiment : Emoji1, Unicode name on Rows
- Occurrences on Text
- Emoji1 on Filter, set to filter by Top 20 of Occurrences
- Category as a Context Filter – select all values to filter by, then right click -> add to context. This means the data will be filtered based on the Category first before the Top 20 filter is applied. The pill will change to grey to show it is a context filter. Show the filter and you can test it’s working
Building out the Top 20 Chart
Now we have the basics of the filtering functionality, we can build out the rest of the chart.
We need to display percentages, so need fields
formatted to 1 decimal place. Create similar fields for % Negative and % Neutral
First start by creating a duplicate of the Occurrences field and call it #. Then add this as a discrete pill to the Rows shelf. Remove Occurrences from the Text shelf. Then add Measure Values to Columns and filter by Measure Names so only % Positive, % Neutral and % Negative measures are displayed. Add Measure Names to Colour.
All this has been done on one axis, so now we can add another to display the Position – add this field to Columns. This will create a 2nd marks card. Remove the Measure Names fields from the card, and change the mark type to circle.
Add an additional field MIN(1) to Columns by ‘typing in’ (double click on the Columns area) . Then click on the pill and select dual axis which will combine this field with the Position measure. Synchronise axis. This unfortunately will probably set all the marks to be circle type
so we need to reset…
- change the mark type of the Measure Values card to bar
- remove Measure Names from the Position card
- remove Measure Names from the MIIN(1) card
- change mark type of MIN(1) card to bar, and reduce size to as small as possible
This should give you the core chart, which can now be formatted accordingly.
Rounded Bar Chart
I always forget how to build these for some reason, so a quick google gave me a refresher via Andy Kriebel’s tutorial on YouTube
- Add Category to Rows
- Occurrences to Columns
- Type in MIN(0) on Columns
- Drag the MIN(0) pill and drop it on the Occurrences axis. This will change the view so Measure Values is now on Columns and Measure Names is on Rows
- Change the mark type to Line and drag the Measure Names pill from the Rows onto the Path shelf
- Increase the size of the mark
Exclude the Null Category and manually sort the categories to match the order in which the entries are listed on the left hand image.
Set to show mark labels, only displaying them at the end of the line, and aligning middle right
Add Category to the Colour shelf and colour accordingly, then apply the relevant formatting again to remove gridlines, axis and hide the Category pill from displaying.
Adding & Configuring the Dashboard Extension
This challenge makes use of the Image Map Filter extension, which you need to download from this link and save the .trex file somewhere appropriate on you machine. I also chose to make use of the image Lorna used rather than create anything, so saved the image from the challenge page to my laptop.
Create a dashboard and add the 2 charts you’ve already built, then add the Extension object to the dashboard. When prompted select My Extensions and browse to the Image Map Filter .trex file you’ve saved.
You’ll then be prompted to configure the extension as below, selecting the image you’ve saved, which is set to scale to container; choosing the Category dimension which is what the chart is filtered by, and then selecting the Top 20 sheet
You then need to select the rectangle option, which allows you to ‘draw’ on the image
Create a rectangle around one of the options, and when prompted select the appropriate Category which the selection relates to.
Repeat this for all the options in the image.
To build this I simply duplicated the Top 20 chart, removed all the pills from the Rows shelf, removed the Emoji pill from the Filter shelf and then changed the aggregation of the Position pill from SUM to AVG. I had to re-tweak the tooltips too.
And after all that, I hope you have all the components you need to deliver this solution. My published viz is here.
Happy Vizzin’! Stay Safe!