Skip to main content

Data visualisation

Choose chart colours from the data-visualization tokens, pick a step for each mark, and check contrast in light and dark.

Version: Beta

Charts need more colours than an interface does, and they use them for a different job. The data-visualization.* tokens are a separate group for that job: they help a reader tell series apart and read an amount from a colour. No EDS component binds them, and they are not meant for buttons, banners or other interface elements. Token names below use Figma's dotted form; Getting Started shows the CSS and TypeScript forms.

Place charts on background.surface. Every contrast figure on this page is measured against it, in both colour schemes.

Choose a group​

The kind of data decides the group:

DataGroupTokensExample
Categories with no order between themCategoricaldata-visualization.cat.1 to cat.10, each with steps 1 to 5Production per field, incidents per region
Ordered values that run from low to highSequentialdata-visualization.seq.1 to seq.7Utilisation in a heatmap, depth on a map
Values that run in two directions from a midpointDivergingdata-visualization.div.1 to div.9Above and below plan, change since last year

Use one group per chart. When a chart mixes groups, the reader has to guess whether a colour stands for a category or for an amount.

Categorical

Ten hues, five steps each. Use the hues to separate series; use the steps within one hue when a single series needs shading.

Sequential

For magnitude, where one end means more than the other.

Diverging

For values either side of a midpoint, such as above and below a target.

Categorical colours​

There are ten categorical hues, cat.1 to cat.10, with five steps each. Use the hues to tell series apart. Use the steps within one hue when a single series needs more than one shade, for example a forecast next to the measured values, or a selected bar among the others.

What the step numbers mean​

Compare the light and dark columns in the table below. In light, step 1 is a pale tint and step 5 is almost black. In dark it is the other way round: step 1 is a deep shade and step 5 is pale. In both schemes, step 1 is the quietest step, sitting closest to the colour of the page, and step 5 is the one that stands out most.

A step number therefore describes how strongly a colour stands out from the background. When this page says "use step 1 for a tint behind the plot area", you get a tint that stays in the background in both schemes, and "use step 5 for the one mark that must stand out" gives a mark that stands out in both.

StepLightDarkWhat it means in both
1Closest to the background. Barely stands out.
2Quiet.
3The base colour of each hue. The same in both schemes.
4Stronger.
5Furthest from the background. Stands out most.

Each cell shows the ten hues, cat.1 to cat.10, at that step, on the surface of its own colour scheme.

Step 3 is the base colour of each hue and looks the same in both schemes. The other steps swap places around it: the pale tint that is step 1 in light is step 5 in dark. The interface colours work the same way, as the palette explains.

Because step 3 looks the same in both schemes, it does not stand out equally in both. In row 3 of the table, the dark teal of cat.1 (the first swatch) is strong on the light surface and almost disappears on the dark one, and the yellow of cat.2 (the second swatch) does the opposite. Contrast lists the hues this affects.

Which step to use​

StepUse it forWhy
1Decorative areas that carry no meaning, such as a hover background or a tint behind the plot areaClosest to the background, and below 3:1 for every hue in both schemes
2Bands that carry meaning, such as a target range or an uncertainty band, always with a label; filled marks that should step back, such as the other bars when one is selected. Not for lines or pointsReaches 3:1 for only 2 of 10 hues in light and 4 of 10 in dark, so it needs a label
3The default colour for bars, areas and other filled marksThe anchor of the hue, the same in both schemes
4Lines, points and a series that should stand outReaches 3:1 for every hue in both schemes
5The one line or mark that has to stand out most, such as a target seriesFurthest from the background in both schemes. Not for several series at once: at step 5 most of the first five hues look alike

Where a hue is too weak in a scheme at the step it is used for, make its values available as text as well: direct labels, a tooltip or a data table. Contrast lists those hues.

Series order and how many series​

Assign hues in token order, starting at cat.1, and keep each series on the same hue when a filter changes what the chart shows.

Colour alone tells up to five series apart. cat.1 to cat.5 at step 3 stay distinguishable with normal colour vision and with the three common forms of colour blindness (protanopia, deuteranopia and tritanopia). Step 3 has the same values in both schemes, so this is true in light and dark.

From six series, add a second cue. Pairs start to look alike from the sixth hue: pink cat.4 and purple cat.6 are close even with full colour vision, and at seven and eight hues, cat.1 and cat.7 (dark teal and red) and cat.4 and cat.8 (pink and green-teal) merge for readers with red or green colour blindness. No set of eight hues can be told apart by colour alone. A chart with six or more series can still use all ten hues if each series also has one of these:

  • A direct label at the end of the line or on the bar, instead of only a legend
  • A marker shape or a line dash
  • A place in an "Other" group, for the smallest series

These results come from simulating colour blindness with the model by Machado, Oliveira and Fernandes (2009) and with the check in the EDS palette generator, and counting a pair as distinct only when it passes both.

Sequential and diverging colours​

Sequential and diverging ramps follow the same rule as the categorical steps: the distance from the background carries the meaning. In both schemes seq.1 sits closest to the background and stands for the lowest values, and seq.7 sits furthest from it and stands for the highest. In the diverging ramp the midpoint div.5 sits closest to the background and stands for no difference, and the two ends, the blue div.1 and the orange div.9, sit furthest from it.

These two ramps are generated separately for each scheme, so the dark values are not the light values in reverse order.

The low end of the sequential ramp and the middle of the diverging ramp are close to invisible on the surface, especially in dark, where seq.1 and div.4 to div.6 score APCA Lc 0. That is intended, because low values and values near the midpoint should recede in a heatmap or a map. The contrast goal for chart marks therefore does not apply to cells in a sequential or diverging fill. A reader still has to tell "low", "zero" and "no data" apart:

  • Give cells at the low end or the midpoint a thin border, so that their shape stays visible.
  • Show missing data with its own pattern or label, never with the low-end colour.
  • Make exact values available another way: labels, a tooltip or a table.

Light and dark​

Most data-visualisation values change between schemes: 56 of the 66 values are different, and only the categorical step 3 values stay the same. A chart keeps its meaning when the scheme changes, because each step keeps its position relative to the background, but it does not keep its exact colours. Check every chart in both schemes, and use the tokens rather than the hex values of one scheme.

Contrast​

Chart marks are graphical objects, so WCAG 2.1 asks for a contrast of at least 3:1 against the colours next to them when a reader needs the mark to understand the chart (success criterion 1.4.11). EDS designs for APCA and treats WCAG as the minimum, as it does for text (see the colour introduction). For chart marks:

MarkMinimumGoal
Bars, areas and other filled marksWCAG 3:1APCA Lc 30
Lines and small markersWCAG 3:1APCA Lc 45

Measured against background.surface:

Categorical stepLight: reaches 3:1Light: APCA LcDark: reaches 3:1Dark: APCA Lc
10 of 10 hues10 to 350 of 10 hues0 to 10
22 of 10 hues18 to 694 of 10 hues0 to 38
36 of 10 hues26 to 949 of 10 hues9 to 77
410 of 10 hues64 to 9910 of 10 hues33 to 86
510 of 10 hues93 to 10210 of 10 hues68 to 94

These hues miss the minimum or the goal at the step they are used for. Make their values available as text as well, with direct labels, a tooltip or a data table:

UseLightDark
Step 3 fills, below 3:1cat.2, cat.3, cat.8, cat.10cat.1
Step 3 fills, above 3:1 but below Lc 30nonecat.6 (Lc 22), cat.7 (Lc 20)
Step 4 lines, below Lc 45nonecat.1 (Lc 33), cat.7 (Lc 43)

In dark the two measures disagree more than in light. cat.7.3 reaches 3.13:1 but only Lc 20, so it passes the minimum while still looking faint on the dark surface.

Text in charts​

Use the text.* tokens for axis labels, data labels and legends. The data-visualization.* values are tuned for marks and do not reach the contrast text needs on every step. When a data label sits on a coloured bar, check its contrast against the bar rather than against the surface.

Colour is not the only cue​

Some readers cannot tell certain hues apart, and screenshots and printouts can lose colour. Pair colour with a second cue: direct labels, marker shapes, line dashes, or a table with the same data. The accessibility foundation covers the general rule.

Solid colours only​

Use the data-visualisation colours as they are, without opacity. A see-through mark has no fixed contrast, because its colour depends on whatever is behind it, so it cannot be checked against the goals above. The rest of the EDS colour scale follows the same rule. Instead of transparency:

  • For a target range or an uncertainty band, use step 2 of the same hue, drawn behind the data, with a label.
  • To fade the other bars or areas when one is selected, switch them to step 2. Lines are not faded: show or hide them instead.
  • For overlapping areas, use stacked areas, lines or small multiples.
  • For dense scatter plots, use smaller or hollow markers, or group the points into bins.

Examples​

The three charts below use only the tokens and rules on this page. The field names are Equinor production fields, but every number is random example data with no connection to the production of these fields. Switch the site between light and dark to see each chart in both schemes.

Several wells in one line chart​

Gas rate, water rate and cumulative gas for six wells in three fields. Select the wells to show with the checkboxes. Each measure has its own panel and its own scale, and the panels share one time axis. Putting the three measures on one plot would need three y-axes, and lines on different scales cannot be compared with each other.

Each well keeps its hue (cat.1 to cat.6, step 4) in every panel, and keeps it when wells are selected or cleared. Each well also has its own marker shape and a label at the end of its line. Up to five wells, colour alone tells them apart. Select the sixth, and the shapes and labels do that job. The end labels also cover cat.1 in dark, where its step 4 is below the goal for lines. Move the pointer over the chart, or focus it and use the arrow keys, to read all selected wells at one date.

Colour alone tells up to five wells apart. From six, the marker shapes and the labels at the end of each line tell them apart.

Gas rate (kSm³/d)060120Well 1Well 3Well 2Water rate (m³/d)03060Well 2Well 1Well 3Cumulative gas (GSm³)00.100.20Well 1Well 2Well 3200420052006200720082009

Random example data. The numbers have no connection to the production of these fields or any other.

Show the data as a table
Yearly values per well, random example data
YearWell 1 gas (kSm³/d)Well 1 water (m³/d)Well 1 cumulative gas, end of year (GSm³)Well 2 gas (kSm³/d)Well 2 water (m³/d)Well 2 cumulative gas, end of year (GSm³)Well 3 gas (kSm³/d)Well 3 water (m³/d)Well 3 cumulative gas, end of year (GSm³)Well 4 gas (kSm³/d)Well 4 water (m³/d)Well 4 cumulative gas, end of year (GSm³)Well 5 gas (kSm³/d)Well 5 water (m³/d)Well 5 cumulative gas, end of year (GSm³)Well 6 gas (kSm³/d)Well 6 water (m³/d)Well 6 cumulative gas, end of year (GSm³)
200491110.05373300.0615760.07042200.08034390.0921930.102
200588130.08470340.0865470.09043230.09628400.1021930.109
200683150.11469370.1114970.10838250.10928420.1131340.114
200780180.14363420.1344590.12434270.12223430.1211430.119
200880200.17262440.1564490.14031300.13321440.129950.122
200976210.19955490.17646110.15632340.14521450.136950.125

Production by field in a stacked bar chart​

Four fields per month, in step 3 with a 2px gap between the segments. Some of these hues are weak in one of the schemes (cat.2 and cat.3 in light, cat.1 in dark), so the tooltip and the data table give every value as text. Select a field to bring it forward, and the other fields fade to step 2. The plan line uses a text colour, because it is a reference and not data.

03507001,0501,400JanFebMarAprMayJunJulAugSepOctNovDecPlan 1,150

Random example data. The numbers have no connection to the production of these fields or any other.

Show the data as a table
Monthly production, random example data (kSm³/d)
MonthJohan SverdrupTrollOsebergGullfaksTotal
Jan5193502491511,269
Feb4933622311531,239
Mar5413522261561,275
Apr5043242121401,180
May4633161871281,094
Jun439259193107998
Jul185241165118709
Aug377232160116885
Sep383284170110947
Oct372259192121944
Nov4263181951241,063
Dec5033552241321,214

Share by field in a donut chart​

The same four fields, in the same hues as the bar chart. The slices run from the largest to the smallest, clockwise from the top, with a 2px gap between them, and each slice is labelled with its share. Use a donut only when the message is how one whole divides into a few parts, five at most. To compare amounts, a bar chart is easier to read.

41%28%19%12%1,068Total, kSm³/d

Random example data. The numbers have no connection to the production of these fields or any other.

Show the data as a table
Average production by field, random example data (kSm³/d)
FieldkSm³/dShare
Johan Sverdrup43441%
Troll30428%
Oseberg20019%
Gullfaks13012%

Do's and Don'ts​

Do
  • Choose the group from the data before choosing any colours.
  • Keep a series on the same hue when a filter changes the chart.
  • Add a second cue as soon as a chart has six or more series.
  • Check every chart in light and dark.
Don't
  • Use data-visualization.* for interface elements such as buttons, banners or status badges. Use the semantic tone tokens for those.
  • Use step 1 for anything that carries meaning, or step 1 or 2 for a line or a point.
  • Use data-visualization.* for text.
  • Make the colours see-through with opacity.

Where to go next​