Line Geometries

sample image

MyGeometry.cs

using LiveChartsCore.Drawing; using LiveChartsCore.SkiaSharpView.Drawing;

namespace ViewModelsSamples.Lines.Custom;

public class MyGeometry : BoundedDrawnGeometry, IDrawnElement { public void Draw(SkiaSharpDrawingContext context) { var paint = context.ActiveSkiaPaint; var canvas = context.Canvas;

    canvas.DrawRect(X, Y, Width, Height, paint);
    canvas.DrawLine(X, Y, X + Width, Y + Height, paint);
    canvas.DrawLine(X + Width, Y, X, Y + Height, paint);
}

}

Razor```

@page "/Lines/Custom" @using LiveChartsCore.SkiaSharpView.Blazor @using LiveChartsCore; @using LiveChartsCore.SkiaSharpView; @using LiveChartsCore.SkiaSharpView.Drawing.Geometries; @using LiveChartsCore.SkiaSharpView.Painting; @using SkiaSharp; @using LiveChartsCore.Drawing; @using ViewModelsSamples.Lines.Custom

@code { private ISeries[] series = new ISeries[] { new LineSeries { Values = new double[] { 2, 1, 4, 2, 2, -5, -2 }, Fill = null, GeometrySize = 20 }, new LineSeries<double, StarGeometry> { Values = new double[] { 3, 3, -3, -2, -4, -3, -1 }, Fill = null, GeometrySize = 20 }, new LineSeries<double, VariableSVGPathGeometry> { Values = new double[] { -2, 2, 1, 3, -1, 4, 3 }, Fill = null, GeometrySize = 20, GeometrySvg = SVGPoints.Pin }, new LineSeries<double, MyGeometry> { Values = new double[] { 4, 5, 2, 4, 3, 2, 1 }, Fill = null, GeometrySize = 20 } }; }




### Articles you might also find useful:


<div>
<a href="https://livecharts.dev/docs/blazor/2.0.0-rc6/CartesianChart.Cartesian%20chart%20control">
Cartesian chart control
</a>
</div>


<div>
<a href="https://livecharts.dev/docs/blazor/2.0.0-rc6/CartesianChart.Line%20Series%20properties">
Line series properties
</a>
</div>