Skip to main content

Chart Class

NuGet: GHIElectronics.TinyCLR.UI
Assembly: GHIElectronics.TinyCLR.UI
Namespace: GHIElectronics.TinyCLR.UI.Controls

Simple line / bar chart. The rendered surface is cached and only rebuilt when Refresh is called or the control's render size changes — so calling Invalidate on the parent each frame does not redo the chart math.

public class Chart : Image, IDisposable

Constructors​

Chart(int width, int height)​

public Chart(int width, int height)

Creates a new Chart with the given pixel size.

Properties​

DivisionAxisX​

public int DivisionAxisX { get; set; }

Spacing factor between labeled divisions on the X axis.

DivisionAxisY​

public int DivisionAxisY { get; set; }

Value step ("offset") between Y-axis labels. Labels are drawn at step, 2×step, … up to the first multiple that is >= the max data value; 0 is not labelled. Default 1 (every integer). E.g. 5 gives 5, 10, 15, … The plot scales from 0 to that top value.

Font​

public Font Font { get; set; }

Font used for chart text.

AxisPen​

public Media.Pen AxisPen { get; set; }

Pen used to draw the axes.

ChartPen​

public Media.Pen ChartPen { get; set; }

Pen used to draw the chart series.

EllipseColor​

public Media.SolidColorBrush EllipseColor { get; set; }

Brush used to fill the data point markers.

DivisionColor​

public Media.SolidColorBrush DivisionColor { get; set; }

Brush used to draw the axis division markers.

TextColor​

public Media.SolidColorBrush TextColor { get; set; }

Brush used to draw chart text.

BackgroundColor​

public Media.SolidColorBrush BackgroundColor { get; set; }

Brush used to fill the chart background.

AreaColor​

public Media.SolidColorBrush AreaColor { get; set; }

Fill under the series when Mode is ChartMode.AreaMode.

RadiusPoint​

public int RadiusPoint { get; set; }

Radius in pixels of the data point markers.

ChartTitle​

public string ChartTitle { get; set; }

Title text shown above the chart.

Items​

public ArrayList Items { get; set; }

The data points to plot.

Mode​

public ChartMode Mode { get; set; }

Whether the series is drawn as a line or as bars.

Methods​

Refresh()​

public void Refresh()

Marks the cached chart surface stale. Call after mutating Items or any styling property to force a re-render on the next paint.

OnRender(DrawingContext dc)​

public override void OnRender(DrawingContext dc)

Draws the cached chart surface.

Dispose()​

public void Dispose()

Releases the resources used by the chart.

Dispose(bool disposing)​

protected virtual void Dispose(bool disposing)

Releases the cached chart bitmap.