Creating a visualization
Now, let's explore the basics of creating a visualization using an exercise:
- 1. Navigate to https://public.tableau.com/profile/marleen.meier to locate and download the workbook associated with this chapter.
- 2. Open the file by double-clicking on the downloaded workbook.
- 3. In the workbook, find and select the tab labeled Fundamentals of Visualizations
- Drag Sport to Color on the Marks card
==>Add all members - Click on Color on the Marks card and then on Edit Colors… to adjust the colors of your visualization as desired. This will allow you to edit the colors used in your visualization, and Transparency and Border effects:
- Now see what happens if you move Sport to
- the Size,
- Label,
- Detail,
- Columns,
- and Rows shelves. After placing Sport on each shelf, you can click on each shelf individually to access additional options.
- Drop other fields on various shelves to continue exploring Tableau's behavior.
One example could be, on an empty canvas,
dragging Year to the Columns shelf (dimension),
Number of Records to the Rows shelf(continuous), and
Medal to Color on the Marks card.
You will now see the number of medals per medal type over time:
As you explore Tableau's behavior by dragging and dropping different fields onto different shelves, you'll notice that Tableau responds with default behaviors. These defaults, however, can be overridden, which we'll explore next.
Beyond the default behavior
In the preceding exercise, Creating a visualization, we can notice that the Marks card reads Automatic. This means that Tableau is providing the default view. The default view can be easily overridden by choosing a different selection from the drop-down menu:
Now, let's walk through an exercise where we'll override another default behavior on the Marks card:
Sorting and nested sorting
When the values to be sorted occur in multiple panes, there are two ways to sort: nested and non-nested (or comparative).
- A non-nested sort considers the value across panes and will have the same order of values per pane.
==> - A nested sort considers each pane independently and sorts the rows per pane.
==>
##########################
Animated demo: countries are sorted by the number of medals won in each Olympic Games (from 1976 to 2018) and only the top 5 are displayed
Countries are ranked by the number of medals won in each category (from 1976 to 2018)-view
-
Drag the Year to the Rows Shelf,
convert it to discrete :
- Drag the Metal and place it on the Rows Shelf,
Drag the Country and place it on the Rows Shelf,
Drag the Number of the Records and place it on the Rows Shelf,
Drag the Number of the Records and place it on the Label Shelf of the Marks,
Drag the Country and place it on the Color Shelf of the Marks - manually sort the Metal by the sequence [Gold, Silver, Bronze]
- nested sort the Country by the Field Number of Records, Descending and Aggregation function is Sum
- Create a Calculated field named Index(Convert it to discrete since I gonna to slice the view)
==>INDEX()
- Drag Index to the left of Country on the Rows shelf,
Then Add a Table calculation, - Press Ctrl key and drag Index from rows shelf to Filters shelf
Just click ok, then Convert it to Continues, then Show Filters
- Edit Title...==>
view
Animated demo (convert the view to animation, date as page)
- Drag the Year to Pages Shelf for grouping the data by year
- Drag the Medal and place it to the Rows shelf, manuall sort it by the sequence [Gold, Silver, Bronze]
- Drag the Number of the Records and place it on the Rows Shelf,
- Drag the Country to the Color Shelf
Drag the Country to the Label Shelf
Note : one the these step should be done ahead of the folowing step, since we need to use it for Table Calculation##########( similar to create a calculation field name RankRANK_UNIQUE( SUM( //Include [Year],[Medal],[Country] {INCLUDE [Country]: SUM([Number of Records])} ) ,'desc' )
Convert Rank to the discrete, then Compute Using Country,
Then press ctrl key then drag Rank to the Filters shelf, convert it to Continues
done!)########## - (If you not familar to the code), then Drag the Number of the Records and place it on Column Shelf, Convert it to discrete
Then Add Table Calculation...
Then press ctrl key then drag SUM(Number of Records) from Rows shelf to the Filters shelf,
click ok and convert it to Continues
Edit this filter Title, then making some adjustments
==>
##########################
Navigate to the Nested Sorting tab and try to sort the countries by the amount of medals won but separately for gold, silver, and bronze.
Building Dashboard
Count of Disciplines科目
- 1. Background Color
- Drag the Number of Records to the Columns shelf
Then remove the Axis Title(Number of Records)
Drag the Year to the Rows shelf(Dimension, discrete) and Filters shelf
Then Hide Filters labels for rows
Bar char, then Click Color - right Click Number of Records, then format...
right Click Year, then format...,
==>
==> - Edit title
Attendees
set background color
andthen Remove Axis Title for both Year and Sum(Number of Recorders)
Medals
Medal Shapes
Building a dashboard
The following are the steps for building a dashboard:
- 1. In the workbook for this chapter, navigate to the Building a Dashboard tab.
- 2. In the Dashboard pane, located on the left side of the Figure 1.15, double-click on each of the following worksheets (in the order in which they are listed) to add them to the dashboard pane: Count of Disciplines, Attendees, Medals, and Medal Shapes: Figure 1.15: Creating a dashboard
- 3. In the bottom-right corner of the dashboard, click in the blank area (indicated by an arrow in Figure 1.16) to select a container. Containers are a selection of sheets that auto-adjust to fit next to/underneath each other on your dashboard:Figure 1.16: Deleting a container
- 4. After clicking in the blank area, you should see a blue border around the filter and the legends. This indicates that the vertical container is selected. Select the vertical container handle and delete it(right click the blank area and select to remove from dashboard).
- 5. A selected container can also be dragged to a different location on the dashboard, replacing an existing sheet or sharing space. Note the gray shading in Figure 1.17, which communicates where the selection will be placed.
Drag the Attendees worksheet by selecting and holding the handle and put it on top of the Count of Disciplines worksheet in order to swap the two:Figure 1.17: Moving worksheets - 6. Note the Floating and Tiled buttons at the bottom left, next to your dashboard, as well as under the handle dropdown.
If you select Floating instead of Tiled, your worksheets will not auto-adjust anymore and will be "floating" around the dashboard instead. This is a free form of worksheet arrangement on a dashboard, which is a powerful functionality, especially combined with transparent backgrounds. Note that floating can also be achieved by selecting it from the More Options dropdown on the right-hand side of every sheet in the dashboard: - 7. Now, you can format the dashboard as desired. The following tips may prove helpful:
- • Adjust the sizes of the elements on the screen by hovering over the edges between each element and then clicking and dragging. Drag the edges of containers to adjust the size of each worksheet.
- • Make an element floating, as shown in Figure 1.18.
- • Create horizontal and vertical containers by dragging Horizontal and Vertical from the Objects pane onto the dashboard. Other objects, such as Text, Image, and Blank, can be added to containers too.
- • Display the dashboard title by selecting Dashboard in the top pane, then Show Title. Double-click the title itself to adjust:
As you can see, you have just created your first dashboard. All worksheets are in place now. In the next part, we will add filter functionality to make the dashboard more interactive and meaningful.
Adding interactivity to a dashboard
One of the primary benefits of Tableau is the interactivity it provides the end user. Dashboards aren't simply for viewing; they're meant for interaction. In this exercise, we'll add interactivity to the dashboard that was created in the previous exercise:
- Select the Medals sheet on the dashboard and click on the drop-down arrow on the right-hand side, which will open a menu as shown in Figure 1.20. From there, select Filters, then Sport:
Figure 1.20: Adding a filter - Now select the newly created filter, Sport, click again on the drop-down options arrow, and select Multiple Values (dropdown) as well as Apply to Worksheets | All Using This Data Source, as shown in Figure 1.21:
- Lastly, place the filter above the Medals sheet by clicking and dragging it.
- To use the images of the medals as a filter for the other worksheets on the dashboard pane, click the Use as Filter icon located at the top-right corner of the Medals Shapes worksheet:
Figure 1.22: The Use as Filter option - Alternatively, navigate to Dashboard | Actions. In the dialog box, click Add Action | Filter and create a filter, as shown:
-