ScottPlot.NET
GitHub Repo stars

Avalonia Quickstart

Step 1: Install the ScottPlot.Avalonia NuGet package. Linux & MacOS users must take these additional steps.

Step 2: Import the ScottPlot.Avalonia namespace by adding this to your Window element:

xmlns:ScottPlot="clr-namespace:ScottPlot.Avalonia;assembly=ScottPlot.Avalonia"

Your Window element should look something like this:

<Window xmlns="https://github.com/avaloniaui"
        ...
        x:Class="ScottPlot.Demo.Avalonia.MainWindow"
        xmlns:ScottPlot="clr-namespace:ScottPlot.Avalonia;assembly=ScottPlot.Avalonia"
        Title="Avalonia Quickstart" Width="500" Height="350">

Step 3: Add an AvaPlot to your layout and give it a unique name

<ScottPlot:AvaPlot Name="AvaPlot1"/>

Step 4: Plot some data in your start-up sequence

This code sample is specific to ScottPlot 5 (details)
double[] dataX = { 1, 2, 3, 4, 5 };
double[] dataY = { 1, 4, 9, 16, 25 };

AvaPlot avaPlot1 = this.Find<AvaPlot>("AvaPlot1");
avaPlot1.Plot.Add.Scatter(dataX, dataY);
avaPlot1.Refresh();