Basic Area
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.
Code behind
using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
namespace WinFormsSample.Lines.Area;
public partial class View : UserControl
{
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);
var values = new double[] { -2, -1, 3, 5, 3, 4, 6 };
var series = new ISeries[]
{
new LineSeries<double>
{
Values = values,
Fill = new SolidColorPaint(SKColor.Parse("#6495ED")),
Stroke = null,
GeometryFill = null,
GeometryStroke = null
}
};
var drawMarginFrame = new DrawMarginFrame
{
Stroke = new SolidColorPaint(SKColor.Parse("#64b4b4b4")),
Fill = new SolidColorPaint(SKColor.Parse("#32dcdcdc"))
};
var cartesianChart = new CartesianChart
{
Series = series,
DrawMarginFrame = drawMarginFrame,
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);
}
}