cheatsheet / current

XY Chart

Use Mermaid xychart-beta to show line charts or bar charts with explicit axes.

XY Chart

Use Mermaid xychart-beta to show line charts or bar charts with explicit axes.

Basic template

xychart-beta
    title "Example"
    x-axis [Jan, Feb, Mar]
    y-axis "Value" 0 --> 10
    bar [3, 6, 4]

Core syntax

  • Start with xychart-beta
  • Add title
  • Define categories or x values with x-axis [...]
  • Define the y range with y-axis "Label" min --> max
  • Add one or more series with:
    • bar [values]
    • line [values]

Common example

xychart-beta
    title "Tickets Opened vs Closed"
    x-axis [Week 1, Week 2, Week 3, Week 4]
    y-axis "Count" 0 --> 30
    bar [18, 24, 20, 27]
    line [15, 21, 22, 26]

Good for

  • Trends over time
  • Side-by-side comparison
  • Simple operational metrics

Watch for

  • This is one of the clearest Mermaid options for actual numeric comparison
  • Make sure each series has the same number of values as the x-axis