Last week a colleague asked me whether I had ever used dotted (or dashed) lines in tableau and how to create them. I realized that I never had and after a quick web search we both realized the functionality is not in tableau.
Or is it?
Despite the debate on the use of dotted lines in data visualization, it is apparent that there are at least some in the community who believe that dotted lines can be useful in presentations. I count myself among those.
Taking on the challenge to make the software do something it was not intended to do, I came up with this:
So, how to do it:
For my demonstration I created a fictional data set in a spreadsheet which shows actual and remaining projected performance against an original forecast.
With a little work I created some dummy data points and data gaps in between the “real” data points. The formulas below show the lookup of “real” data points and the creation of the dummy points and gaps which then trick Tableau into creating the dotted line chart.
Note the division in cell H3 which ensures the correct slope for each segment and a clean looking “line”.
Now, the issue I have with this solution is that it introduces data points into the series which do not really exist, but are necessary to construct the individual line segments. This is probably acceptable for the projection lines, but for the actual performance data I chose to use bars because those are all real data values.
Once I pasted the data into tableau and cleaned up the data types (I had to be sure the numbers were not considered string data) it was a simple matter to:
- Use the Date dimension for the columns and set to Exact Date
- Create a dual axis chart with actual performance on the left axis and the two projections on the right axis
- Synchronize the axes
- Set marks: bars for actuals and lines for the projections