-
Notifications
You must be signed in to change notification settings - Fork 47
[wip] implement SkiaSharp PlotViews #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
268b765
0c3cc76
feaf9e4
f7a2a86
af951aa
ad7e186
ceecb6e
0f0c149
44c3fa9
1b044fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="MainViewModel.cs" company="OxyPlot"> | ||
// Copyright (c) 2014 OxyPlot contributors | ||
// </copyright> | ||
// <summary> | ||
// Represents the view-model for the main window. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace ExampleBrowser | ||
{ | ||
using ExampleLibrary; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public class Category | ||
{ | ||
public Category(string key, List<ExampleInfo> examples) | ||
{ | ||
this.Key = key; | ||
this.Examples = examples ?? throw new ArgumentNullException(nameof(examples)); | ||
} | ||
|
||
public string Key { get; } | ||
public List<ExampleInfo> Examples { get; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="MainViewModel.cs" company="OxyPlot"> | ||
// Copyright (c) 2014 OxyPlot contributors | ||
// </copyright> | ||
// <summary> | ||
// Represents the view-model for the main window. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace ExampleBrowser | ||
{ | ||
using Avalonia.Data.Converters; | ||
|
||
public class NotNullBooleanConverter : FuncValueConverter<object, bool> | ||
Jonarw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
public NotNullBooleanConverter() : base(obj => obj is not null) | ||
{ | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,14 @@ class Program | |
// Initialization code. Don't use any Avalonia, third-party APIs or any | ||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized | ||
// yet and stuff might break. | ||
public static void Main(string[] args) => BuildAvaloniaApp() | ||
public static void Main(string[] args) | ||
{ | ||
OxyPlot.Avalonia.OxyPlotModule.EnsureLoaded(); | ||
OxyPlot.SkiaSharp.Avalonia.OxyPlotModule.EnsureLoaded(); | ||
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What purpose do these serve? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No idea, I have this from some Avalonia example which I can't find anymore. This seemed to be required at some point when I was testing, but I just tried without these lines and it seems to work fine... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had wondered if it was to force the XML namespaces or something, but I don't know. If it works without, I'd say scrub them until we have reason to put them back in. |
||
|
||
BuildAvaloniaApp() | ||
.StartWithClassicDesktopLifetime(args); | ||
} | ||
|
||
// Avalonia configuration, don't remove; also used by visual designer. | ||
public static AppBuilder BuildAvaloniaApp() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace ExampleBrowser | ||
{ | ||
public enum Renderer | ||
{ | ||
Canvas, | ||
SkiaSharp, | ||
SkiaSharpDoubleBuffered, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Avalonia; | ||
|
||
namespace OxyPlot.Avalonia.Extensions | ||
{ | ||
public static class ConverterExtensions | ||
{ | ||
public static OxyRect ToOxyRect(this Rect rect) | ||
{ | ||
return new OxyRect(rect.Left, rect.Top, rect.Width, rect.Height); | ||
} | ||
public static Rect ToRect(this OxyRect rect) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Micronit: Probably wants a line break between these |
||
{ | ||
return new Rect(rect.Left, rect.Top, rect.Width, rect.Height); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' < '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
<HasSharedItems>true</HasSharedItems> | ||
<SharedGUID>8f6dadff-7073-4862-86c7-4299ae17cd68</SharedGUID> | ||
</PropertyGroup> | ||
<PropertyGroup Label="Configuration"> | ||
<Import_RootNamespace>OxyPlot.Avalonia.Shared</Import_RootNamespace> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildThisFileDirectory)Converters\OxyColorConverter.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)Converters\ThicknessConverter.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ConverterExtensions.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)Extensions\DataPointExtension.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)MoreColors.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)PlotBase.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)PlotBase.Events.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)PlotBase.Properties.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)Tracker\TrackerControl.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)Tracker\TrackerDefinition.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)Utilities\ConverterExtensions.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildThisFileDirectory)PlotBase.Model.cs" /> | ||
</ItemGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>8f6dadff-7073-4862-86c7-4299ae17cd68</ProjectGuid> | ||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" /> | ||
<PropertyGroup /> | ||
<Import Project="OxyPlot.Avalonia.Shared.projitems" Label="Shared" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" /> | ||
</Project> |
Uh oh!
There was an error while loading. Please reload this page.