The cross-platform plotting library - OxyPlot - is now available for Webassembly using Blazor and SkiaSharp.
dotnet add package OxyPlot.SkiaSharp.Blazor
<PlotView Model=model style="height: 30vh"/>
@code{
private PlotModel model = new PlotModel();
...
protected override async Task OnInitializedAsync()
{
var data = GetSomeDataPoints(); //get datapoint array from somewhere
var spc = new LineSeries()
{
ItemsSource = data,
Title = "UV/Vis Data",
TrackerFormatString = "{0}<br/>{1}: {2:0.00} - {3}: {4:0.00}"
};
model.Series.Add(spc);
}
}
Requirements:
- .NET 6.0 (lower .NET versions are impossible due to a novelty introduced in 6.0)
- SkiaSharp.Views.Blazor v2.88.0-preview.179 or higher
- OxyPlot.SkiaSharp v2.1.0 or higher