MermaidChart Class
A chart of Mermaid: a pie chart, an XY chart, a quadrant chart, a sankey chart, a treemap or a radar chart. It keeps what the Mermaid text says, so MermaidWriter writes it back, and draws it with a Plot of Meziantou.Framework.Charts, which MermaidChart.ToPlot returns to customize the drawing.
public abstract class MermaidChart : ISceneSource- Implements
Properties
| Name | Description |
|---|---|
| AccessibleTitle | Gets or sets the accessible name of the chart when it differs from MermaidChart.Title, which is not drawn (Mermaid accTitle). |
| Description | Gets or sets the description of the chart for assistive technologies (Mermaid accDescr), which is not drawn. |
| TextMeasurer | Gets or sets the measurer of the texts, or null for AfmTextMeasurer.Default. |
| Theme | Gets or sets the theme of Mermaid whose colors and font the chart uses. The default is DiagramTheme.Default. |
| Title | Gets or sets the title, drawn above the chart. |
AccessibleTitle
MermaidChart.csGets or sets the accessible name of the chart when it differs from MermaidChart.Title, which is not drawn (Mermaid accTitle).
public string? AccessibleTitle { get; set; }Property value
Description
MermaidChart.csTextMeasurer
MermaidChart.csGets or sets the measurer of the texts, or null for AfmTextMeasurer.Default.
public ITextMeasurer? TextMeasurer { get; set; }Property value
Theme
MermaidChart.csGets or sets the theme of Mermaid whose colors and font the chart uses. The default is DiagramTheme.Default.
public DiagramTheme Theme { get; set; }Property value
Title
MermaidChart.csMethods
| Name | Description |
|---|---|
| CreateScene(ITextMeasurer?) | Lays the chart out into drawing primitives. |
| ToPlot() | Creates the plot that draws the chart. Each call returns a new plot, which you can change before drawing it. |
| ToSvg(SvgRenderOptions?) | Returns the chart as SVG. |
| WriteSvg(Stream, SvgRenderOptions?) | Writes the chart as SVG, encoded in UTF-8 without a byte order mark. |
| WriteSvg(TextWriter, SvgRenderOptions?) | Writes the chart as SVG. |
CreateScene(ITextMeasurer?)
MermaidChart.csLays the chart out into drawing primitives.
public Scene CreateScene(ITextMeasurer? textMeasurer = null)Parameters
textMeasurerITextMeasurer?- The measurer of the texts, or
nullforMermaidChart.TextMeasurer.
Returns
Scene The scene.
ToPlot()
MermaidChart.csCreates the plot that draws the chart. Each call returns a new plot, which you can change before drawing it.
public Plot ToPlot()Returns
Plot The plot, with the title, the description and the colors of MermaidChart.Theme.
ToSvg(SvgRenderOptions?)
MermaidChart.csReturns the chart as SVG.
public string ToSvg(SvgRenderOptions? options = null)Parameters
optionsSvgRenderOptions?- The options, or
nullfor the defaults, with the identifier prefixchart.
Returns
string The SVG document, without an XML declaration.
WriteSvg overloads
WriteSvg(Stream, SvgRenderOptions?)
MermaidChart.csWrites the chart as SVG, encoded in UTF-8 without a byte order mark.
public void WriteSvg(Stream stream, SvgRenderOptions? options = null)Parameters
streamStream- The destination. It is left open.
optionsSvgRenderOptions?- The options, or
nullfor the defaults, with the identifier prefixchart.
WriteSvg(TextWriter, SvgRenderOptions?)
MermaidChart.csWrites the chart as SVG.
public void WriteSvg(TextWriter writer, SvgRenderOptions? options = null)Parameters
writerTextWriter- The destination.
optionsSvgRenderOptions?- The options, or
nullfor the defaults, with the identifier prefixchart.