For one of the recent Makeover Monday’s I created a dashboard that combined custom x, y coordinates with percent difference over time on Wine Production and Consumption since 2012 on 23 countries.
This dashboard has two parts. The first part will show a grape vine, the “grapes” represent the countries ranked from most production to least production (1 through 23), you will see how the rank of the selected country changes when a specific year from the “Select a Year” parameter is chosen. The country selected is highlighted in a grape purple color to give a better visual. Chris taught me how to plot custom x, y coordinates (which we will post a how to on a later post) and to better understand how parameters work.
The second part of this dashboard shows two line charts, the top shows the % difference of production and the one below shows the % difference of consumption (consumption data was taken from the “State of the vitiviniculture world market” pdf that was provided on the Makeover Monday site). Both charts and the grape vine work from the two parameter controls on the top of the dashboard (“Select a Year” and “Select a Country”). On both charts you will see that the selected country is highlighted (grape purple on production and grape green on consumption) and ‘world total’ is highlighted in black to give a visual reference of how the country did compared to ‘world total’. We saw the production chart on Andy Kriebel’s website. In his dashboard he tried to replicate the chart used for Workout Wednesday – Week 33. The main difference between my line chart and Andy’s is that instead of using it only for production of wine, I used it for both production and consumption. Refer to the following link here to see Andy Kriebel’s design.
Here is my finished viz.
Now, let’s see how this dashboard was created!
First, I started by setting up all the Calculations and Parameters needed. These need to have a specific order as some calculations contain other previous calculations within them.
Parameters:
I created a Parameter for Country named “Select a Country.” The Data Type needs to be a string, then click on List and Add from Field and select Country from the drop down. Once you get the list make sure you delete ‘World total’ from the bottom so you can have only the list of countries.
The second Parameter is “Select a Year” it follows the same principle as the Parameter above but instead you will choose Integer (because we’re working with whole numbers). Click on list and Add from Field, from the dropdown select ‘Year’ and then go on Display Format, choose Number (custom), make the decimal places 0 and uncheck “Include thousand separators”. This will give you the year on the proper format.
Now let’s start creating the calculated fields needed for this dashboard. We will have 12 calculated fields total.
- First, we need to calculate Past Value. This will help us get the % Difference needed for the dashboard.
- The next step is to calculate % Difference, this calculation will give you the % difference of the selected country compared to the previous year.
- The third calculation is Country Value. This calculation will give you the % difference of each country when selected with the Parameter.
- Size: This calculation is used in the line chart, it will size the Country at a 2, ‘World total’ at a 1 and everything else at 0. We’re using this to make the country selected pop on the chart.
Most of our Measures are done, we will leave the last one for last but now we can start setting up our Dimensions.
- % Difference Label, this calculation is if you want to get a little bit fancy and not use the title given on the axis. If you feel like going for it the calculation is very easy, it is just a concatenation.
- The next calculation is Country Selector
- Year Selector follows the same principle as the above.
- World Total Highlighter will be used to highlight ‘World total’ on our line charts.
- Country Label, to label the country on our dashboard.
- Rank Label, to label the rank on the top of our dashboard.
- Almost done, now we need to create World and Country Color.
- Lastly, we need to create the calculation for our Dot. This is the last measure.
Now that all the calculations have been created we can start setting our sheets up. First, we will create the background image, then we will create the line charts and finally we will put it all together in the dashboard.
To create the background image, you will need to first bring X to columns and Y to rows. You will also need to have the custom x, y coordinates already set up on your spreadsheet before bringing it into Tableau. – We will create another post on how to create custom x, y coordinates.
Go to Map, Background Image, then browse for your desired image a pop-up window will appear, the background images will be blank so you will have to click on “Add Image…”
Once you do that the following window will appear, here you will click on “Browse…” To bring in your desired image. Make sure that the fields are set up to X and Y, then on right and top put the proper numbers you set up on your spreadsheet, in this case we have Right(X) 500 and Top(Y) 250. then click apply and OK.
You also have to make sure that the X and Y axis are fixed from 0 to the numbers above as shown in the example below. If not, the image won’t show and won’t be able to fit properly
X Axis:
Y Axis:
After this is set up your background image should fit perfectly. Now we need to start bringing in the Measures and Dimensions to create the grapes. Make sure you bring in the calculations in the proper order, if not the grapes will look a little funny.
As you can see from the screenshot above, you will have to sort Country Selector. From the pill’s drop down select sort, go to manual and bring True to top. Follow the same steps to sort for Rank label, once you select manual, make sure you bring 2 to top, this will bring the country selected to the top of the chart. Lastly, click on the Rank pill’s drop down, select sort and check descending, this will bring the bigger grapes to the top to create the “grape” effect.
Once you have finished bringing the measures and dimensions start bringing in your filters. On Table, select all the ranks and exclude “null”. On year selector make sure you only bring in “True,” this will highlight the selected country. Lastly, on country, exclude ‘World total’. As you’re doing all this, bring in both Parameter controls by clicking on the pill’s drop down and select “Show parameter control.”
Once everything is set up you can start working on the aesthetics of the worksheet, you can choose the color you want for the grape that will be highlighted and for the ones that will not. This part is all up to you. Do not forget to work on your tooltip either, this is a very important part of the design, it will explain what you’re trying to show.
This is how I set the tooltip for this dashboard:
Overall, your worksheet should look like this:
Next, we will work on creating the two line charts for Production and Consumption.
First open a new sheet and bring Year to columns, Value Type to rows and % Difference to rows, you can bring in the label later as this is only for the title and doesn’t alter the graph in any way. One thing you should know is that more than likely production will be at the bottom, to bring it to the top just add the % Difference Label in front of Value Type, click on the pill’s dropdown and sort, select manual and bring % Difference of Production to the top, and click ok.
Now onto the fun stuff!!
NOTE: Do not worry about the Dot yet, we will include this last.
From the above screenshot you can see that you will have to bring Country to detail and to filters. On the filter, select all the countries except “null.” Then bring the Select a Year parameter to detail, Size to size, Value Type and World and Country Color to Color. For World and Country color you will have to sort, click on the pill’s drop down, select sort and go down to manual, bring True to top and World total in the middle. Lastly, bring country Label and Country Value to labels, this will give you the label at the end of the line on the chart.
At this stage you can also start working on the aesthetics of your chart, by choosing the colors of the lines, the proper size, etc.
Now onto the Dot. Bring the Dot pill to Rows at the very end as shown on the screenshot below
Make sure the Dot is on circle, from here you can also select your desired color for the Dot by clicking on color and your desired size by clicking on size.
Once you do that, your charts will look like this:
To correct it you will have to right click on the header, select “dual axis” and then “synchronize axis”. Then just hide the headers. After this is done, you will have the Dot on the zero line of the production and consumption line charts.
Overall, this worksheet should look like the one below or very similar to it.
Now don’t forget the tooltip! Again, you can set this up however you desire. This is how I created the tooltip for this dashboard:
The last thing to do is to create your dashboard, just click on “New Dashboard” and set it up the way you want!
This was the final product! Click here to see the interactive version on Tableau Public.
We hope you guys liked this little tutorial! If you have any questions, just let us know!
Surf On and Keep Vizzin’!
The Data Surfers.