Cookies on ons.gov.uk

Cookies are small files stored on your device when you visit a website. We use some essential cookies to make this website work.

We would like to set additional cookies to remember your settings and understand how you use the site. This helps us to improve our services.

You have accepted all additional cookies. You have rejected all additional cookies. You can change your cookie preferences at any time.

Skip to main content

Chart elements

Overview

This page sets out styles for chart elements, including gridlines, legends, and annotations. It is important to stay consistent with these styles to maximise legibility of the charts and brand recognition.

Do not add any other chart decoration, such as borders or backgrounds, as these distract users from the data and message.

Gridlines

Most charts should include gridlines to help users read the data and understand the scale. Read more about how and when to use gridlines in our axes and gridlines guidance.

Gridlines should be placed behind other chart elements. Axis text styles can be found in the chart typography page.

Default styling of gridlines is shown in the following example line chart:

Line chart showing styling for horizontal gridlines, as outlined in the details table

Bar charts should include gridlines, even if the data are directly labelled on the bars, as shown in the following example:

Horizontal bar chart showing vertical gridlines styling, as outlined in the details table

Most charts do not need both vertical and horizontal gridlines. An exception to this is scatter plots.

For scatter plots, unless the axes total 100%, extend the lines beyond the grid at the top and right side, so the grid is not squared off, as shown in the following example:

Scatter plot showing vertical and horizontal gridlines styling, as outlined in the details table

As well as gridlines, dashed horizontal guidelines can be added for certain charts, such as dot plots. These help to visually connect the data to the label, as shown in the following example:

Dot plot showing vertical gridlines and horizontal dashed guidelines, as outlined in the details table

How to style and format gridlines

ItemStroke weight (pixels)Stroke styleColour nameColour values
Zero gridline1.5pxSolid line, square capGrey 40#B3B3B3
179, 179, 179
All other gridlines1pxSolid line, square capGrey 20#D9D9D9
217, 217, 217

Tick marks1

1pxSolid line, square capGrey 20#D9D9D9
217, 217, 217
Guidelines1pxDash 2px, gap 2px, square capGrey 20#D9D9D9
217, 217, 217


Notes

  1. Categorical axes should not have tick marks

Legend

Where possible, it is best to use direct labelling to indicate the categories, such as in line charts. However, for most charts this may not be practical, so we use a legend.

Legend text styles can be found in the chart typography page.

Legend position

The legend should be above the chart, aligned to the left-hand side of the chart area. It can extend to the right-hand side of the chart.

Legend labels should run along the same line (wrapping on to following lines, as needed) and not be stacked vertically. Text within each label should be kept on the same line – move the whole label to the next line if it does not fit.

Legend symbols

Circles and lines

Stacked column and line chart showing the legend styling with circle and line symbols
  • Circles are the default legend shape for fill colour, for example, bar charts, area charts, dot plots.
  • The circles should have a 12-pixel (px) diameter.
  • Lines are used for line charts, where these are not labelled directly.
  • The lines should be 20px wide, with a 3px stroke weight and rounded caps.

Squares

Line chart showing the legend styling for confidence interval ranges
  • Squares should only be used for a range, for example, the fill for a confidence interval.
  • They should be 12px square, using the colour #C6C6C6 (Grey 30).
  • The only other case is when using a square symbol in a scatter plot.

Other shapes (scatter plot)

Scatter plot showing the legend styling of four different category symbols
  • Where a scatter plot uses different data point symbols, these should be reflected in the legend, with similar sizing to the circles (squares may be smaller in width to account for optical difference).
  • The default order is circle, square, triangle, diamond.

Squared reference lines (discrete data)

Column chart with discrete reference lines showing the legend styling of the squared lines
  • Use squared lines for discrete data reference lines in column charts.
  • The squared lines should be 20px wide, with a 4px stroke width and squared caps.
  • The default colour is #222222 (Black).

Annotations

Annotations are used to point out relevant data points and add contextual information, such as significant events or date ranges. Read more about how and when to use gridlines in our annotations guidance.

Annotation text styles can be found in the chart typography page.

Most annotations are used with an arrow to a specific data point, but reference lines and ranges can also be used, as shown in the following line chart example:

Line chart showing three different annotations: one with curved arrows pointing to a specific data point, one with a highlighted range and one explaining a reference line

How to style and format annotations

ItemStroke weight (pixels)Stroke styleColour nameColour values

Arrow

1pxSolid curved line, open arrowheadGrey 100#414042
65, 64, 66
Reference line12pxDash 4px, gap 4px, square capGrey 40#B3B3B3
179, 179, 179
Range annotation (highlight area)2Not applicableNot applicableGrey 10#ECECEC
236, 236, 236


Notes

  1. Used to highlight a significant date or threshold.
  2. Used to highlight an extended period.

Help improve this page

Let us know how we could improve this page, or share your user research findings. Discuss this page on GitHub (opens in a new tab)