Infographic Design: One Message, Charts, HTML to Image
skillDesign a long-form infographic as HTML with inline SVG, accurate charts, sources and alt text, then render and check it. Use for infographic requests.
agents that use this skill
instructions
Overview
An infographic explains one difficult message with a few numbers, charts and pictures in a fixed order. This skill builds it as an HTML page with inline SVG and renders that page to an image with the html-render command. The deliverable is the HTML source, the rendered PNG, a text alternative, and sources and dates printed on the graphic. Every number on it was checked against the data, and the image was opened and looked at.
Mental model
- Check that an infographic is the right form. It suits an explanation that is hard to give in words, but a simple chart with explanatory text may be clearer and more accessible (UK Government Analysis Function).
- Remove every feature that is tangential to the story; showing too much data at once can show nothing (Wilke, telling a story).
- Drawing a number is an encoding: the number becomes a length, an area or a count of symbols. The encoding has to match the number, or the graphic states a different fact from the data.
- Text stays text. The PNG is an export; the HTML page is the master.
- A model cannot see its own output. Render, read the check output, open the image.
Rules
One message and a narrative order
- Write the message as one sentence that states the point, such as "City bike trips doubled in five years". A title states the point instead of describing the contents (Wilke).
- Order: title, the key number, supporting sections, then source and date. One point per section, one graphic per point.
- Cut what does not serve the message. Images that only adorn the graphic tend to distract; images that repeat to show quantity encode data (Wilke).
Honest encodings
| Encoding | Rule |
|---|---|
| Bars | Start at zero and never break the axis: bar length must be proportional. If differences look too small, switch to a dot plot, a line, or chart the differences |
| Lines | The axis may start above zero. Use a clear break symbol and break from a rounded number, such as 50% to 90% rather than 54.3% to 93.5% |
| Areas (circles, squares) | The area carries the value, not the height or width. For a circle, radius grows with the square root of the value. Show a few discrete sizes in the legend |
| Pictograms | One symbol stands for a fixed quantity, stated on the graphic. Show more by repeating the symbol, never by enlarging it: the first rule of Isotype, because a larger symbol leaves the reader unsure whether height or area is compared. Keep each symbol as simple as the fact allows |
| Pie | Five categories or fewer |
| Stacked bars | At most four categories in each stack; clustered bars at most four per cluster |
Shaded areas must be proportional to the values they show (the proportional ink principle). A bar that starts above zero, or a circle sized by radius, breaks it.
Chart rules
The chart rules an infographic needs:
- Form by task: bars to compare categories, a line for change over time, a pie only for a share of a whole at five categories or fewer.
- Label lines, stacks and pie sectors directly instead of using a key or legend; label every axis, series, sector and bar. Name the variable and its unit in axis titles.
- Gridlines: light grey, ten at most. Gap between bars narrower than a bar. Horizontal text only; a sans serif font. Thousands separated by commas.
- Colour: only as many colours as show a real difference, four series at most in a line chart, and never colour alone. Graphic parts need 3:1 contrast against what they touch, text 4.5:1. Measure against the colours the part actually touches.
- Use the same colour for the same thing everywhere on the graphic.
Hierarchy, grid and type
- Few text levels: title, key number, section headings, body. The key number is the largest thing on the graphic; the title second.
- One column, one margin on every side, one gap between sections. Align graphics to the same left edge.
- Avoid small font sizes on a long infographic (UK Government Analysis Function). Judge sizes by looking at the image at the size where it will be read, not at full width on a monitor.
- Load fonts from local files so the render does not depend on the network.
Real text and a text alternative
- Set all words as HTML text or SVG
<text>, never as pixels drawn by an image generator. Success criterion 1.4.5 asks for real text over images of text; logotypes are the exception. - The PNG turns text into pixels, so the page or SVG ships with it. Publish SVG for web use: it stays clear when zoomed (UK Government Analysis Function).
- Write two alternatives: a short one that identifies the graphic, and a long one with the essential information, placed in the page text next to the image. Put each chart in a
<figure>with a<figcaption>, or link a text-only description witharia-describedby. Give a data table or accessible spreadsheet when readers need values. - The description states what the reader should take from the graphic. It does not repeat the title, describe it literally or list every data point.
Sources and dates on the graphic
- Print the source on the graphic itself, since the image travels without its page: "[publication, survey or other source of data] from the [organisation]", specific rather than a homepage, with the time period of the data. Also put the source in the page text.
- Keep footnotes short and few. Mark illustrative data as illustrative on the graphic.
Sizes for web, print and social
Decide where the graphic is published before designing it, and test it on different devices and browsers. Websites, social media and print need different sizes.
- Social: take each size from the platform's own page and note the page and the date next to it. Sizes change; do not use remembered numbers.
- Print: take page size, bleed and resolution from the printer's specification.
- Web: a single column that fits the page, with the HTML version as the accessible one.
Build, render and check
- Put the data in a table first. Compute each mark from the data: bar height = value times a stated scale. Write the scale in a comment.
- Build one HTML file with colours in CSS custom properties, charts as inline SVG, and the whole graphic inside one
<main>element. - Render the wrapper at its own size, so a tall graphic needs no guessed page height:
html-render shot graphics-out/bikes/src/infographic.html -o graphics-out/bikes --size 900x900 --scale 1 --each main- Fix every ERROR (clipped or off-canvas text, broken image). Read every WARN and fix it or keep it on purpose.
- Open the PNG and look: hierarchy, balance, overlaps, text at reading size. The checks do not judge those.
- Verify numbers: every printed value matches the data table, and the ratio of two mark sizes matches the ratio of their values.
When the user cannot be asked, state the message and the audience you assumed.
Examples
Bars that lie. Bad: bars of height 90 and 180 for values 1.0 and 2.1: they show a ratio of 2.0. Good: height = value times 86, giving 86 and 181, and a check that 181 / 86 rounds to 2.1.
Clipped label. Bad: the label above the tallest bar sits outside the SVG viewBox; the check reports clipped-text and the image shows half a number. Good: widen the viewBox upward so the label sits inside, and render again until the check is clean.
Enlarged icons. Bad: one bike icon three times taller for three times the trips, which makes it nine times larger in area. Good: one icon for each 100,000 trips, three icons against one, with the key stated.
Output format
graphics-out/<slug>/src/ holds the HTML and its assets; the PNG sits in graphics-out/<slug>/; a short text file or the page itself carries the long description. Name the sources, the data dates and the size sources in the final message.
Checklist
- An infographic is the right form; the message is one sentence stating the point.
- Order is title, key number, sections, source and date.
- Bars start at zero; areas scale by area; pictograms repeat, not enlarge.
- Pie, stack and cluster limits are respected; colour is never the only cue; contrast is measured.
- All text is real text; a short and a long text alternative exist.
- Sources and dates are printed on the graphic.
- Sizes were looked up for each medium and noted with the date.
- Rendered with no ERROR, every WARN judged, the image opened and viewed at reading size.
- Every printed value and mark ratio was checked against the data.
Composition / References
Scope limits: single-slide social cards, ad creatives and carousels, charts alone, dashboards, slide decks, diagrams and logos are separate jobs.
- UK Government Analysis Function: https://analysisfunction.civilservice.gov.uk/policy-store/infographics/ , https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-charts/ , https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-colours-in-charts/
- Isotype Revisited: https://isotyperevisited.org/ ; the first rule of Isotype: https://en.wikipedia.org/wiki/Isotype_(picture_language)
- Wilke, Fundamentals of Data Visualization, 2019: https://clauswilke.com/dataviz/visualizing-amounts.html , https://clauswilke.com/dataviz/proportional-ink.html , https://clauswilke.com/dataviz/telling-a-story.html , https://clauswilke.com/dataviz/figure-titles-captions.html
- Datawrapper, bars start at zero: https://www.datawrapper.de/academy/why-our-column-and-bar-charts-start-at-zero
- Axis Maps, proportional symbols: https://www.axismaps.com/guide/proportional-symbols
- WCAG 1.4.5 images of text: https://www.w3.org/WAI/WCAG22/Understanding/images-of-text.html
- W3C, complex images: https://www.w3.org/WAI/tutorials/images/complex/