Two ways to highlight a line chart

by Simona Loffredo

During the makeover of my very first Tableau viz, I learnt two different ways to highlight something in a line chart:

  • The first one is using a reference band (very useful for selecting specific parts of the chart)
  • The second one is highlighting specific lines of the chart.

 

REFERENCE LINES

Suppose you want to highlight the area between 2005 and 2007 of the line chart below.

  • In the Analytics section, drag and drop “Reference Band” over the graph, selecting Year and Table as shown:

Reference band 1

  • A lightbox comes out, where you need to edit and define the characteristics of the reference band you want to create. After selecting “Band”, you need to set up the values band (from to) as “Constant” and the calendar

Reference band 2

Reference band 3

  • Then, if you do not want any labels to appear on the chart, make sure to select none for “Label” and don’t forget to specify the formatting of the reference band before clicking on the “OK” button.

Reference band 4

Voila’, your line chart with a reference band is done!

Reference band 5

 

HIGHLIGHTING LINES

Suppose you want to highlight the orange and green line.

Highlight lines 1

  • First of all, you need to create a “Calculated field”

Highlight lines 2

  • Write the following code, which will allow you to highlight and size the green and orange lines:

Highlight lines 3

  • Select the other regions:

Highlight lines 4

  • Right click and select “Group” to create a groupHighlight lines 5
  • To rename it, right click on the group and select “Rename”:Highlight lines 6
  • In order to resize the green and orange lines, drag and drop the calculated field called “Green and orange lines” to “Size” and then “Region” to “Detail”Highlight lines 7
  • Finally, it is only a matter of adjust the colors and the labels and that’s it, here the final graph is!

Highlight lines 8