Skip to main content

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:

 

Dashed Lines in tableau

 

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.

 

excel.jpg

 

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

 

Tableau+Snip+01.JPG.jpg

 

  • - Format as desired

 

That’s all there is to it.

4 Antworten
  1. 30. Sept. 2013, 13:53

    I suppose the use of bars was a bit of personal preference on my part as well as not wanting to put interpolated data points into fields representing "actual" data.  Also, using the dashed line solution for the actuals would be less than attractive because of the fixed x-axis start/stop positions you mention.  I started down the road of figuring out a way around this (probably some convoluted use of the Pythagorean theorem to get all the hypotenuses the same length), but it got pretty messy pretty quickly and I decided this part would be a project for an evening (on my own time).

0/9000