Custom Bars
This web site builds the control from code behind but you could also grab it from the toolbox, this sample also uses a ViewModel to populate the properties of the control(s) in this sample.

View model
using LiveChartsCore;
using LiveChartsCore.Drawing;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
namespace ViewModelsSamples.Bars.Custom;
public class ViewModel
{
public ISeries[] Series { get; set; } = [
new ColumnSeries<double> ([2, 1, 4]),
// use the second generic parameter to define the geometry to draw
// there are many predefined geometries in the LiveChartsCore.Drawing namespace
// for example, the StarGeometry, CrossGeometry, RectangleGeometry and DiamondGeometry
new ColumnSeries<double, DiamondGeometry>([4, 3, 6]),
// You can also use SVG paths to draw the geometry
// the VariableSVGPathGeometry can change the drawn path at runtime
new ColumnSeries<double, VariableSVGPathGeometry>([-2, 2, 1])
{
GeometrySvg = SVGPoints.Star
},
// finally you can also use SkiaSharp to draw your own geometry
new ColumnSeries<double, MyGeometry>([4, 5, 2])
];
}
MyGeometry.cs
using LiveChartsCore.Drawing;
using LiveChartsCore.SkiaSharpView.Drawing;
namespace ViewModelsSamples.Bars.Custom;
public class MyGeometry : BoundedDrawnGeometry, IDrawnElement<SkiaSharpDrawingContext>
{
public void Draw(SkiaSharpDrawingContext context)
{
var paint = context.ActiveSkiaPaint;
var canvas = context.Canvas;
var y = Y;
while (y < Y + Height)
{
canvas.DrawLine(X, y, X + Width, y, paint);
y += 5;
}
}
}
Form code behind
using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using ViewModelsSamples.Bars.Custom;
namespace WinFormsSample.Bars.Custom;
public partial class View : UserControl
{
private readonly CartesianChart cartesianChart;
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);
var viewModel = new ViewModel();
cartesianChart = new CartesianChart
{
Series = viewModel.Series,
// out of livecharts properties...
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(50, 50),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}