How to add labels to the end of the lines? | Line and bump charts

The easiest way to add labels to the end of the lines on the line chart is through the marks card. Marks card is located below your filters shelf to the right of the data pane.

Location of the marks card
Marks card

To illustrate how to label lines with the marks card, I have created a simple graph below using the Global Superstore dataset:

A line graph without labels
A line graph without labels 

First, click on the Label icon under your marks card and tick Show Mark Labels. Then specify what kind of labels you want, in this instance, we choose Line Ends. You can also specify whether you want labels to appear at the start of the line, end of the line or both. For this example, I have chosen to label only the end of the line.

Tick show marks labels box and choose Line Ends option
Tick Show Mark Labels and choose the Line Ends option

After these steps, you should be able to see the labels next to the line ends as per the example below:

Line chart with labelled ends
Line chart with labelled ends

I also embolden the text and matched the colour of the label with the colour of the mark, which can be done under the font option in your Labels card.

You can also embolden your labels and math their colour to the line colours under the font option
You can embolden your labels and change colour under the font option

However

What if your chart is a dual-axis chart, with one of the axis already labelled? That is exactly the issue I have encountered during my second week of the Data School. I have created a bump chart that ranked markets by their profitability in 2013 and instead of displaying the colour legend, I wanted to display the name of the market next to each line.

The bump chart I have created during my second week of the Data School
The bump chart I have created during my second week of the Data School

However, when I tried following the previous process, the labels from one of the axis obstructed the labels from another.

Obstructed market labels on the end of the lines
Obstructed market labels on the end of the lines

Andy Kriebel showed me a useful trick on how to overcome this, which I want to share with you today. The first step was to extend the length of the axis and allow some breathing space for our labels. To do that, click on your date axis and choose Edit Axis.

Edit axis window
Edit Axis window

On the window that opens, change the Range option from Automatic to Fixed and increase the fixed end by a month (from 20/10/2013 to 20/11/2013).

Fix your axis and increase its length
Fix your axis and increase its length

Then in your marks card, go to the shelf you want to edit. In my case, it was SUM(Profit), because SUM(Profit) (2) had my labels for ranks (1,2,3 etc.). In your case the names might differ, therefore make sure you are on the correct shelf.

Make sure you pick the correct shelf
Make sure you pick the correct shelf

After this, hit the Label icon again and click on the three dots next to the Text option. On the window that opens, move your cursor to the beginning of the text and add some spaces, which will shift your labels to the right.

Add some additional spacing to your label text
Add some additional spacing to your label text

After this you should be able to see the desired result:

The bump chart with market labels on the end of the lines
The bump chart with market labels on the end of the lines

Please feel free to download my dataset here.

Author:
Marius Nikiforovas
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab