Skip to content

XYChart

XYChart

A Mermaid xyChart diagram builder with a matplotlib-style fluent API.

bar(x, height, color=None)

Add a vertical bar series.

barh(y, width, color=None)

Add a horizontal bar series.

line(x, y, color=None)

Add a line series. Numeric x values must be evenly spaced.

lineh(y, x, color=None)

Add a horizontal line series. Numeric y values must be evenly spaced.

render()

Render the chart as a Mermaid diagram string.

save(path)

Save the chart as a Markdown fenced code block to a file.

title(title)

Set the chart title.

xlabel(label)

Set the x-axis label (respects horizontal orientation).

xlim(min, max)

Set the x-axis range (respects horizontal orientation).

ylabel(label)

Set the y-axis label (respects horizontal orientation).

ylim(min, max)

Set the y-axis range (respects horizontal orientation).