Chart Diagram

Starting with version 1.2026.0, PlantUML includes support for chart diagrams, enabling you to create several types of charts directly within your PlantUML documents. Supported chart types include bar charts, line charts, area charts, and scatter plots. The feature also offers advanced styling options, multiple axes, annotations, and full integration with the PlantUML style system.

This new functionality is made possible thanks to the excellent work of David Fyfe, whom we warmly thank for his contribution.

This document is an adapted copy of the original documentation available here.

[Ref. GH-2440]

Simple Example

A simple bar chart is created using the @startchart and @endchart keywords:

This will display a basic bar chart with quarterly data.

Bar Chart

Bar charts display data as vertical or horizontal bars. Use the bar keyword to create a bar series:

Grouped Bars

Multiple bar series are displayed side-by-side by default:

Stacked Bars

Bars can be stacked on top of each other:

Horizontal Bars

Bars can be oriented horizontally:

Line Chart

Line charts connect data points with lines. Use the line keyword:

Coordinate-Pair Notation

Line and scatter charts support an alternative coordinate-pair notation for plotting data at specific x-coordinates. This is useful for mathematical functions, irregular data points, or when you need precise control over point positioning.

Syntax: [(x1,y1), (x2,y2), (x3,y3), ...]

Requirements:

Example:

Behavior:

Area Chart

Area charts are similar to line charts but with filled regions:

Scatter Chart

Scatter plots display data as individual points with customizable marker shapes:

Available marker shapes:

Note: For scatter plots with custom marker shapes, use stereotype-based styling with the MarkerColor, MarkerShape, and MarkerSize properties in a style block. This provides the most reliable color and shape control

Axes Configuration

Horizontal Axis

The horizontal axis (x-axis) is configured using the h-axis keyword:

For numeric ranges:

Custom tick spacing:

Vertical Axis

The vertical axis (y-axis) is configured using the v-axis keyword:

Custom tick labels:

Custom tick spacing:

This displays tick marks at intervals of 25 (0, 25, 50, 75, 100) instead of the default 5 evenly-spaced ticks.

Negative axis values:

When the v-axis range includes zero, the horizontal axis is automatically positioned at the zero line, providing a clear visual separation between positive and negative values.

Secondary Y-Axis

A secondary v-axis (v2) can be added on the right side for dual-scale charts:

Use the v2 flag in series commands to bind them to the secondary axis.

Axis Label Positioning

By default, axis labels are positioned as follows:

You can override these positions using the label-top and label-right options:

V-Axis with label-top

Position the v-axis label horizontally at the top:

H-Axis with label-right

Position the h-axis label at the far right:

Combined Label Positioning

You can combine both options for a more compact layout:

Data Series Options

Series Name

Add a series name for display in the legend:

Colors

Specify colors using hex codes or color names:

Data Labels

Display values on data points using the labels keyword:

Layout Options

Legend

Display a legend showing all series:

Available positions:

Grid Lines

Display grid lines for better readability. Add the optional grid keyword at the end of any axis line to enable gridlines for that axis. By default, no grid lines are shown.

Grid on both axes:

Grid on vertical axis only:

Bar chart with v-axis grid:

The grid keyword can be added to:

Annotations

Add text annotations to highlight specific data points:

Annotations can include:

Styling

Inline Styling

Apply colors directly to series:

bar "Revenue" [45, 62, 58, 70] #3498db
line "Target" [50, 55, 60, 65] #e74c3c

Style Blocks

Use PlantUML's style system for comprehensive styling: