Skip to content

Commit

Permalink
Merge pull request #1174 from beto-rodriguez/error-series
Browse files Browse the repository at this point in the history
Error series
  • Loading branch information
beto-rodriguez committed Aug 18, 2023
2 parents d96b31d + 49bd7a2 commit d534248
Show file tree
Hide file tree
Showing 52 changed files with 1,294 additions and 107 deletions.
12 changes: 12 additions & 0 deletions samples/AvaloniaSample/Error/Basic/View.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<UserControl x:Class="AvaloniaSample.Error.Basic.View"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
xmlns:vms="using:ViewModelsSamples.Error.Basic">
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:CartesianChart
Series="{Binding Series}">
</lvc:CartesianChart>
</UserControl>
17 changes: 17 additions & 0 deletions samples/AvaloniaSample/Error/Basic/View.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace AvaloniaSample.Error.Basic;

public class View : UserControl
{
public View()
{
InitializeComponent();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
11 changes: 11 additions & 0 deletions samples/BlazorSample/Pages/Error/Basic/Basic.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@page "/Error/Basic"
@using LiveChartsCore.SkiaSharpView.Blazor
@using ViewModelsSamples.Error.Basic

<CartesianChart
Series="ViewModel.Series">
</CartesianChart>

@code {
public ViewModel ViewModel { get; set; } = new();
}
23 changes: 23 additions & 0 deletions samples/EtoFormsSample/Error/Basic/View.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Eto.Forms;
using LiveChartsCore.SkiaSharpView.Eto;
using ViewModelsSamples.Error.Basic;

namespace EtoFormsSample.Error.Basic;

public class View : Panel
{
/// <summary>
/// Initializes a new instance of the <see cref="View"/> class.
/// </summary>
public View()
{
var viewModel = new ViewModel();

var cartesianChart = new CartesianChart
{
Series = viewModel.Series
};

Content = cartesianChart;
}
}
13 changes: 13 additions & 0 deletions samples/MauiSample/Error/Basic/View.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="MauiSample.Error.Basic.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Error.Basic;assembly=ViewModelsSamples">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart
Series="{Binding Series}">
</lvc:CartesianChart>
</ContentPage>
10 changes: 10 additions & 0 deletions samples/MauiSample/Error/Basic/View.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace MauiSample.Error.Basic;

[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class View : ContentPage
{
public View()
{
InitializeComponent();
}
}
15 changes: 15 additions & 0 deletions samples/UWPSample/Error/Basic/View.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<UserControl x:Class="UWPSample.Error.Basic.View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Uno"
xmlns:vms="using:ViewModelsSamples.Error.Basic"
mc:Ignorable="d">
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:CartesianChart
Series="{Binding Series}">
</lvc:CartesianChart>
</UserControl>
12 changes: 12 additions & 0 deletions samples/UWPSample/Error/Basic/View.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Windows.UI.Xaml.Controls;

namespace UWPSample.Error.Basic
{
public sealed partial class View : UserControl
{
public View()
{
InitializeComponent();
}
}
}
7 changes: 7 additions & 0 deletions samples/UWPSample/UWPSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@
<Compile Include="Bars\WithBackground\View.xaml.cs">
<DependentUpon>View.xaml</DependentUpon>
</Compile>
<Compile Include="Error\Basic\View.xaml.cs">
<DependentUpon>View.xaml</DependentUpon>
</Compile>
<Compile Include="Box\Basic\View.xaml.cs">
<DependentUpon>View.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -509,6 +512,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Error\Basic\View.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Box\Basic\View.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<UserControl x:Class="UnoWinUISample.Error.Basic.View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.WinUI"
xmlns:vms="using:ViewModelsSamples.Error.Basic"
mc:Ignorable="d">
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:CartesianChart
Series="{Binding Series}">
</lvc:CartesianChart>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Microsoft.UI.Xaml.Controls;

namespace UnoWinUISample.Error.Basic;

public sealed partial class View : UserControl
{
public View()
{
InitializeComponent();
}
}
12 changes: 6 additions & 6 deletions samples/ViewModelsSamples/Box/Basic/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ public partial class ViewModel : ObservableObject
{
public ISeries[] Series { get; set; } =
{
new BoxSeries<BoxPoint>
new BoxSeries<BoxValue>
{
Name = "Year 2023",
Values = new BoxPoint[]
Values = new BoxValue[]
{
// max, upper quartile, median, lower quartile, min
new(100, 80, 60, 20, 70),
new(90, 70, 50, 30, 60),
new(80, 60, 40, 10, 50)
}
},
new BoxSeries<BoxPoint>
new BoxSeries<BoxValue>
{
Name = "Year 2024",
Values = new BoxPoint[]
Values = new BoxValue[]
{
new(90, 70, 50, 30, 60),
new(80, 60, 40, 10, 50),
new(70, 50, 30, 20, 40)
}
},
new BoxSeries<BoxPoint>
new BoxSeries<BoxValue>
{
Name = "Year 2025",
Values = new BoxPoint[]
Values = new BoxValue[]
{
new(80, 60, 40, 10, 50),
new(70, 50, 30, 20, 40),
Expand Down
52 changes: 52 additions & 0 deletions samples/ViewModelsSamples/Error/Basic/ViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using CommunityToolkit.Mvvm.ComponentModel;
using LiveChartsCore;
using LiveChartsCore.Defaults;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;

namespace ViewModelsSamples.Error.Basic;

public partial class ViewModel : ObservableObject
{
public ISeries[] Series { get; set; } =
{
// use the ErrorValue type to define the error in Y
new ColumnSeries<ErrorValue>
{
Values = new ErrorValue[]
{
// (y, y error)
new(65, 6),
// (y, top y error, bottom y error)
new(70, 15, 4),
new(35, 4),
new(70, 6),
new(30, 5),
new(60, 4, 16),
new(65, 6)
},
ErrorPaint = new SolidColorPaint(SKColors.Black)
},

// When you need to define the error in X and Y use the ErrorPoint type
new ColumnSeries<ErrorPoint>
{
Values = new ErrorPoint[]
{
// (x, y, x error, y error)
new(0, 50, 0.2, 8),
// (x, y, left x error, right x erorr, top y error, bottom y error)
new(1, 45, 0.1, 0.3, 15, 4),
new(2, 25, 0.3, 4),
new(3, 30, 0.2, 6),
new(4, 70, 0.2, 8),
new(5, 30, 0.4, 4),
new(6, 50, 0.3, 6)
},
ErrorPaint = new SolidColorPaint(SKColors.Black)
}

// Error marks are also supported in LineSeries<T> and RowSeries<T> // mark
};
}
2 changes: 2 additions & 0 deletions samples/ViewModelsSamples/Index.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public static class Index

"Financial/BasicCandlesticks",

"Error/Basic",

"Box/Basic",

"Heat/Basic",
Expand Down
12 changes: 12 additions & 0 deletions samples/WPFSample/Error/Basic/View.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<UserControl x:Class="WPFSample.Error.Basic.View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
xmlns:vms="clr-namespace:ViewModelsSamples.Error.Basic;assembly=ViewModelsSamples">
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:CartesianChart
Series="{Binding Series}">
</lvc:CartesianChart>
</UserControl>
14 changes: 14 additions & 0 deletions samples/WPFSample/Error/Basic/View.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Windows.Controls;

namespace WPFSample.Error.Basic;

/// <summary>
/// Interaction logic for View.xaml
/// </summary>
public partial class View : UserControl
{
public View()
{
InitializeComponent();
}
}
46 changes: 46 additions & 0 deletions samples/WinFormsSample/Error/Basic/View.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions samples/WinFormsSample/Error/Basic/View.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using ViewModelsSamples.Error.Basic;

namespace WinFormsSample.Error.Basic;

public partial class View : UserControl
{
/// <summary>
/// Initializes a new instance of the <see cref="View"/> class.
/// </summary>
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);

var viewModel = new ViewModel();

var cartesianChart = new CartesianChart
{
Series = viewModel.Series,

// out of livecharts properties...
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);
}
}

0 comments on commit d534248

Please sign in to comment.