Data series

How to organise and draw data series, from how many to show and how to colour them, to their fills, patterns, lines and markers.

Use these rules for any series drawn as a line, such as in a line chart or as the outline of an area, and for the markers on its points.

Line colours

For each series, use the border token of its assigned Extended palette as the line colour. See Colours for the palettes, their order and the token values.

Use a 2px stroke

Draw data lines with a 2px stroke. This is the line width MDS has designed for charts and recommends. Use it for every line, so thickness doesn’t suggest that one series matters more than another.

Do
Draw every data line with a 2px stroke.
Don't
Don’t draw lines at different thicknesses.

Use straight lines, not curves

Join data points with straight segments. A smoothed curve suggests values between the points that were never measured and can overshoot the real highs and lows.

Do
Connect measured values with straight lines.
Don't
Don’t smooth the line between measured values.

Use solid lines for measured data

Use solid lines for measured data and dashed lines for forecasts or projections. Keep both in the series colour.

Use neutral dashed lines for references, and shaded areas and labels for context, such as a target or a forecast period. See Annotations.

Do
Change to a dashed line in the same colour when the forecast begins.
Don't
Don’t continue the solid line into the forecast.

Break the line where data is missing

Leave a gap where there is no data. Don’t join across the gap or drop the line or area to zero, because both show values that were never measured.

Do
Leave a visible gap where a value is missing.
Don't
Don’t connect the values on either side of missing data.

Don’t use “Other” on line charts

Combining several series into an “Other” line can create a value that is difficult to interpret. Instead, keep the series separate, each in its own colour, or split them across charts.

Do
Keep separate trends as separate series, each in its own colour.
Don't
Don’t combine separate trends into an “Other” line.

Show markers when individual points matter

Use markers when there are relatively few data points or when people need to see where individual values were recorded.

Leave markers out when data is dense and the markers would touch or overlap and obscure the line. When markers are used, colour every marker the same as the line it represents.

Do
Leave markers out when the points are too dense to tell apart.
Don't
Don’t add a marker to every point in a dense series.

When a single series uses markers, use a filled circle. Use the charting library’s default marker size unless there is a reason to adjust it.

Use distinct marker shapes for multiple series

Markers are optional, but when several series use them, give each series a different shape. Shape gives people a second way to tell series apart, so colour isn’t the only cue. Use up to six shapes, in the order below. If more than six series are needed, reconsider how the data is presented (see Data series) rather than repeating marker shapes.

MDS does not provide marker shapes. If you use ECharts, use its built-in line markers in the order below. See the ECharts documentation on line series symbols. Chart.js also has built-in point styles, described in its point styling example.

Do
Use a different marker shape for each series.
Don't
Don’t use the same marker shape for every series.
Data seriesShapeECharts symbol
1stCirclecircle
2ndTriangletriangle
3rdSquarerect
4thDiamonddiamond
5thEmpty circleemptyCircle
6thRounded squareroundRect

This order prioritises visually distinct shapes and keeps similar shapes, such as circle and empty circle, apart.

See also