XY charts in Confluence

An XY chart draws bars and lines on two axes, from numbers typed in the code.

Last updated

When to use it

Use an XY chart for a small set of numbers that belongs next to the text: a load test result, an error budget burn, revenue by month. The numbers live in the page, so a reviewer can read and correct them without opening a spreadsheet.

Example

This is the code of the Load test template: successful requests per second against p99 latency as load grows.

xychart-beta
  title "Load test: throughput vs latency"
  x-axis "Requests per second" [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
  y-axis "Requests / latency (ms)" 0 --> 1200
  bar "Successful requests" [100, 200, 300, 400, 500, 600, 700, 790, 850, 820]
  bar "Failed requests" [0, 0, 0, 0, 0, 0, 0, 10, 50, 180]
  line "p99 latency (ms)" [40, 42, 45, 50, 58, 70, 95, 180, 420, 1100]

Vellnar Diagrams draws it like this:

Change a line and the diagram changes with it. Nobody needs the original drawing file, because there is none: the code is the diagram.

Add it to a Confluence page

  1. Edit a Confluence page and type /mermaid where the diagram should go.
  2. Select Mermaid diagram. The editor opens with the template list.
  3. Pick a template, or choose Start blank and paste the code above. The preview follows every keystroke.
  4. Choose Save. The diagram appears on the page.

The documentation covers the editor, the settings and the exports.

Templates

The Templates button in the editor has 2 XY charts ready to use:

  • Load test: Successful requests per second against p99 latency as load grows.
  • Error budget: Actual error budget burn against the expected burn over a 30-day window.

Syntax

The code of a XY chart starts with xychart-beta. The Mermaid documentation describes every element of the syntax. Vellnar Diagrams draws it with Mermaid 12.3; if a line has an error, the editor marks the line and keeps the last valid diagram on screen.

More

  • Mermaid in Confluence: how diagrams as code work in a page, and every diagram type.
  • Security: the app asks for no permissions and sends nothing outside Atlassian.