Z-Order in Tableau
The z-order is the order of overlapping two-dimensional objects, for instance, circles plotted on high of one another in a scatter plot. In CSS, there’s a z-index setting that’s used to convey an object ahead or again inside a view, controlling which object is plotted on high. In Tableau, we do not explicitly outline a z-order in that method. As a substitute, the view is outlined by the marks which can be getting used. This may be complicated, and a few occasions irritating, when plotting marks on high of every. If a bigger mark is plotted on high of a smaller mark, then it turns into inconceivable to hover or choose the smaller mark. This impacts tooltips, hover actions, or deciding on a mark to focus on or filter. On this submit I’ll define learn how to management the z-order. Spoiler – its the tablet order on the Marks Card that controls the z-order. Listed below are three examples.
Marks Ordered by the Coloration Legend
Under is a scatter plot of Life Expectancy of a Feminine and Toddler Mortality utilizing the World Indicators information in Tableau. I’ve plotted this scatter plot utilizing Area (which is the continent) on colour. I set the opacity on the Coloration to 55% in order that bubbles on high of one another may be seen by way of some transparency of the colour. Discover that Asia is the second colour within the order of the legend. Discover that Area is the primary tablet within the Marks Card and set to Coloration, the order of the colour legend controls the z-order.
Which means circles representing Africa are on high of the circles representing Asia and so forth. Within the picture beneath you will note the massive circle representing China is on high of all the different Areas, besides the small blue dots for the African international locations.
You may management the order of the legend just by dragging a Area greater or decrease within the colour Legend (or manually sorting the Area on the Marks Card).
You may be questioning in regards to the different international locations in Asia, that are on the identical stage within the colour legend. To reply this, we will look at Thailand (in Asia) which is plotted beneath China. It’s because the following z-order after Area is about by the following tablet within the view, which is Nation, and based mostly on that order Thailand is beneath China within the checklist. Due to this fact China will plot on high of Thailand.
Marks Ordered by Nation Alphabetically
On this subsequent instance, I merely moved Nation from the underside of the Marks Card to the highest. Since Nations are ordered alphabetically and Nation is on the high of the Marks Card, the z-order is now set to Nations in alphabetical order. In different phrases, Afghanistan would be the mark plotted on high and Zimbabwe might be plotted on the underside.
Discover that Bulgaria (in Europe) and Brazil (in The Americas) are plotted on high of China, though Asia is above them within the colour legend. It’s because Tableau is utilizing the order of Nation names, the highest tablet on the Marks Card, and never the colour legend. Because the Russian Federation (in Europe) is beneath China within the checklist of nations, it is plotted behind China within the z-order.
Marks by Nation and Sorted by Inhabitants
We are able to management the sorting of the marks by sorting the tablet on the high of the Mark’s Card. For instance, if we wish all the smaller dots to be on high of the bigger dots in each case, then we will type the international locations by inhabitants. If we type by Inhabitants Complete ascending, then the smallest international locations by inhabitants might be on the high of the checklist and the most important international locations might be on the backside of the checklist, and the z-order will plot the smallest dots on high of the bigger ones.
Now we will hover over each dot within the view, as a result of the smaller dots are plotted on high of the bigger dots, whatever the nation or area.
Under is a Tableau Visualization showing the three examples side-by-side. Hover over the dots within the three examples to see the distinction based mostly on the tablet order and sorting on the Marks Card.