XyChart Class

An XY chart: bars and lines over an x axis of categories or of numbers, and a y axis of numbers (Mermaid xychart). The chart is drawn with a Plot of XyChart.Width by XyChart.Height pixels: a bar mark or a line mark per series, in the colors of the palette of the XY charts of Mermaid.

public sealed class XyChart : MermaidChart

Remarks

Charts lays the chart out: the options of Mermaid that place the elements (the paddings and XyChart.PlotReservedSpacePercent) are written back by MermaidWriter but not drawn.

Inheritance
MermaidChart XyChart

Constructors

NameDescription
XyChart()

XyChart()

XyChart.cs
public XyChart()

No documentation is available.

Properties

NameDescription
BackgroundColorGets or sets the background of the chart, or null for the background of the theme.
DataLabelColorGets or sets the color of the values written on the bars, or null for the color of the texts of the theme.
DataLabelsOutsideBarsGets or sets a value that indicates whether the values of the bars are written past their end, instead of inside them. The default is false.
HeightGets or sets the height of the chart, in pixels. The default is 500.
LegendFontSizeGets or sets the size of the font of the legend. The default is 14. Charts has one size for the legend and the titles of the axes: the largest of this size and of the XyChartAxis.TitleFontSize of the axes.
LegendPaddingGets or sets the space around the legend. The default is 10. It is written back but not drawn: Charts places the legend.
LegendTextColorGets or sets the color of the texts of the legend, or null for the color of the texts of the theme. See XyChart.TitleColor.
OrientationGets or sets the orientation of the chart. The default is XyChartOrientation.Vertical.
PlotColorsGets the colors of the series, in order, or an empty list for the colors of the theme. The series take the colors in turn, starting over after the last one.
PlotReservedSpacePercentGets or sets the part of the width and of the height of the chart that the plot takes at least, in percent. The default is 50: the title, the axes and the legend take the rest, and the plot grows over what they leave. It is written back but not drawn: Charts gives the plot the space the title, the axes and the legend leave.
SeriesGets the series, drawn in order: a series hides the series before it where they overlap.
ShowDataLabelsGets or sets a value that indicates whether the value of each bar is written inside it, against its end. The default is false.
ShowLegendGets or sets a value that indicates whether the legend, on the right of the plot, lists the named series. The default is true.
ShowTitleGets or sets a value that indicates whether the MermaidChart.Title is drawn. The default is true.
TitleColorGets or sets the color of the title, or null for the color of the texts of the theme. Charts has one color for the title, the legend and the titles of the axes: the first color set among this one, XyChart.LegendTextColor and the XyChartAxis.TitleColor of the x axis, then of the y axis.
TitleFontSizeGets or sets the size of the font of the title. The default is 20.
TitlePaddingGets or sets the space above and below the title. The default is 10. It is written back but not drawn: Charts places the title.
WidthGets or sets the width of the chart, in pixels. The default is 700.
XAxisGets the x axis: the categories or the numbers the values belong to.
YAxisGets the y axis: the values.

BackgroundColor

XyChart.cs

Gets or sets the background of the chart, or null for the background of the theme.

public SceneColor? BackgroundColor { get; set; }

Property value

SceneColor?

DataLabelColor

XyChart.cs

Gets or sets the color of the values written on the bars, or null for the color of the texts of the theme.

public SceneColor? DataLabelColor { get; set; }

Property value

SceneColor?

DataLabelsOutsideBars

XyChart.cs

Gets or sets a value that indicates whether the values of the bars are written past their end, instead of inside them. The default is false.

public bool DataLabelsOutsideBars { get; set; }

Property value

bool

Gets or sets the height of the chart, in pixels. The default is 500.

public double Height { get; set; }

Property value

double

LegendFontSize

XyChart.cs

Gets or sets the size of the font of the legend. The default is 14. Charts has one size for the legend and the titles of the axes: the largest of this size and of the XyChartAxis.TitleFontSize of the axes.

public double LegendFontSize { get; set; }

Property value

double

LegendPadding

XyChart.cs

Gets or sets the space around the legend. The default is 10. It is written back but not drawn: Charts places the legend.

public double LegendPadding { get; set; }

Property value

double

LegendTextColor

XyChart.cs

Gets or sets the color of the texts of the legend, or null for the color of the texts of the theme. See XyChart.TitleColor.

public SceneColor? LegendTextColor { get; set; }

Property value

SceneColor?

Orientation

XyChart.cs

Gets or sets the orientation of the chart. The default is XyChartOrientation.Vertical.

public XyChartOrientation Orientation { get; set; }

Property value

XyChartOrientation

PlotColors

XyChart.cs

Gets the colors of the series, in order, or an empty list for the colors of the theme. The series take the colors in turn, starting over after the last one.

public IList<SceneColor> PlotColors { get; }

Property value

IList<SceneColor>

PlotReservedSpacePercent

XyChart.cs

Gets or sets the part of the width and of the height of the chart that the plot takes at least, in percent. The default is 50: the title, the axes and the legend take the rest, and the plot grows over what they leave. It is written back but not drawn: Charts gives the plot the space the title, the axes and the legend leave.

public double PlotReservedSpacePercent { get; set; }

Property value

double

Gets the series, drawn in order: a series hides the series before it where they overlap.

public IList<XyChartSeries> Series { get; }

Property value

IList<XyChartSeries>

ShowDataLabels

XyChart.cs

Gets or sets a value that indicates whether the value of each bar is written inside it, against its end. The default is false.

public bool ShowDataLabels { get; set; }

Property value

bool

ShowLegend

XyChart.cs

Gets or sets a value that indicates whether the legend, on the right of the plot, lists the named series. The default is true.

public bool ShowLegend { get; set; }

Property value

bool

ShowTitle

XyChart.cs

Gets or sets a value that indicates whether the MermaidChart.Title is drawn. The default is true.

public bool ShowTitle { get; set; }

Property value

bool

TitleColor

XyChart.cs

Gets or sets the color of the title, or null for the color of the texts of the theme. Charts has one color for the title, the legend and the titles of the axes: the first color set among this one, XyChart.LegendTextColor and the XyChartAxis.TitleColor of the x axis, then of the y axis.

public SceneColor? TitleColor { get; set; }

Property value

SceneColor?

TitleFontSize

XyChart.cs

Gets or sets the size of the font of the title. The default is 20.

public double TitleFontSize { get; set; }

Property value

double

TitlePadding

XyChart.cs

Gets or sets the space above and below the title. The default is 10. It is written back but not drawn: Charts places the title.

public double TitlePadding { get; set; }

Property value

double

Gets or sets the width of the chart, in pixels. The default is 700.

public double Width { get; set; }

Property value

double

Gets the x axis: the categories or the numbers the values belong to.

public XyChartAxis XAxis { get; }

Property value

XyChartAxis

Gets the y axis: the values.

public XyChartAxis YAxis { get; }

Property value

XyChartAxis

Methods

NameDescription
AddBars(IEnumerable<double>, string?)Adds a series drawn as bars.
AddLine(IEnumerable<double>, string?)Adds a series drawn as a line.

AddBars(IEnumerable<double>, string?)

XyChart.cs

Adds a series drawn as bars.

public XyChartBarSeries AddBars(IEnumerable<double> values, string? name = null)

Parameters

values IEnumerable<double>
The values.
name string?
The name, shown in the legend, or null.

Returns

XyChartBarSeries The series.

AddLine(IEnumerable<double>, string?)

XyChart.cs

Adds a series drawn as a line.

public XyChartLineSeries AddLine(IEnumerable<double> values, string? name = null)

Parameters

values IEnumerable<double>
The values.
name string?
The name, shown in the legend, or null.

Returns

XyChartLineSeries The series.