A cross-platform plotting library for .NET. This package targets Avalonia apps.
Перейти к файлу
Dan Walmsley 2d1a239159
Merge pull request #3 from AvaloniaUI/Takoooooo-patch-1
Update azure-pipelines.yml
2023-06-21 14:43:16 +01:00
Source Merge pull request #2 from AvaloniaUI/avalonia11 2023-06-21 14:21:10 +01:00
.gitattributes Add .gitignore (from github/gitignore) and .gitattributes 2014-08-15 09:39:19 +02:00
.gitignore Update .gitignore from https://www.gitignore.io/api/visualstudio 2016-02-14 11:57:05 +01:00
LICENSE Update readme etc 2014-09-02 00:12:20 +02:00
README.md fix breaking changes. 2023-04-25 15:02:40 +01:00
azure-pipelines.yml Update azure-pipelines.yml 2023-06-21 16:33:24 +03:00

README.md

nuget License Size

OxyPlot.Avalonia

OxyPlot is a plotting library for .NET. This package targets Avalonia applications.

dotnet add package OxyPlot.Avalonia

Usage

To use the library, add the following to your App.xaml:

<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="Sensei.Presentation.Avalonia.App">
    <Application.Styles>
        <StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
        <StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
      
        <!-- Add the line below to get OxyPlot UI theme applied. -->
        <StyleInclude Source="resm:OxyPlot.Avalonia.Themes.Default.xaml?assembly=OxyPlot.Avalonia"/>
    </Application.Styles>
</Application>

Then, you can add plots to your application, as such:

<avalonia:Plot Height="150" 
               PlotMargins="50 0 0 0"
               PlotAreaBorderColor="#999999">
    <avalonia:Plot.Series>
        <avalonia:AreaSeries 
            DataFieldX="Index"
            DataFieldY="Value"
            ItemsSource="{Binding Path=Values}"
            Color="#fd6d00" />
    </avalonia:Plot.Series>
</avalonia:Plot>

See the AvaloniaExamples project and OxyPlot Documentation to learn how to create more complex plots.

Installing Preview Versions

To access the latest version of OxyPlot.Avalonia you can add this repo as a submodule to your own git repo:

mkdir ./external
git submodule add git@github.com:oxyplot/oxyplot-avalonia.git ./external/oxyplot-avalonia
# Reference the ../external/oxyplot-avalonia/Source/OxyPlot.Avalonia/OxyPlot.Avalonia.csproj project then.

Another way is to import our Azure Artifacts NuGet package feed by creating the following nuget.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear /> <!-- Add other external NuGet package sources here -->
    <add key="OxyPlot.Avalonia-CI" value="https://worldbeater.pkgs.visualstudio.com/OxyPlot.Avalonia/_packaging/OxyPlot.Avalonia-CI/nuget/v3/index.json" />
  </packageSources>
</configuration>

Next, install the latest preview version of the OxyPlot.Avalonia package as such:

dotnet add package OxyPlot.Avalonia