Skip to content

Quadrant charts

A quadrantChart splits a square into four labelled quadrants and places points by two coordinates from 0 to 1. This chart renders through the CLI, WASM, Markdown and Astro integrations:

Reach and engagement of campaigns Quadrant chart. 5 points. Reach and engagement of campaigns x-axis: Low reach → High reach y-axis: Low engagement → High engagement Quadrant 1, top right: Expand Quadrant 2, top left: Promote Quadrant 3, bottom left: Re-evaluate Quadrant 4, bottom right: Improve Spring launch: x 0.3, y 0.6, quadrant 2 (Promote) Partner webinar: x 0.45, y 0.23, quadrant 3 (Re-evaluate) Referral program: x 0.57, y 0.69, quadrant 1 (Expand) Trade show: x 0.78, y 0.34, quadrant 4 (Improve) Newsletter: x 0.4, y 0.34, quadrant 3 (Re-evaluate) Expand Promote Re-evaluate Improve Newsletter: x 0.4, y 0.34Newsletter Trade show: x 0.78, y 0.34Trade show Referral program: x 0.57, y 0.69Referral program Partner webinar: x 0.45, y 0.23Partner webinar Spring launch: x 0.3, y 0.6Spring launch Low reach High reach Low engagement High engagement Reach and engagement of campaigns
Reach and engagement of campaigns
Diagram source
quadrantChart
title Reach and engagement of campaigns
x-axis Low reach --> High reach
y-axis Low engagement --> High engagement
quadrant-1 Expand
quadrant-2 Promote
quadrant-3 Re-evaluate
quadrant-4 Improve
Spring launch: [0.3, 0.6]
Partner webinar: [0.45, 0.23]
Referral program: [0.57, 0.69]
Trade show: [0.78, 0.34]
Newsletter: [0.4, 0.34]
Statement Draws
title <text> A title above the chart
x-axis <left> --> <right> Labels at the two ends of the x-axis; x-axis <left> labels the left end alone, and x-axis <left> --> adds an arrow
y-axis <bottom> --> <top> The same for the y-axis, bottom first
quadrant-1 <text> … quadrant-4 <text> Quadrant labels: 1 top right, 2 top left, 3 bottom left, 4 bottom right
<name>: [x, y] A point; x runs left to right and y bottom to top, each from 0 to 1
<name>:::<class>: [x, y] A point with a class
classDef <class> <styles> Point styles shared by a class

Keywords match in any case. A text in double quotes may hold :, --> and brackets. Statements end at a line break or at ;. Mermaid moves the x-axis labels below the chart, and the quadrant labels to the top of their quadrants, whenever the chart has points; Merlion places them the same way.

A coordinate outside 0–1 fails with E024 at its position. A coordinate in range that mermaid’s lexer cannot read, such as 1.0 or .5, is rewritten to 1 or 0.5 with the R021 repair, so merlion check --fix makes the source portable. Any other statement fails with E002, naming the statements the parser expected.

A point takes radius, color, stroke-color and stroke-width after its coordinates, or from its class. A point’s own style wins over its class’s style, which wins over the theme:

Quadrant chart Quadrant chart. 5 points. x-axis: Spend → y-axis: Delivery risk → Quadrant 1, top right: Review now Quadrant 2, top left: Monitor Quadrant 3, bottom left: Routine Quadrant 4, bottom right: Negotiate Northwind: x 0.82, y 0.86, quadrant 1 (Review now) Contoso: x 0.66, y 0.58, quadrant 1 (Review now) Fabrikam: x 0.24, y 0.31, quadrant 3 (Routine) Litware: x 0.51, y 0.12, quadrant 4 (Negotiate) Tailspin: x 0.12, y 0.72, quadrant 2 (Monitor) Review now Monitor Routine Negotiate Tailspin: x 0.12, y 0.72Tailspin Litware: x 0.51, y 0.12Litware Fabrikam: x 0.24, y 0.31Fabrikam Contoso: x 0.66, y 0.58Contoso Northwind: x 0.82, y 0.86Northwind Spend → Delivery risk →
Diagram source
quadrantChart
x-axis Spend -->
y-axis Delivery risk -->
quadrant-1 Review now
quadrant-2 Monitor
quadrant-3 Routine
quadrant-4 Negotiate
Northwind:::danger: [0.82, 0.86]
Contoso:::warn: [0.66, 0.58] radius: 8
Fabrikam: [0.24, 0.31]
Litware:::key: [0.51, 0.12]
Tailspin: [0.12, 0.72] color: #127a84, stroke-color: #0b4f55, stroke-width: 2px
classDef key color: #6f5bd6, radius: 9

A class that no classDef declares is a role. The tone roles accent, ok, warn, danger, muted and store colour a point with their theme tone, and a stylesheet can tone any other role, as on a flowchart node (Roles and stylesheets). A classDef colour reads --merlion-c-{class}-fill and --merlion-c-{class}-stroke, so a page can re-theme the class. A style outside the four properties or their values is dropped with W010.

config.quadrantChart sets the chart’s width and height (500 × 500 by default), paddings, font sizes, border widths, the default point radius, and the axis positions xAxisPosition (top, bottom) and yAxisPosition (left, right). A container narrower than the chart narrows it. The quadrant colours of themeVariables (quadrant1Fill, quadrantPointFill and the rest) are fixed colours that override the theme, reported with I030; other theme variables are ignored, because Merlion themes are CSS.

With no configuration, the quadrants are the accent mixed into the background at four strengths, the points take the accent, and the text and borders take the foreground and border tokens. Light, dark and named themes restyle the chart through CSS alone (Theming).

Each point is a group carrying data-merlion-id (its name), data-merlion-x and data-merlion-y, with a <title> tooltip. The SVG’s text alternative lists the axes, the quadrant labels and every point with its coordinates and quadrant. The Markdown plugin uses accTitle, then the chart title, then a front-matter title for its caption.

The quadrant chart contract records the layout, the SVG classes and where the output differs from mermaid’s. Mermaid’s language reference is the official quadrant chart documentation.