I have a use case from a system used internally by HMPPS.
I got it working by introducing a few new classes
GOV.UK charts markdown allows content designers to create ‘simple’, ‘stacked’ and ‘compact’ bar charts which can also display negative values. You can combine these within one chart.
Users can then switch between the HTML bar chart and the table containing the data on the webpage.
I wondered whether the community could also consider the design and usability of GOV.UK charts in this forum. I know the limitations of GOV.UK charts markdown can cause publishers to rely on images of data, which is a backwards step. It makes sense for the design principles for data in services to feed into those for GOV.UK, and vice versa.
There isn't currently a lot of detail about the design of GOV.UK charts in the content design guidance, so thought I'd share a bit here.
Orientation of charts
Charts are primarily orientated vertically. My assumption is that this is so they can adapt well for narrow displays, such as mobile phones.
Categorical data that cannot be grouped
Charts use GOV.UK blue (#1d70b8) for categorical data that cannot be organised into broad groups.
Categorical data that can be grouped
GOV.UK charts use different colours when subcategories are common across broad categories.
Chart colour palette and order of appearance
GOV.UK charts apply colours automatically based on the number and order of the subcategories in the data table.
There are a maximum of 9 colours.
The text labels are either white or black – the text colour is whichever provides an acceptable contrast ratio with the background colour.
These colours are from the GOV.UK Design System.