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 : MermaidChartRemarks
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
MermaidChartXyChart
Constructors
| Name | Description |
|---|---|
| XyChart() |
XyChart()
XyChart.cspublic XyChart()No documentation is available.
Properties
| Name | Description |
|---|---|
| BackgroundColor | Gets or sets the background of the chart, or null for the background of the theme. |
| DataLabelColor | Gets or sets the color of the values written on the bars, or null for the color of the texts of the theme. |
| DataLabelsOutsideBars | 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. |
| Height | Gets or sets the height of the chart, in pixels. The default is 500. |
| LegendFontSize | 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. |
| LegendPadding | Gets or sets the space around the legend. The default is 10. It is written back but not drawn: Charts places the legend. |
| LegendTextColor | 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. |
| Orientation | Gets or sets the orientation of the chart. The default is XyChartOrientation.Vertical. |
| PlotColors | 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. |
| PlotReservedSpacePercent | 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. |
| Series | Gets the series, drawn in order: a series hides the series before it where they overlap. |
| ShowDataLabels | Gets or sets a value that indicates whether the value of each bar is written inside it, against its end. The default is false. |
| ShowLegend | Gets or sets a value that indicates whether the legend, on the right of the plot, lists the named series. The default is true. |
| ShowTitle | Gets or sets a value that indicates whether the MermaidChart.Title is drawn. The default is true. |
| TitleColor | 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. |
| TitleFontSize | Gets or sets the size of the font of the title. The default is 20. |
| TitlePadding | 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. |
| Width | Gets or sets the width of the chart, in pixels. The default is 700. |
| XAxis | Gets the x axis: the categories or the numbers the values belong to. |
| YAxis | Gets the y axis: the values. |
BackgroundColor
XyChart.csGets or sets the background of the chart, or null for the background of the theme.
public SceneColor? BackgroundColor { get; set; }Property value
DataLabelColor
XyChart.csGets 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
DataLabelsOutsideBars
XyChart.csHeight
XyChart.csLegendFontSize
XyChart.csGets 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
LegendPadding
XyChart.csLegendTextColor
XyChart.csGets 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
Orientation
XyChart.csGets or sets the orientation of the chart. The default is XyChartOrientation.Vertical.
public XyChartOrientation Orientation { get; set; }Property value
PlotColors
XyChart.csGets 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
PlotReservedSpacePercent
XyChart.csGets 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
Series
XyChart.csGets the series, drawn in order: a series hides the series before it where they overlap.
public IList<XyChartSeries> Series { get; }Property value
ShowDataLabels
XyChart.csShowLegend
XyChart.csShowTitle
XyChart.csGets or sets a value that indicates whether the MermaidChart.Title is drawn. The default is true.
public bool ShowTitle { get; set; }Property value
TitleColor
XyChart.csGets 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
TitleFontSize
XyChart.csTitlePadding
XyChart.csWidth
XyChart.csXAxis
XyChart.csGets the x axis: the categories or the numbers the values belong to.
public XyChartAxis XAxis { get; }Property value
YAxis
XyChart.csMethods
| Name | Description |
|---|---|
| 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.csAdds a series drawn as bars.
public XyChartBarSeries AddBars(IEnumerable<double> values, string? name = null)Parameters
valuesIEnumerable<double>- The values.
namestring?- The name, shown in the legend, or
null.
Returns
XyChartBarSeries The series.
AddLine(IEnumerable<double>, string?)
XyChart.csAdds a series drawn as a line.
public XyChartLineSeries AddLine(IEnumerable<double> values, string? name = null)Parameters
valuesIEnumerable<double>- The values.
namestring?- The name, shown in the legend, or
null.
Returns
XyChartLineSeries The series.