Skip to content

CodingConnected/OxyPlot.SkiaSharp.Blazor

 
 

Repository files navigation

OxyPlot.SkiaSharp.Blazor

The cross-platform plotting library - OxyPlot - is now available for Webassembly using Blazor and SkiaSharp. This project is based on the original source by JensKrumsieck.

Screenshot

Installation

dotnet add package OxyPlot.SkiaSharp.Blazor

Usage

<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);
    }
}

A note on fonts: in order to use a non-default font in WebAssembly, you need to embed it in your app as an embedded resource. Otherwise, OxyPlot.SkiaSharp will not be able to load it. Include all variants you need, like regular, bold, italic, etc.

Requirements:
* .NET 9.0
* SkiaSharp.Views.Blazor v3.116.1
* OxyPlot.SkiaSharp v2.2.0

About

The cross-platform plotting library - OxyPlot - is now available for Webassembly using Blazor and SkiaSharp.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 43.2%
  • HTML 30.4%
  • CSS 26.4%