diff --git a/.github/workflows/compile-all-views.yml b/.github/workflows/compile-all-views.yml index fb5724ddd..e3b238bfa 100644 --- a/.github/workflows/compile-all-views.yml +++ b/.github/workflows/compile-all-views.yml @@ -23,5 +23,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + + - name: Install MAUI workload + run: dotnet workload install maui + - name: Compile Debug run: ./build/build-windows.ps1 -configuration "Debug" diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index 11a309c83..1e823bcb4 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -23,5 +23,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + + - name: Install MAUI workload + run: dotnet workload install maui + - name: Run unit tests run: dotnet test ./tests/LiveChartsCore.UnitTesting diff --git a/LiveCharts.sln b/LiveCharts.sln index 8e25960fe..5f3c1b160 100644 --- a/LiveCharts.sln +++ b/LiveCharts.sln @@ -46,10 +46,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UWP", "UWP", "{E54BED97-FCF3-4B6D-80EA-F973D974B879}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UWPSample", "samples\UWPSample\UWPSample.csproj", "{3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BlazorWasm", "BlazorWasm", "{0E557B2A-2E41-43B6-86C4-DF581AC5AC87}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorSample", "samples\BlazorSample\BlazorSample.csproj", "{AC34AC1D-3283-4717-9F77-76AB92F42A2C}" @@ -72,8 +68,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveChartsCore.SkiaSharpVie EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiSample", "samples\MauiSample\MauiSample.csproj", "{60FAD94A-2E69-4FDA-BF39-DC29CD44214B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveChartsCore.SkiaSharpView.Uno", "src\skiasharp\LiveChartsCore.SkiaSharpView.Uno\LiveChartsCore.SkiaSharpView.Uno.csproj", "{DFCDB92D-2678-464D-A679-3866702FC6BF}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveChartsCore.SkiaSharpView.WinUI", "src\skiasharp\LiveChartsCore.SkiaSharpView.WinUI\LiveChartsCore.SkiaSharpView.WinUI.csproj", "{E050FFE3-98AC-4D3E-99CC-136443921B6F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WinUI", "WinUI", "{39D52D6D-70BC-40D3-84E3-CF8CD0D73D10}" @@ -897,80 +891,6 @@ Global {3C2531FA-92D4-4281-BE52-02AF6AE0CF80}.Release|x64.Build.0 = Release|Any CPU {3C2531FA-92D4-4281-BE52-02AF6AE0CF80}.Release|x86.ActiveCfg = Release|Any CPU {3C2531FA-92D4-4281-BE52-02AF6AE0CF80}.Release|x86.Build.0 = Release|Any CPU - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|Any CPU.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|Any CPU.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|Any CPU.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|ARM.ActiveCfg = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|ARM.Build.0 = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|ARM.Deploy.0 = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|ARM64.ActiveCfg = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|ARM64.Build.0 = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|ARM64.Deploy.0 = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|iPhone.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|iPhone.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|iPhone.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|x64.ActiveCfg = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|x64.Build.0 = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|x64.Deploy.0 = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|x86.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|x86.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Ad-Hoc|x86.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|Any CPU.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|Any CPU.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|Any CPU.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|ARM.ActiveCfg = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|ARM.Build.0 = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|ARM.Deploy.0 = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|ARM64.ActiveCfg = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|ARM64.Build.0 = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|ARM64.Deploy.0 = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|iPhone.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|iPhone.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|iPhone.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|iPhoneSimulator.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|iPhoneSimulator.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|iPhoneSimulator.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|x64.ActiveCfg = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|x64.Build.0 = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|x64.Deploy.0 = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|x86.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|x86.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.AppStore|x86.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|Any CPU.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|Any CPU.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|Any CPU.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|ARM.ActiveCfg = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|ARM.Build.0 = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|ARM.Deploy.0 = Debug|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|ARM64.Build.0 = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|iPhone.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|x64.ActiveCfg = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|x64.Build.0 = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|x64.Deploy.0 = Debug|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|x86.ActiveCfg = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|x86.Build.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Debug|x86.Deploy.0 = Debug|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|Any CPU.ActiveCfg = Release|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|ARM.ActiveCfg = Release|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|ARM.Build.0 = Release|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|ARM.Deploy.0 = Release|ARM - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|ARM64.ActiveCfg = Release|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|ARM64.Build.0 = Release|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|ARM64.Deploy.0 = Release|ARM64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|iPhone.ActiveCfg = Release|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|iPhoneSimulator.ActiveCfg = Release|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|x64.ActiveCfg = Release|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|x64.Build.0 = Release|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|x64.Deploy.0 = Release|x64 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|x86.ActiveCfg = Release|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|x86.Build.0 = Release|x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3}.Release|x86.Deploy.0 = Release|x86 {AC34AC1D-3283-4717-9F77-76AB92F42A2C}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {AC34AC1D-3283-4717-9F77-76AB92F42A2C}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {AC34AC1D-3283-4717-9F77-76AB92F42A2C}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU @@ -1391,62 +1311,6 @@ Global {60FAD94A-2E69-4FDA-BF39-DC29CD44214B}.Release|x86.ActiveCfg = Release|Any CPU {60FAD94A-2E69-4FDA-BF39-DC29CD44214B}.Release|x86.Build.0 = Release|Any CPU {60FAD94A-2E69-4FDA-BF39-DC29CD44214B}.Release|x86.Deploy.0 = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|ARM64.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|ARM64.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|ARM.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|ARM64.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|ARM64.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|iPhone.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|x64.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|x64.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|x86.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.AppStore|x86.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|ARM.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|ARM.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|ARM64.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|iPhone.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|x64.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|x64.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|x86.ActiveCfg = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Debug|x86.Build.0 = Debug|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|Any CPU.Build.0 = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|ARM.ActiveCfg = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|ARM.Build.0 = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|ARM64.ActiveCfg = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|ARM64.Build.0 = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|iPhone.ActiveCfg = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|iPhone.Build.0 = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|x64.ActiveCfg = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|x64.Build.0 = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|x86.ActiveCfg = Release|Any CPU - {DFCDB92D-2678-464D-A679-3866702FC6BF}.Release|x86.Build.0 = Release|Any CPU {E050FFE3-98AC-4D3E-99CC-136443921B6F}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {E050FFE3-98AC-4D3E-99CC-136443921B6F}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {E050FFE3-98AC-4D3E-99CC-136443921B6F}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU @@ -2109,8 +1973,6 @@ Global {3C2531FA-92D4-4281-BE52-02AF6AE0CF80} = {8E110D49-2060-4709-85FB-90E18515D201} {2F6A1323-9B22-4AFC-9199-A705B72B7885} = {2E9ED2C0-0C15-4890-8070-4A3B8A5C7704} {A90B0463-5752-4835-A2BB-D1BF356068B3} = {2E9ED2C0-0C15-4890-8070-4A3B8A5C7704} - {E54BED97-FCF3-4B6D-80EA-F973D974B879} = {2E9ED2C0-0C15-4890-8070-4A3B8A5C7704} - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3} = {E54BED97-FCF3-4B6D-80EA-F973D974B879} {0E557B2A-2E41-43B6-86C4-DF581AC5AC87} = {2E9ED2C0-0C15-4890-8070-4A3B8A5C7704} {AC34AC1D-3283-4717-9F77-76AB92F42A2C} = {0E557B2A-2E41-43B6-86C4-DF581AC5AC87} {1FCEEFAB-AB76-47D1-94E3-3FE729813B51} = {2E9ED2C0-0C15-4890-8070-4A3B8A5C7704} diff --git a/build/build-windows.ps1 b/build/build-windows.ps1 index a681c9c93..3829a83f4 100644 --- a/build/build-windows.ps1 +++ b/build/build-windows.ps1 @@ -1,24 +1,28 @@ param([string]$configuration = "Release") +dotnet workload install macos +dotnet workload install ios +dotnet workload install maccatalyst +dotnet workload install android + dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj -c $configuration dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj -c $configuration dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharp.Wpf/LiveChartsCore.SkiaSharpView.Wpf.csproj -c $configuration dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.Xamarin.Forms.csproj -c $configuration dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj -c $configuration dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj -c $configuration -dotnet build ./src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj -c $configuration $msbuild = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe & $msbuild ` - ./src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj ` + ./src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj ` /p:configuration=$configuration ` /restore -dotnet workload install macos -dotnet workload install ios -dotnet workload install maccatalyst -dotnet workload install android +& $msbuild ` + ./src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj ` + /p:configuration=$configuration ` + /restore & $msbuild ` ./src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj ` diff --git a/build/pack.ps1 b/build/pack.ps1 index 5b89a3513..6cfaa83c3 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -119,7 +119,7 @@ function Add-Pack { Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile "./nuget.exe" } - ./nuget pack $project.nuspecFile -OutputDirectory $nupkgOutputPath -Symbols + ./nuget pack $project.nuspecFile -OutputDirectory $nupkgOutputPath -Symbols -SymbolPackageFormat snupkg } } diff --git a/docs/overview/1.2.install.md b/docs/overview/1.2.install.md index 1832421dd..cfe356661 100644 --- a/docs/overview/1.2.install.md +++ b/docs/overview/1.2.install.md @@ -445,7 +445,7 @@ namespace WinUISample { public class ViewModel { - public <ISeries[] Series { get; set; } + public ISeries[] Series { get; set; } = new ISeries[] { new LineSeries<double> @@ -469,13 +469,15 @@ then add a `CartesianChart` control and bind the `Series` property: xmlns:local="using:App3" xmlns:lvc="using:LiveChartsCore.SkiaSharpView.WinUI"> - <Window.DataContext> - <local:ViewModel /><!-- mark --> - </Window.DataContext> + <Grid> + <Grid.DataContext> + <local:ViewModel /><!-- mark --> + </Grid.DataContext> - <lvc:CartesianChart<!-- mark --> - Series="{Binding Series}"><!-- mark --> - </lvc:CartesianChart><!-- mark --> + <lvc:CartesianChart<!-- mark --> + Series="{Binding Series}"><!-- mark --> + </lvc:CartesianChart><!-- mark --> + </Grid> </Window> @@ -672,7 +674,7 @@ Go to the `Solution Explorer` and browse for `Program.cs` file, then edit the it Go to the `Solution Explorer` and browse for `UnoApp.Shared/App.xaml.cs` file, then edit the it as follows. ``` -{{ render this "~/../samples/UnoPlatformSample/UnoPlatformSample/App.cs" }} +{{ render this "~/../samples/UnoPlatform_v5/UnoPlatform_v5/App.cs" }} ``` {{~ end ~}} diff --git a/docs/samples/bars/custom/template.md b/docs/samples/bars/custom/template.md index 1370d86aa..b0fdad88c 100644 --- a/docs/samples/bars/custom/template.md +++ b/docs/samples/bars/custom/template.md @@ -8,7 +8,7 @@ ## MyGeometry.cs -{{~ "~/../samples/ViewModelsSamples/Lines/Custom/MyGeometry.cs" | render_file_as_code ~}} +{{~ "~/../samples/ViewModelsSamples/Bars/Custom/MyGeometry.cs" | render_file_as_code ~}} {{~ if xaml ~}} ## XAML diff --git a/docs/samples/general/drawOnCanvas/result.gif b/docs/samples/general/drawOnCanvas/result.gif new file mode 100644 index 000000000..4afca550c Binary files /dev/null and b/docs/samples/general/drawOnCanvas/result.gif differ diff --git a/docs/samples/general/drawOnCanvas/template.md b/docs/samples/general/drawOnCanvas/template.md new file mode 100644 index 000000000..bd539a1b9 --- /dev/null +++ b/docs/samples/general/drawOnCanvas/template.md @@ -0,0 +1,62 @@ +{{ render this "~/shared/genericSampleJustGifHeader.md" }} + +We can directly draw on the canvas to create custom shapes or effects, by default LiveCharts uses SkiaSharp +to render the controls, this means that you can use all the SkiaSharp API to draw on the canvas, you can find +more information about SkiaSharp [here](https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/basics/). + +In the next example we use the `UpdateStarted` command/event in the `CartesianChart`, this command/event is raised every time +the control is measured, a LiveCharts control is measured when the data changes or the control size change. + +## View model + +``` +{{ full_name | get_vm_from_docs }} +``` + +{{~ if xaml ~}} +## XAML +{{~ end ~}} + +{{~ if winforms ~}} +## Form code behind +{{~ end ~}} + +{{~ if blazor~}} +## HTML +{{~ end~}} + +``` +{{ full_name | get_view_from_docs }} +``` + +In the previous case we inherited from `Geometry`, this class already contains some useful properties that we +can use to set the location, rotation, opacity or transform of the geometry, you can find more information about +the `Geometry` class [here](https://livecharts.dev/api/{{ version }}/LiveChartsCore.SkiaSharpView.Drawing.Geometries.Geometry). + +We override the `OnDraw` method to define the drawing logic of our custom geometry, in this case we are only drawing a circle +based on the `X`, `Y` and `Diameter` properties. + +These properties are not regular properties, they are a special type defined by LiveCharts, the +[MotionProperty](https://livecharts.dev/api/{{ version }}/LiveChartsCore.Motion.MotionProperty-1) type is what handles animations +in LiveCharts. Every time we access a motion property we get the value of the property at the current time based on the +[IAnimatable](https://livecharts.dev/api/{{ version }}/LiveChartsCore.Drawing.IAnimatable) animation. + +We also created an instance of the `SolidColorPaint` class, this class defines how the geometry will be rendered on the canvas, +in this case a blue color with a stroke width of 2, then we added our geometry to the paint (you can add multiple geometries), +and we also added the paint to the canvas. + +The user interface update cycle is the following: + +1. The chart control is invalidated (data changed or size changed), so the control is measured and with it the `UpdateStarted` +command/event is raised. + +2. When the control is measured, we add Paints to the canvas, and geometries to the paints, this is only scheduling the drawing, +nothing is rendered yet at this point. + +3. Now the control starts drawing all the paints and geometries in the canvas, this is when the `OnDraw` method is called. + +4. LiveCharts defines the `MotionCanvas` class, it redraws the user interface as all the animations complete. This means that the +previous step is repeated multiple times per second (~60), so you must be careful when overriding the `OnDraw` method, you should only +perform drawing operations there. LiveCharts will keep drawing until all animations are finished. + +{{ render this "~/shared/relatedTo.md" }} diff --git a/docs/samples/pies/outlabels/result.png b/docs/samples/pies/outlabels/result.png new file mode 100644 index 000000000..16ebfeb7d Binary files /dev/null and b/docs/samples/pies/outlabels/result.png differ diff --git a/docs/samples/pies/outlabels/template.md b/docs/samples/pies/outlabels/template.md new file mode 100644 index 000000000..9faab4bbc --- /dev/null +++ b/docs/samples/pies/outlabels/template.md @@ -0,0 +1 @@ +{{ render this "~/shared/genericSampleSimple.md" }} \ No newline at end of file diff --git a/samples/AvaloniaSample/AvaloniaSample.csproj b/samples/AvaloniaSample/AvaloniaSample.csproj index 3427c876d..d4de816b0 100644 --- a/samples/AvaloniaSample/AvaloniaSample.csproj +++ b/samples/AvaloniaSample/AvaloniaSample.csproj @@ -1,8 +1,8 @@ - net7.0 + net8.0 enable - 11.0 + 12.0 diff --git a/samples/AvaloniaSample/Platforms/AvaloniaSample.Android/AvaloniaSample.Android.csproj b/samples/AvaloniaSample/Platforms/AvaloniaSample.Android/AvaloniaSample.Android.csproj index bf1270ab2..17076019b 100644 --- a/samples/AvaloniaSample/Platforms/AvaloniaSample.Android/AvaloniaSample.Android.csproj +++ b/samples/AvaloniaSample/Platforms/AvaloniaSample.Android/AvaloniaSample.Android.csproj @@ -2,7 +2,7 @@ Exe - net7.0-android + net8.0-android 21 enable com.CompanyName.AvaloniaSample diff --git a/samples/AvaloniaSample/Platforms/AvaloniaSample.Desktop/AvaloniaSample.Desktop.csproj b/samples/AvaloniaSample/Platforms/AvaloniaSample.Desktop/AvaloniaSample.Desktop.csproj index 1f953cba5..dc6d174f0 100644 --- a/samples/AvaloniaSample/Platforms/AvaloniaSample.Desktop/AvaloniaSample.Desktop.csproj +++ b/samples/AvaloniaSample/Platforms/AvaloniaSample.Desktop/AvaloniaSample.Desktop.csproj @@ -4,7 +4,7 @@ WinExe - net7.0 + net8.0 enable true app.manifest diff --git a/samples/BlazorSample/BlazorSample.csproj b/samples/BlazorSample/BlazorSample.csproj index ed9deab51..92868dc7e 100644 --- a/samples/BlazorSample/BlazorSample.csproj +++ b/samples/BlazorSample/BlazorSample.csproj @@ -1,15 +1,15 @@ - net7.0 + net8.0 enable enable - 11.0 + 12.0 - - + + @@ -17,6 +17,8 @@ + + diff --git a/samples/ConsoleSample/ConsoleSample/ConsoleSample.csproj b/samples/ConsoleSample/ConsoleSample/ConsoleSample.csproj index 351ed02c3..8502622a4 100644 --- a/samples/ConsoleSample/ConsoleSample/ConsoleSample.csproj +++ b/samples/ConsoleSample/ConsoleSample/ConsoleSample.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable diff --git a/samples/EtoFormsSample/EtoFormsSample.csproj b/samples/EtoFormsSample/EtoFormsSample.csproj index 70eb3d8b4..257d96a74 100644 --- a/samples/EtoFormsSample/EtoFormsSample.csproj +++ b/samples/EtoFormsSample/EtoFormsSample.csproj @@ -8,12 +8,12 @@ WinExe - net6.0 + net8.0 - 11.0 + 12.0 diff --git a/samples/IChartEntitySample/IChartEntitySample.csproj b/samples/IChartEntitySample/IChartEntitySample.csproj index 97cbfb9af..b3f3e8d10 100644 --- a/samples/IChartEntitySample/IChartEntitySample.csproj +++ b/samples/IChartEntitySample/IChartEntitySample.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable diff --git a/samples/MappersSamples/MappersSamples.csproj b/samples/MappersSamples/MappersSamples.csproj index a35ad66bd..9df302a5e 100644 --- a/samples/MappersSamples/MappersSamples.csproj +++ b/samples/MappersSamples/MappersSamples.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable diff --git a/samples/MauiSample/AppShell.xaml.cs b/samples/MauiSample/AppShell.xaml.cs index 8c6cb7a92..094925761 100644 --- a/samples/MauiSample/AppShell.xaml.cs +++ b/samples/MauiSample/AppShell.xaml.cs @@ -3,7 +3,7 @@ public partial class AppShell : Shell { private bool _isLoaded = false; - private readonly Dictionary _routesSamples = new(); + private readonly Dictionary _routesSamples = []; public AppShell() { diff --git a/samples/MauiSample/MauiSample.csproj b/samples/MauiSample/MauiSample.csproj index 382eebb9a..248d870fc 100644 --- a/samples/MauiSample/MauiSample.csproj +++ b/samples/MauiSample/MauiSample.csproj @@ -1,10 +1,18 @@ - net7.0-android;net7.0-ios;net7.0-maccatalyst - $(TargetFrameworks);net7.0-windows10.0.19041.0 - - + net8.0-android;net8.0-ios;net8.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041.0 + + + + + + Exe MauiSample true @@ -22,12 +30,12 @@ 1.0 1 - 11.0 - 13.1 - 21.0 - 10.0.17763.0 - 10.0.17763.0 - 6.5 + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 @@ -39,7 +47,6 @@ - @@ -48,16 +55,12 @@ - - - - - - - + + + diff --git a/samples/MauiSample/Platforms/Android/MainApplication.cs b/samples/MauiSample/Platforms/Android/MainApplication.cs index 3869c13e3..314a4a2b0 100644 --- a/samples/MauiSample/Platforms/Android/MainApplication.cs +++ b/samples/MauiSample/Platforms/Android/MainApplication.cs @@ -4,13 +4,8 @@ namespace MauiSample { [Application] - public class MainApplication : MauiApplication + public class MainApplication(IntPtr handle, JniHandleOwnership ownership) : MauiApplication(handle, ownership) { - public MainApplication(IntPtr handle, JniHandleOwnership ownership) - : base(handle, ownership) - { - } - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); } } \ No newline at end of file diff --git a/samples/QuestPDFSample/QuestPDFSample.csproj b/samples/QuestPDFSample/QuestPDFSample.csproj index 3bbe728db..6c44b8e85 100644 --- a/samples/QuestPDFSample/QuestPDFSample.csproj +++ b/samples/QuestPDFSample/QuestPDFSample.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable diff --git a/samples/UWPSample/App.xaml b/samples/UWPSample/App.xaml deleted file mode 100644 index 05501df72..000000000 --- a/samples/UWPSample/App.xaml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/App.xaml.cs b/samples/UWPSample/App.xaml.cs deleted file mode 100644 index 128eb9859..000000000 --- a/samples/UWPSample/App.xaml.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using Windows.ApplicationModel; -using Windows.ApplicationModel.Activation; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; - -namespace UWPSample -{ - /// - /// Provides application-specific behavior to supplement the default Application class. - /// - sealed partial class App : Application - { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - InitializeComponent(); - Suspending += OnSuspending; - DebugSettings.EnableFrameRateCounter = true; - } - - /// - /// Invoked when the application is launched normally by the end user. Other entry points - /// will be used such as when the application is launched to open a specific file. - /// - /// Details about the launch request and process. - protected override void OnLaunched(LaunchActivatedEventArgs e) - { - var rootFrame = Window.Current.Content as Frame; - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == null) - { - // Create a Frame to act as the navigation context and navigate to the first page - rootFrame = new Frame(); - - rootFrame.NavigationFailed += OnNavigationFailed; - - if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) - { - //TODO: Load state from previously suspended application - } - - // Place the frame in the current Window - Window.Current.Content = rootFrame; - } - - if (e.PrelaunchActivated == false) - { - if (rootFrame.Content == null) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame.Navigate(typeof(MainPage), e.Arguments); - } - // Ensure the current window is active - Window.Current.Activate(); - } - } - - /// - /// Invoked when Navigation to a certain page fails - /// - /// The Frame which failed navigation - /// Details about the navigation failure - void OnNavigationFailed(object sender, NavigationFailedEventArgs e) - { - throw new Exception("Failed to load Page " + e.SourcePageType.FullName); - } - - /// - /// Invoked when application execution is being suspended. Application state is saved - /// without knowing whether the application will be terminated or resumed with the contents - /// of memory still intact. - /// - /// The source of the suspend request. - /// Details about the suspend request. - private void OnSuspending(object sender, SuspendingEventArgs e) - { - var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity - deferral.Complete(); - } - } -} diff --git a/samples/UWPSample/Assets/LockScreenLogo.scale-200.png b/samples/UWPSample/Assets/LockScreenLogo.scale-200.png deleted file mode 100644 index 735f57adb..000000000 Binary files a/samples/UWPSample/Assets/LockScreenLogo.scale-200.png and /dev/null differ diff --git a/samples/UWPSample/Assets/SplashScreen.scale-200.png b/samples/UWPSample/Assets/SplashScreen.scale-200.png deleted file mode 100644 index 023e7f1fe..000000000 Binary files a/samples/UWPSample/Assets/SplashScreen.scale-200.png and /dev/null differ diff --git a/samples/UWPSample/Assets/Square150x150Logo.scale-200.png b/samples/UWPSample/Assets/Square150x150Logo.scale-200.png deleted file mode 100644 index af49fec1a..000000000 Binary files a/samples/UWPSample/Assets/Square150x150Logo.scale-200.png and /dev/null differ diff --git a/samples/UWPSample/Assets/Square44x44Logo.scale-200.png b/samples/UWPSample/Assets/Square44x44Logo.scale-200.png deleted file mode 100644 index ce342a2ec..000000000 Binary files a/samples/UWPSample/Assets/Square44x44Logo.scale-200.png and /dev/null differ diff --git a/samples/UWPSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/samples/UWPSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index f6c02ce97..000000000 Binary files a/samples/UWPSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ diff --git a/samples/UWPSample/Assets/StoreLogo.png b/samples/UWPSample/Assets/StoreLogo.png deleted file mode 100644 index 7385b56c0..000000000 Binary files a/samples/UWPSample/Assets/StoreLogo.png and /dev/null differ diff --git a/samples/UWPSample/Assets/Wide310x150Logo.scale-200.png b/samples/UWPSample/Assets/Wide310x150Logo.scale-200.png deleted file mode 100644 index 288995b39..000000000 Binary files a/samples/UWPSample/Assets/Wide310x150Logo.scale-200.png and /dev/null differ diff --git a/samples/UWPSample/Axes/ColorsAndPosition/View.xaml b/samples/UWPSample/Axes/ColorsAndPosition/View.xaml deleted file mode 100644 index 4804acb99..000000000 --- a/samples/UWPSample/Axes/ColorsAndPosition/View.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Axes/ColorsAndPosition/View.xaml.cs b/samples/UWPSample/Axes/ColorsAndPosition/View.xaml.cs deleted file mode 100644 index beee29ef9..000000000 --- a/samples/UWPSample/Axes/ColorsAndPosition/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.ColorsAndPosition -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/CustomSeparatorsInterval/View.xaml b/samples/UWPSample/Axes/CustomSeparatorsInterval/View.xaml deleted file mode 100644 index 6cbb288ea..000000000 --- a/samples/UWPSample/Axes/CustomSeparatorsInterval/View.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Axes/CustomSeparatorsInterval/View.xaml.cs b/samples/UWPSample/Axes/CustomSeparatorsInterval/View.xaml.cs deleted file mode 100644 index fa99b10c6..000000000 --- a/samples/UWPSample/Axes/CustomSeparatorsInterval/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.CustomSeparatorsInterval -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/DateTimeScaled/View.xaml b/samples/UWPSample/Axes/DateTimeScaled/View.xaml deleted file mode 100644 index bdbd8d00b..000000000 --- a/samples/UWPSample/Axes/DateTimeScaled/View.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Axes/DateTimeScaled/View.xaml.cs b/samples/UWPSample/Axes/DateTimeScaled/View.xaml.cs deleted file mode 100644 index 4a79a5f79..000000000 --- a/samples/UWPSample/Axes/DateTimeScaled/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.DateTimeScaled -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/LabelsFormat/View.xaml b/samples/UWPSample/Axes/LabelsFormat/View.xaml deleted file mode 100644 index 87131317b..000000000 --- a/samples/UWPSample/Axes/LabelsFormat/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Axes/LabelsFormat/View.xaml.cs b/samples/UWPSample/Axes/LabelsFormat/View.xaml.cs deleted file mode 100644 index 1027b3671..000000000 --- a/samples/UWPSample/Axes/LabelsFormat/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.LabelsFormat -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/LabelsFormat2/View.xaml b/samples/UWPSample/Axes/LabelsFormat2/View.xaml deleted file mode 100644 index e2b90e573..000000000 --- a/samples/UWPSample/Axes/LabelsFormat2/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Axes/LabelsFormat2/View.xaml.cs b/samples/UWPSample/Axes/LabelsFormat2/View.xaml.cs deleted file mode 100644 index ca791d521..000000000 --- a/samples/UWPSample/Axes/LabelsFormat2/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.LabelsFormat2 -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/LabelsRotation/View.xaml b/samples/UWPSample/Axes/LabelsRotation/View.xaml deleted file mode 100644 index 86c8a9970..000000000 --- a/samples/UWPSample/Axes/LabelsRotation/View.xaml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Axes/LabelsRotation/View.xaml.cs b/samples/UWPSample/Axes/LabelsRotation/View.xaml.cs deleted file mode 100644 index c0a065e84..000000000 --- a/samples/UWPSample/Axes/LabelsRotation/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.LabelsRotation -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/Logarithmic/View.xaml b/samples/UWPSample/Axes/Logarithmic/View.xaml deleted file mode 100644 index 920385230..000000000 --- a/samples/UWPSample/Axes/Logarithmic/View.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Axes/Logarithmic/View.xaml.cs b/samples/UWPSample/Axes/Logarithmic/View.xaml.cs deleted file mode 100644 index 7ba0fb9ea..000000000 --- a/samples/UWPSample/Axes/Logarithmic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.Logarithmic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/Multiple/View.xaml b/samples/UWPSample/Axes/Multiple/View.xaml deleted file mode 100644 index a83836d85..000000000 --- a/samples/UWPSample/Axes/Multiple/View.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Axes/Multiple/View.xaml.cs b/samples/UWPSample/Axes/Multiple/View.xaml.cs deleted file mode 100644 index b64b87d90..000000000 --- a/samples/UWPSample/Axes/Multiple/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.Multiple -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/NamedLabels/View.xaml b/samples/UWPSample/Axes/NamedLabels/View.xaml deleted file mode 100644 index f0fee05a7..000000000 --- a/samples/UWPSample/Axes/NamedLabels/View.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Axes/NamedLabels/View.xaml.cs b/samples/UWPSample/Axes/NamedLabels/View.xaml.cs deleted file mode 100644 index c01f955d2..000000000 --- a/samples/UWPSample/Axes/NamedLabels/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.NamedLabels -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/Paging/View.xaml b/samples/UWPSample/Axes/Paging/View.xaml deleted file mode 100644 index 52468c754..000000000 --- a/samples/UWPSample/Axes/Paging/View.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Axes/Paging/View.xaml.cs b/samples/UWPSample/Axes/Paging/View.xaml.cs deleted file mode 100644 index 068809093..000000000 --- a/samples/UWPSample/Axes/Paging/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.Paging -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/Shared/View.xaml b/samples/UWPSample/Axes/Shared/View.xaml deleted file mode 100644 index 4cfd842a6..000000000 --- a/samples/UWPSample/Axes/Shared/View.xaml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Axes/Shared/View.xaml.cs b/samples/UWPSample/Axes/Shared/View.xaml.cs deleted file mode 100644 index 314e5c102..000000000 --- a/samples/UWPSample/Axes/Shared/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.Shared -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/Style/View.xaml b/samples/UWPSample/Axes/Style/View.xaml deleted file mode 100644 index b3305180b..000000000 --- a/samples/UWPSample/Axes/Style/View.xaml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - diff --git a/samples/UWPSample/Axes/Style/View.xaml.cs b/samples/UWPSample/Axes/Style/View.xaml.cs deleted file mode 100644 index 8a822b5c3..000000000 --- a/samples/UWPSample/Axes/Style/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.Style -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Axes/TimeSpanScaled/View.xaml b/samples/UWPSample/Axes/TimeSpanScaled/View.xaml deleted file mode 100644 index 534c91ef8..000000000 --- a/samples/UWPSample/Axes/TimeSpanScaled/View.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Axes/TimeSpanScaled/View.xaml.cs b/samples/UWPSample/Axes/TimeSpanScaled/View.xaml.cs deleted file mode 100644 index 784fe927b..000000000 --- a/samples/UWPSample/Axes/TimeSpanScaled/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Axes.TimeSpanScaled -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Bars/AutoUpdate/View.xaml b/samples/UWPSample/Bars/AutoUpdate/View.xaml deleted file mode 100644 index e29f8d895..000000000 --- a/samples/UWPSample/Bars/AutoUpdate/View.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Bars/AutoUpdate/View.xaml.cs b/samples/UWPSample/Bars/AutoUpdate/View.xaml.cs deleted file mode 100644 index 7f52bc12d..000000000 --- a/samples/UWPSample/Bars/AutoUpdate/View.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Threading.Tasks; -using ViewModelsSamples.Bars.AutoUpdate; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; - -namespace UWPSample.Bars.AutoUpdate -{ - public sealed partial class View : UserControl - { - private bool? _isStreaming = false; - - public View() - { - InitializeComponent(); - } - - private async void Button_PointerPressed(object sender, PointerRoutedEventArgs e) - { - var vm = (ViewModel)DataContext; - _isStreaming = _isStreaming is null ? true : !_isStreaming; - - while (_isStreaming.Value) - { - vm.RemoveItem(); - vm.AddItem(); - await Task.Delay(1000); - } - } - } -} diff --git a/samples/UWPSample/Bars/Basic/View.xaml b/samples/UWPSample/Bars/Basic/View.xaml deleted file mode 100644 index 369d30e5f..000000000 --- a/samples/UWPSample/Bars/Basic/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Bars/Basic/View.xaml.cs b/samples/UWPSample/Bars/Basic/View.xaml.cs deleted file mode 100644 index 41969405b..000000000 --- a/samples/UWPSample/Bars/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Bars.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Bars/Custom/View.xaml b/samples/UWPSample/Bars/Custom/View.xaml deleted file mode 100644 index ea7360eba..000000000 --- a/samples/UWPSample/Bars/Custom/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Bars/Custom/View.xaml.cs b/samples/UWPSample/Bars/Custom/View.xaml.cs deleted file mode 100644 index 769296eeb..000000000 --- a/samples/UWPSample/Bars/Custom/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Bars.Custom -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Bars/DelayedAnimation/View.xaml b/samples/UWPSample/Bars/DelayedAnimation/View.xaml deleted file mode 100644 index bf2422e05..000000000 --- a/samples/UWPSample/Bars/DelayedAnimation/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Bars/DelayedAnimation/View.xaml.cs b/samples/UWPSample/Bars/DelayedAnimation/View.xaml.cs deleted file mode 100644 index 0df43a739..000000000 --- a/samples/UWPSample/Bars/DelayedAnimation/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Bars.DelayedAnimation -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Bars/Layered/View.xaml b/samples/UWPSample/Bars/Layered/View.xaml deleted file mode 100644 index 1f1c8ef56..000000000 --- a/samples/UWPSample/Bars/Layered/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Bars/Layered/View.xaml.cs b/samples/UWPSample/Bars/Layered/View.xaml.cs deleted file mode 100644 index efbc531d9..000000000 --- a/samples/UWPSample/Bars/Layered/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Bars.Layered -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Bars/Race/View.xaml b/samples/UWPSample/Bars/Race/View.xaml deleted file mode 100644 index 8f270db12..000000000 --- a/samples/UWPSample/Bars/Race/View.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - diff --git a/samples/UWPSample/Bars/Race/View.xaml.cs b/samples/UWPSample/Bars/Race/View.xaml.cs deleted file mode 100644 index 2b3f96e2e..000000000 --- a/samples/UWPSample/Bars/Race/View.xaml.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Threading.Tasks; -using ViewModelsSamples.Bars.Race; -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Bars.Race -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Bars/RowsWithLabels/View.xaml b/samples/UWPSample/Bars/RowsWithLabels/View.xaml deleted file mode 100644 index 6b1d329bf..000000000 --- a/samples/UWPSample/Bars/RowsWithLabels/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Bars/RowsWithLabels/View.xaml.cs b/samples/UWPSample/Bars/RowsWithLabels/View.xaml.cs deleted file mode 100644 index e6a801e2f..000000000 --- a/samples/UWPSample/Bars/RowsWithLabels/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Bars.RowsWithLabels -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Bars/Spacing/View.xaml b/samples/UWPSample/Bars/Spacing/View.xaml deleted file mode 100644 index d7c97ddd3..000000000 --- a/samples/UWPSample/Bars/Spacing/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Bars/Spacing/View.xaml.cs b/samples/UWPSample/Bars/Spacing/View.xaml.cs deleted file mode 100644 index c77b0cb0a..000000000 --- a/samples/UWPSample/Bars/Spacing/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Bars.Spacing -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Bars/WithBackground/View.xaml b/samples/UWPSample/Bars/WithBackground/View.xaml deleted file mode 100644 index d222299c8..000000000 --- a/samples/UWPSample/Bars/WithBackground/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Bars/WithBackground/View.xaml.cs b/samples/UWPSample/Bars/WithBackground/View.xaml.cs deleted file mode 100644 index 9d5731d9f..000000000 --- a/samples/UWPSample/Bars/WithBackground/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Bars.WithBackground -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Box/Basic/View.xaml b/samples/UWPSample/Box/Basic/View.xaml deleted file mode 100644 index 5cc75b8d9..000000000 --- a/samples/UWPSample/Box/Basic/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Box/Basic/View.xaml.cs b/samples/UWPSample/Box/Basic/View.xaml.cs deleted file mode 100644 index ee80c35ff..000000000 --- a/samples/UWPSample/Box/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Box.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Design/LinearGradients/View.xaml b/samples/UWPSample/Design/LinearGradients/View.xaml deleted file mode 100644 index 58c8a0a10..000000000 --- a/samples/UWPSample/Design/LinearGradients/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Design/LinearGradients/View.xaml.cs b/samples/UWPSample/Design/LinearGradients/View.xaml.cs deleted file mode 100644 index 5f7f88c58..000000000 --- a/samples/UWPSample/Design/LinearGradients/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Design.LinearGradients -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Design/RadialGradients/View.xaml b/samples/UWPSample/Design/RadialGradients/View.xaml deleted file mode 100644 index 93a11d42c..000000000 --- a/samples/UWPSample/Design/RadialGradients/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Design/RadialGradients/View.xaml.cs b/samples/UWPSample/Design/RadialGradients/View.xaml.cs deleted file mode 100644 index ec4160ab0..000000000 --- a/samples/UWPSample/Design/RadialGradients/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Design.RadialGradients -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Design/StrokeDashArray/View.xaml b/samples/UWPSample/Design/StrokeDashArray/View.xaml deleted file mode 100644 index d6348a13d..000000000 --- a/samples/UWPSample/Design/StrokeDashArray/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Design/StrokeDashArray/View.xaml.cs b/samples/UWPSample/Design/StrokeDashArray/View.xaml.cs deleted file mode 100644 index 9568b823e..000000000 --- a/samples/UWPSample/Design/StrokeDashArray/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Design.StrokeDashArray -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Error/Basic/View.xaml b/samples/UWPSample/Error/Basic/View.xaml deleted file mode 100644 index 600f8154a..000000000 --- a/samples/UWPSample/Error/Basic/View.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Error/Basic/View.xaml.cs b/samples/UWPSample/Error/Basic/View.xaml.cs deleted file mode 100644 index 0ed4fddbf..000000000 --- a/samples/UWPSample/Error/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Error.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Events/AddPointOnClick/View.xaml b/samples/UWPSample/Events/AddPointOnClick/View.xaml deleted file mode 100644 index 5cc3dc619..000000000 --- a/samples/UWPSample/Events/AddPointOnClick/View.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - diff --git a/samples/UWPSample/Events/AddPointOnClick/View.xaml.cs b/samples/UWPSample/Events/AddPointOnClick/View.xaml.cs deleted file mode 100644 index 69f20ac94..000000000 --- a/samples/UWPSample/Events/AddPointOnClick/View.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using LiveChartsCore.Defaults; -using LiveChartsCore.Drawing; -using ViewModelsSamples.Events.AddPointOnClick; -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Events.AddPointOnClick -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Events/Cartesian/View.xaml b/samples/UWPSample/Events/Cartesian/View.xaml deleted file mode 100644 index fa434e52a..000000000 --- a/samples/UWPSample/Events/Cartesian/View.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/samples/UWPSample/Events/Cartesian/View.xaml.cs b/samples/UWPSample/Events/Cartesian/View.xaml.cs deleted file mode 100644 index 41ab4c8c2..000000000 --- a/samples/UWPSample/Events/Cartesian/View.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; -using LiveChartsCore.Kernel; -using LiveChartsCore.Kernel.Sketches; -using ViewModelsSamples.Events.Cartesian; -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Events.Cartesian -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Events/Pie/View.xaml b/samples/UWPSample/Events/Pie/View.xaml deleted file mode 100644 index e1bb37535..000000000 --- a/samples/UWPSample/Events/Pie/View.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - diff --git a/samples/UWPSample/Events/Pie/View.xaml.cs b/samples/UWPSample/Events/Pie/View.xaml.cs deleted file mode 100644 index a849b73bc..000000000 --- a/samples/UWPSample/Events/Pie/View.xaml.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; -using LiveChartsCore.Kernel; -using LiveChartsCore.Kernel.Sketches; -using ViewModelsSamples.Events.Pie; -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Events.Pie -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - - private void Chart_DataPointerDown( - IChartView chart, - IEnumerable points) - { - // notice in the chart event we are not able to use strongly typed points - // but we can cast the point.Context.DataSource to the actual type. - - foreach (var point in points) - { - if (point.Context.DataSource is City city) - { - Trace.WriteLine($"[chart.dataPointerDownEvent] clicked on {city.Name}"); - continue; - } - - if (point.Context.DataSource is int integer) - { - Trace.WriteLine($"[chart.dataPointerDownEvent] clicked on number {integer}"); - continue; - } - - // handle more possible types here... - // if (point.Context.DataSource is Foo foo) - // { - // ... - // } - } - } - } -} diff --git a/samples/UWPSample/Events/Polar/View.xaml b/samples/UWPSample/Events/Polar/View.xaml deleted file mode 100644 index bfd578f8c..000000000 --- a/samples/UWPSample/Events/Polar/View.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Events/Polar/View.xaml.cs b/samples/UWPSample/Events/Polar/View.xaml.cs deleted file mode 100644 index 082937300..000000000 --- a/samples/UWPSample/Events/Polar/View.xaml.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; -using LiveChartsCore.Kernel; -using LiveChartsCore.Kernel.Sketches; -using ViewModelsSamples.Events.Polar; -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Events.Polar -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - - private void Chart_DataPointerDown( - IChartView chart, - IEnumerable points) - { - // notice in the chart event we are not able to use strongly typed points - // but we can cast the point.Context.DataSource to the actual type. - - foreach (var point in points) - { - if (point.Context.DataSource is City city) - { - Trace.WriteLine($"[chart.dataPointerDownEvent] clicked on {city.Name}"); - continue; - } - - if (point.Context.DataSource is int integer) - { - Trace.WriteLine($"[chart.dataPointerDownEvent] clicked on number {integer}"); - continue; - } - - // handle more possible types here... - // if (point.Context.DataSource is Foo foo) - // { - // ... - // } - } - } - } -} diff --git a/samples/UWPSample/Financial/BasicCandlesticks/View.xaml b/samples/UWPSample/Financial/BasicCandlesticks/View.xaml deleted file mode 100644 index 64b62703b..000000000 --- a/samples/UWPSample/Financial/BasicCandlesticks/View.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/samples/UWPSample/Financial/BasicCandlesticks/View.xaml.cs b/samples/UWPSample/Financial/BasicCandlesticks/View.xaml.cs deleted file mode 100644 index 01d57bbc6..000000000 --- a/samples/UWPSample/Financial/BasicCandlesticks/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Financial.BasicCandlesticks -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/Animations/View.xaml b/samples/UWPSample/General/Animations/View.xaml deleted file mode 100644 index 9122b81e4..000000000 --- a/samples/UWPSample/General/Animations/View.xaml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/Animations/View.xaml.cs b/samples/UWPSample/General/Animations/View.xaml.cs deleted file mode 100644 index 14a93e4bb..000000000 --- a/samples/UWPSample/General/Animations/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.Animations -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/ChartToImage/View.xaml b/samples/UWPSample/General/ChartToImage/View.xaml deleted file mode 100644 index 41876a400..000000000 --- a/samples/UWPSample/General/ChartToImage/View.xaml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/ChartToImage/View.xaml.cs b/samples/UWPSample/General/ChartToImage/View.xaml.cs deleted file mode 100644 index cc81ae5e2..000000000 --- a/samples/UWPSample/General/ChartToImage/View.xaml.cs +++ /dev/null @@ -1,48 +0,0 @@ -using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.SkiaSharpView.Uno; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.ChartToImage -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - - // in this case, when the view is loaded // mark - // we render our chart controls as images // mark - Loaded += View_Loaded; - } - - private void View_Loaded(object sender, RoutedEventArgs e) - { - CreateImageFromCartesianControl(); - CreateImageFromPieControl(); - CreateImageFromGeoControl(); - } - - private void CreateImageFromCartesianControl() - { - // you can take any chart in the UI, and build an image from it // mark - var chartControl = (CartesianChart)FindName("cartesianChart"); - var skChart = new SKCartesianChart(chartControl) { Width = 900, Height = 600, }; - skChart.SaveImage("CartesianImageFromControl.png"); - } - - private void CreateImageFromPieControl() - { - var chartControl = (PieChart)FindName("pieChart"); - var skChart = new SKPieChart(chartControl) { Width = 900, Height = 600, }; - skChart.SaveImage("PieImageFromControl.png"); - } - - private void CreateImageFromGeoControl() - { - var chartControl = (GeoMap)FindName("geoChart"); - var skChart = new SKGeoMap(chartControl) { Width = 900, Height = 600, }; - skChart.SaveImage("MapImageFromControl.png"); - } - } -} diff --git a/samples/UWPSample/General/ConditionalDraw/View.xaml b/samples/UWPSample/General/ConditionalDraw/View.xaml deleted file mode 100644 index 1201ca655..000000000 --- a/samples/UWPSample/General/ConditionalDraw/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/General/ConditionalDraw/View.xaml.cs b/samples/UWPSample/General/ConditionalDraw/View.xaml.cs deleted file mode 100644 index 51d018186..000000000 --- a/samples/UWPSample/General/ConditionalDraw/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.ConditionalDraw -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/DrawOnCanvas/View.xaml b/samples/UWPSample/General/DrawOnCanvas/View.xaml deleted file mode 100644 index 2dcc40312..000000000 --- a/samples/UWPSample/General/DrawOnCanvas/View.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - diff --git a/samples/UWPSample/General/DrawOnCanvas/View.xaml.cs b/samples/UWPSample/General/DrawOnCanvas/View.xaml.cs deleted file mode 100644 index 44b3ab187..000000000 --- a/samples/UWPSample/General/DrawOnCanvas/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.DrawOnCanvas -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/Legends/View.xaml b/samples/UWPSample/General/Legends/View.xaml deleted file mode 100644 index 20ecb887c..000000000 --- a/samples/UWPSample/General/Legends/View.xaml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/Legends/View.xaml.cs b/samples/UWPSample/General/Legends/View.xaml.cs deleted file mode 100644 index 7ed418b30..000000000 --- a/samples/UWPSample/General/Legends/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.Legends -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/MapPoints/View.xaml b/samples/UWPSample/General/MapPoints/View.xaml deleted file mode 100644 index 5af09a397..000000000 --- a/samples/UWPSample/General/MapPoints/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/samples/UWPSample/General/MapPoints/View.xaml.cs b/samples/UWPSample/General/MapPoints/View.xaml.cs deleted file mode 100644 index c96377c5e..000000000 --- a/samples/UWPSample/General/MapPoints/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.MapPoints -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/MultiThreading/View.xaml b/samples/UWPSample/General/MultiThreading/View.xaml deleted file mode 100644 index bf5bd247c..000000000 --- a/samples/UWPSample/General/MultiThreading/View.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/samples/UWPSample/General/MultiThreading/View.xaml.cs b/samples/UWPSample/General/MultiThreading/View.xaml.cs deleted file mode 100644 index cb67c6c4d..000000000 --- a/samples/UWPSample/General/MultiThreading/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.MultiThreading -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/MultiThreading2/View.xaml b/samples/UWPSample/General/MultiThreading2/View.xaml deleted file mode 100644 index 7b1a97168..000000000 --- a/samples/UWPSample/General/MultiThreading2/View.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/General/MultiThreading2/View.xaml.cs b/samples/UWPSample/General/MultiThreading2/View.xaml.cs deleted file mode 100644 index f8bfaed9f..000000000 --- a/samples/UWPSample/General/MultiThreading2/View.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Windows.ApplicationModel.Core; -using Windows.UI.Core; -using Windows.UI.Xaml.Controls; -using ViewModelsSamples.General.MultiThreading2; - -namespace UWPSample.General.MultiThreading2 -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - - var vm = new ViewModel(InvokeOnUIThread); - DataContext = vm; - } - - // this method takes another function as an argument. - // the idea is that we are invoking the passed action in the UI thread - // but the UI framework will let the view model how to do this. - // we will pass the InvokeOnUIThread method to our view model so the view model knows how - // to invoke an action in the UI thred. - private void InvokeOnUIThread(Action action) - { - _ = CoreApplication.MainView.CoreWindow.Dispatcher - .RunAsync(CoreDispatcherPriority.High, () => action()); - } - } -} diff --git a/samples/UWPSample/General/NullPoints/View.xaml b/samples/UWPSample/General/NullPoints/View.xaml deleted file mode 100644 index 2acee9f05..000000000 --- a/samples/UWPSample/General/NullPoints/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/General/NullPoints/View.xaml.cs b/samples/UWPSample/General/NullPoints/View.xaml.cs deleted file mode 100644 index 162f57ae9..000000000 --- a/samples/UWPSample/General/NullPoints/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.NullPoints -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/RealTime/View.xaml b/samples/UWPSample/General/RealTime/View.xaml deleted file mode 100644 index 0d381b9cb..000000000 --- a/samples/UWPSample/General/RealTime/View.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - diff --git a/samples/UWPSample/General/RealTime/View.xaml.cs b/samples/UWPSample/General/RealTime/View.xaml.cs deleted file mode 100644 index 7f01b5516..000000000 --- a/samples/UWPSample/General/RealTime/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.RealTime -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/Scrollable/View.xaml b/samples/UWPSample/General/Scrollable/View.xaml deleted file mode 100644 index ddaa0b98a..000000000 --- a/samples/UWPSample/General/Scrollable/View.xaml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/Scrollable/View.xaml.cs b/samples/UWPSample/General/Scrollable/View.xaml.cs deleted file mode 100644 index 7378c9053..000000000 --- a/samples/UWPSample/General/Scrollable/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.Scrollable -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/Sections/View.xaml b/samples/UWPSample/General/Sections/View.xaml deleted file mode 100644 index 132a1144c..000000000 --- a/samples/UWPSample/General/Sections/View.xaml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/Sections/View.xaml.cs b/samples/UWPSample/General/Sections/View.xaml.cs deleted file mode 100644 index b77603c4c..000000000 --- a/samples/UWPSample/General/Sections/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.Sections -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/Sections2/View.xaml b/samples/UWPSample/General/Sections2/View.xaml deleted file mode 100644 index 1484d0c40..000000000 --- a/samples/UWPSample/General/Sections2/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/samples/UWPSample/General/Sections2/View.xaml.cs b/samples/UWPSample/General/Sections2/View.xaml.cs deleted file mode 100644 index 0b97e9bd5..000000000 --- a/samples/UWPSample/General/Sections2/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.Sections2 -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/TemplatedLegends/View.xaml b/samples/UWPSample/General/TemplatedLegends/View.xaml deleted file mode 100644 index 425190e61..000000000 --- a/samples/UWPSample/General/TemplatedLegends/View.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/TemplatedLegends/View.xaml.cs b/samples/UWPSample/General/TemplatedLegends/View.xaml.cs deleted file mode 100644 index c849d52e7..000000000 --- a/samples/UWPSample/General/TemplatedLegends/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.TemplatedLegends -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/TemplatedTooltips/View.xaml b/samples/UWPSample/General/TemplatedTooltips/View.xaml deleted file mode 100644 index 72e4a74fc..000000000 --- a/samples/UWPSample/General/TemplatedTooltips/View.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/TemplatedTooltips/View.xaml.cs b/samples/UWPSample/General/TemplatedTooltips/View.xaml.cs deleted file mode 100644 index 189ece5b6..000000000 --- a/samples/UWPSample/General/TemplatedTooltips/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.TemplatedTooltips -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/Tooltips/View.xaml b/samples/UWPSample/General/Tooltips/View.xaml deleted file mode 100644 index d0545e202..000000000 --- a/samples/UWPSample/General/Tooltips/View.xaml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/Tooltips/View.xaml.cs b/samples/UWPSample/General/Tooltips/View.xaml.cs deleted file mode 100644 index 1894f6c64..000000000 --- a/samples/UWPSample/General/Tooltips/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.Tooltips -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/UserDefinedTypes/View.xaml b/samples/UWPSample/General/UserDefinedTypes/View.xaml deleted file mode 100644 index 452b43d76..000000000 --- a/samples/UWPSample/General/UserDefinedTypes/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/General/UserDefinedTypes/View.xaml.cs b/samples/UWPSample/General/UserDefinedTypes/View.xaml.cs deleted file mode 100644 index aab53191a..000000000 --- a/samples/UWPSample/General/UserDefinedTypes/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.UserDefinedTypes -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/Visibility/View.xaml b/samples/UWPSample/General/Visibility/View.xaml deleted file mode 100644 index 415b38182..000000000 --- a/samples/UWPSample/General/Visibility/View.xaml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/General/Visibility/View.xaml.cs b/samples/UWPSample/General/Visibility/View.xaml.cs deleted file mode 100644 index 8cf5bda3b..000000000 --- a/samples/UWPSample/General/Visibility/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.Visibility -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/General/VisualElements/View.xaml b/samples/UWPSample/General/VisualElements/View.xaml deleted file mode 100644 index 6ffd2b714..000000000 --- a/samples/UWPSample/General/VisualElements/View.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - diff --git a/samples/UWPSample/General/VisualElements/View.xaml.cs b/samples/UWPSample/General/VisualElements/View.xaml.cs deleted file mode 100644 index 49e931815..000000000 --- a/samples/UWPSample/General/VisualElements/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.General.VisualElements -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Heat/Basic/View.xaml b/samples/UWPSample/Heat/Basic/View.xaml deleted file mode 100644 index 7c7e1e71e..000000000 --- a/samples/UWPSample/Heat/Basic/View.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - diff --git a/samples/UWPSample/Heat/Basic/View.xaml.cs b/samples/UWPSample/Heat/Basic/View.xaml.cs deleted file mode 100644 index 18fd35778..000000000 --- a/samples/UWPSample/Heat/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Heat.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Lines/Area/View.xaml b/samples/UWPSample/Lines/Area/View.xaml deleted file mode 100644 index d9182521a..000000000 --- a/samples/UWPSample/Lines/Area/View.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Lines/Area/View.xaml.cs b/samples/UWPSample/Lines/Area/View.xaml.cs deleted file mode 100644 index a100a5b89..000000000 --- a/samples/UWPSample/Lines/Area/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Lines.Area -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Lines/AutoUpdate/View.xaml b/samples/UWPSample/Lines/AutoUpdate/View.xaml deleted file mode 100644 index 3adc8529b..000000000 --- a/samples/UWPSample/Lines/AutoUpdate/View.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Lines/AutoUpdate/View.xaml.cs b/samples/UWPSample/Lines/AutoUpdate/View.xaml.cs deleted file mode 100644 index ced51531d..000000000 --- a/samples/UWPSample/Lines/AutoUpdate/View.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Threading.Tasks; -using ViewModelsSamples.Lines.AutoUpdate; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; - -namespace UWPSample.Lines.AutoUpdate -{ - public sealed partial class View : UserControl - { - private bool? _isStreaming = false; - - public View() - { - InitializeComponent(); - } - - private async void Button_PointerPressed(object sender, PointerRoutedEventArgs e) - { - var vm = (ViewModel)DataContext; - _isStreaming = _isStreaming is null ? true : !_isStreaming; - - while (_isStreaming.Value) - { - vm.RemoveItem(); - vm.AddItem(); - await Task.Delay(1000); - } - } - } -} diff --git a/samples/UWPSample/Lines/Basic/View.xaml b/samples/UWPSample/Lines/Basic/View.xaml deleted file mode 100644 index 29f25918e..000000000 --- a/samples/UWPSample/Lines/Basic/View.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Lines/Basic/View.xaml.cs b/samples/UWPSample/Lines/Basic/View.xaml.cs deleted file mode 100644 index 6083b7b98..000000000 --- a/samples/UWPSample/Lines/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Lines.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Lines/Custom/View.xaml b/samples/UWPSample/Lines/Custom/View.xaml deleted file mode 100644 index b201b8aae..000000000 --- a/samples/UWPSample/Lines/Custom/View.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Lines/Custom/View.xaml.cs b/samples/UWPSample/Lines/Custom/View.xaml.cs deleted file mode 100644 index cf95d6bb3..000000000 --- a/samples/UWPSample/Lines/Custom/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Lines.Custom -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Lines/Padding/View.xaml b/samples/UWPSample/Lines/Padding/View.xaml deleted file mode 100644 index bfde8f55e..000000000 --- a/samples/UWPSample/Lines/Padding/View.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/samples/UWPSample/Lines/Padding/View.xaml.cs b/samples/UWPSample/Lines/Padding/View.xaml.cs deleted file mode 100644 index 08750030d..000000000 --- a/samples/UWPSample/Lines/Padding/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Lines.Padding -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Lines/Properties/View.xaml b/samples/UWPSample/Lines/Properties/View.xaml deleted file mode 100644 index b0de713a5..000000000 --- a/samples/UWPSample/Lines/Properties/View.xaml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Lines/Properties/View.xaml.cs b/samples/UWPSample/Lines/Properties/View.xaml.cs deleted file mode 100644 index cf9548ced..000000000 --- a/samples/UWPSample/Lines/Properties/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Lines.Properties -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Lines/Straight/View.xaml b/samples/UWPSample/Lines/Straight/View.xaml deleted file mode 100644 index d11d5a403..000000000 --- a/samples/UWPSample/Lines/Straight/View.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Lines/Straight/View.xaml.cs b/samples/UWPSample/Lines/Straight/View.xaml.cs deleted file mode 100644 index fdd7002a4..000000000 --- a/samples/UWPSample/Lines/Straight/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Lines.Straight -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Lines/XY/View.xaml b/samples/UWPSample/Lines/XY/View.xaml deleted file mode 100644 index 49cb6ed1f..000000000 --- a/samples/UWPSample/Lines/XY/View.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Lines/XY/View.xaml.cs b/samples/UWPSample/Lines/XY/View.xaml.cs deleted file mode 100644 index ae824f1e9..000000000 --- a/samples/UWPSample/Lines/XY/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Lines.XY -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Lines/Zoom/View.xaml b/samples/UWPSample/Lines/Zoom/View.xaml deleted file mode 100644 index 6bfdcbc43..000000000 --- a/samples/UWPSample/Lines/Zoom/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/samples/UWPSample/Lines/Zoom/View.xaml.cs b/samples/UWPSample/Lines/Zoom/View.xaml.cs deleted file mode 100644 index 6be2c4f30..000000000 --- a/samples/UWPSample/Lines/Zoom/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Lines.Zoom -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/MainPage.xaml b/samples/UWPSample/MainPage.xaml deleted file mode 100644 index ee657a044..000000000 --- a/samples/UWPSample/MainPage.xaml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/MainPage.xaml.cs b/samples/UWPSample/MainPage.xaml.cs deleted file mode 100644 index b52e17309..000000000 --- a/samples/UWPSample/MainPage.xaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; - -namespace UWPSample -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class MainPage : Page - { - public MainPage() - { - InitializeComponent(); - - Samples = ViewModelsSamples.Index.Samples; - grid.DataContext = this; - } - - public string[] Samples { get; set; } - - private void Border_PointerPressed(object sender, PointerRoutedEventArgs e) - { - var ctx = (string)((FrameworkElement)sender).DataContext; - - var t = Type.GetType($"UWPSample.{ctx.Replace('/', '.')}.View"); - content.Content = Activator.CreateInstance(t); - } - } -} diff --git a/samples/UWPSample/Maps/World/View.xaml b/samples/UWPSample/Maps/World/View.xaml deleted file mode 100644 index 103055443..000000000 --- a/samples/UWPSample/Maps/World/View.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Maps/World/View.xaml.cs b/samples/UWPSample/Maps/World/View.xaml.cs deleted file mode 100644 index df54b1cc8..000000000 --- a/samples/UWPSample/Maps/World/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Maps.World -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Package.appxmanifest b/samples/UWPSample/Package.appxmanifest deleted file mode 100644 index 8025d91d9..000000000 --- a/samples/UWPSample/Package.appxmanifest +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - UWPSample - btord - Assets\StoreLogo.png - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/UWPSample/Pies/AngularGauge/View.xaml b/samples/UWPSample/Pies/AngularGauge/View.xaml deleted file mode 100644 index 1fe9bf839..000000000 --- a/samples/UWPSample/Pies/AngularGauge/View.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Pies/AngularGauge/View.xaml.cs b/samples/UWPSample/Pies/AngularGauge/View.xaml.cs deleted file mode 100644 index ceb43e466..000000000 --- a/samples/UWPSample/Pies/AngularGauge/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.AngularGauge -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/AutoUpdate/View.xaml b/samples/UWPSample/Pies/AutoUpdate/View.xaml deleted file mode 100644 index c48914379..000000000 --- a/samples/UWPSample/Pies/AutoUpdate/View.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Pies/AutoUpdate/View.xaml.cs b/samples/UWPSample/Pies/AutoUpdate/View.xaml.cs deleted file mode 100644 index d2d7cb9c2..000000000 --- a/samples/UWPSample/Pies/AutoUpdate/View.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Threading.Tasks; -using ViewModelsSamples.Pies.AutoUpdate; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; - -namespace UWPSample.Pies.AutoUpdate -{ - public sealed partial class View : UserControl - { - private bool? _isStreaming = false; - - public View() - { - InitializeComponent(); - } - - private async void Button_PointerPressed(object sender, PointerRoutedEventArgs e) - { - var vm = (ViewModel)DataContext; - _isStreaming = _isStreaming is null ? true : !_isStreaming; - - while (_isStreaming.Value) - { - vm.RemoveSeries(); - vm.AddSeries(); - await Task.Delay(1000); - } - } - } -} diff --git a/samples/UWPSample/Pies/Basic/View.xaml b/samples/UWPSample/Pies/Basic/View.xaml deleted file mode 100644 index 405136fc0..000000000 --- a/samples/UWPSample/Pies/Basic/View.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Pies/Basic/View.xaml.cs b/samples/UWPSample/Pies/Basic/View.xaml.cs deleted file mode 100644 index 896c5890d..000000000 --- a/samples/UWPSample/Pies/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Custom/View.xaml b/samples/UWPSample/Pies/Custom/View.xaml deleted file mode 100644 index 6be0bfeea..000000000 --- a/samples/UWPSample/Pies/Custom/View.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Pies/Custom/View.xaml.cs b/samples/UWPSample/Pies/Custom/View.xaml.cs deleted file mode 100644 index 87c6165fd..000000000 --- a/samples/UWPSample/Pies/Custom/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Custom -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Doughnut/View.xaml b/samples/UWPSample/Pies/Doughnut/View.xaml deleted file mode 100644 index a19d220c6..000000000 --- a/samples/UWPSample/Pies/Doughnut/View.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - diff --git a/samples/UWPSample/Pies/Doughnut/View.xaml.cs b/samples/UWPSample/Pies/Doughnut/View.xaml.cs deleted file mode 100644 index 23bad9abe..000000000 --- a/samples/UWPSample/Pies/Doughnut/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Doughnut -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Gauge/View.xaml b/samples/UWPSample/Pies/Gauge/View.xaml deleted file mode 100644 index 03763f715..000000000 --- a/samples/UWPSample/Pies/Gauge/View.xaml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Pies/Gauge/View.xaml.cs b/samples/UWPSample/Pies/Gauge/View.xaml.cs deleted file mode 100644 index 1a4b12385..000000000 --- a/samples/UWPSample/Pies/Gauge/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Gauge -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Gauge1/View.xaml b/samples/UWPSample/Pies/Gauge1/View.xaml deleted file mode 100644 index 40f25e97a..000000000 --- a/samples/UWPSample/Pies/Gauge1/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Pies/Gauge1/View.xaml.cs b/samples/UWPSample/Pies/Gauge1/View.xaml.cs deleted file mode 100644 index 229b8fc63..000000000 --- a/samples/UWPSample/Pies/Gauge1/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Gauge1 -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Gauge2/View.xaml b/samples/UWPSample/Pies/Gauge2/View.xaml deleted file mode 100644 index aa151def7..000000000 --- a/samples/UWPSample/Pies/Gauge2/View.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Pies/Gauge2/View.xaml.cs b/samples/UWPSample/Pies/Gauge2/View.xaml.cs deleted file mode 100644 index 275f62e74..000000000 --- a/samples/UWPSample/Pies/Gauge2/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Gauge2 -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Gauge3/View.xaml b/samples/UWPSample/Pies/Gauge3/View.xaml deleted file mode 100644 index 714b91f34..000000000 --- a/samples/UWPSample/Pies/Gauge3/View.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Pies/Gauge3/View.xaml.cs b/samples/UWPSample/Pies/Gauge3/View.xaml.cs deleted file mode 100644 index dd1235675..000000000 --- a/samples/UWPSample/Pies/Gauge3/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Gauge3 -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Gauge4/View.xaml b/samples/UWPSample/Pies/Gauge4/View.xaml deleted file mode 100644 index 6900c1550..000000000 --- a/samples/UWPSample/Pies/Gauge4/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Pies/Gauge4/View.xaml.cs b/samples/UWPSample/Pies/Gauge4/View.xaml.cs deleted file mode 100644 index f0b2abfbd..000000000 --- a/samples/UWPSample/Pies/Gauge4/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Gauge4 -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Gauge5/View.xaml b/samples/UWPSample/Pies/Gauge5/View.xaml deleted file mode 100644 index 00a580e78..000000000 --- a/samples/UWPSample/Pies/Gauge5/View.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Pies/Gauge5/View.xaml.cs b/samples/UWPSample/Pies/Gauge5/View.xaml.cs deleted file mode 100644 index c7f1a126b..000000000 --- a/samples/UWPSample/Pies/Gauge5/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Gauge5 -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Gauges/View.xaml b/samples/UWPSample/Pies/Gauges/View.xaml deleted file mode 100644 index 5fa8bb934..000000000 --- a/samples/UWPSample/Pies/Gauges/View.xaml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Pies/Gauges/View.xaml.cs b/samples/UWPSample/Pies/Gauges/View.xaml.cs deleted file mode 100644 index d5dce6a75..000000000 --- a/samples/UWPSample/Pies/Gauges/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Gauges -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/NightingaleRose/View.xaml b/samples/UWPSample/Pies/NightingaleRose/View.xaml deleted file mode 100644 index df19a8278..000000000 --- a/samples/UWPSample/Pies/NightingaleRose/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Pies/NightingaleRose/View.xaml.cs b/samples/UWPSample/Pies/NightingaleRose/View.xaml.cs deleted file mode 100644 index 853584a62..000000000 --- a/samples/UWPSample/Pies/NightingaleRose/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.NightingaleRose -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/OutLabels/View.xaml b/samples/UWPSample/Pies/OutLabels/View.xaml deleted file mode 100644 index de71ca8f8..000000000 --- a/samples/UWPSample/Pies/OutLabels/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/samples/UWPSample/Pies/OutLabels/View.xaml.cs b/samples/UWPSample/Pies/OutLabels/View.xaml.cs deleted file mode 100644 index d2e45f45d..000000000 --- a/samples/UWPSample/Pies/OutLabels/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.OutLabels -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Pies/Processing/View.xaml b/samples/UWPSample/Pies/Processing/View.xaml deleted file mode 100644 index c0c350455..000000000 --- a/samples/UWPSample/Pies/Processing/View.xaml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Pies/Processing/View.xaml.cs b/samples/UWPSample/Pies/Processing/View.xaml.cs deleted file mode 100644 index 5d8d0892e..000000000 --- a/samples/UWPSample/Pies/Processing/View.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using LiveChartsCore.SkiaSharpView.Painting; -using Windows.UI; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Media; - -namespace UWPSample.Pies.Processing -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } - - public class PaintTaskToBrushConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, string language) - { - return value is SolidColorPaint solidColor - ? new SolidColorBrush( - Color.FromArgb( - solidColor.Color.Alpha, - solidColor.Color.Red, - solidColor.Color.Green, - solidColor.Color.Blue)) - : null; - } - - public object ConvertBack(object value, Type targetType, object parameter, string language) - { - throw new NotImplementedException(); - } - } -} diff --git a/samples/UWPSample/Pies/Pushout/View.xaml b/samples/UWPSample/Pies/Pushout/View.xaml deleted file mode 100644 index b0931adb6..000000000 --- a/samples/UWPSample/Pies/Pushout/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Pies/Pushout/View.xaml.cs b/samples/UWPSample/Pies/Pushout/View.xaml.cs deleted file mode 100644 index 834715270..000000000 --- a/samples/UWPSample/Pies/Pushout/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Pies.Pushout -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Polar/Basic/View.xaml b/samples/UWPSample/Polar/Basic/View.xaml deleted file mode 100644 index b3a9adef0..000000000 --- a/samples/UWPSample/Polar/Basic/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/samples/UWPSample/Polar/Basic/View.xaml.cs b/samples/UWPSample/Polar/Basic/View.xaml.cs deleted file mode 100644 index 9908e6c50..000000000 --- a/samples/UWPSample/Polar/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Polar.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Polar/Coordinates/View.xaml b/samples/UWPSample/Polar/Coordinates/View.xaml deleted file mode 100644 index e4b945aec..000000000 --- a/samples/UWPSample/Polar/Coordinates/View.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Polar/Coordinates/View.xaml.cs b/samples/UWPSample/Polar/Coordinates/View.xaml.cs deleted file mode 100644 index 492bdafb9..000000000 --- a/samples/UWPSample/Polar/Coordinates/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Polar.Coordinates -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Polar/RadialArea/View.xaml b/samples/UWPSample/Polar/RadialArea/View.xaml deleted file mode 100644 index 2620c2718..000000000 --- a/samples/UWPSample/Polar/RadialArea/View.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/Polar/RadialArea/View.xaml.cs b/samples/UWPSample/Polar/RadialArea/View.xaml.cs deleted file mode 100644 index 7b29cd3f9..000000000 --- a/samples/UWPSample/Polar/RadialArea/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Polar.RadialArea -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Properties/AssemblyInfo.cs b/samples/UWPSample/Properties/AssemblyInfo.cs deleted file mode 100644 index 9b1b819a1..000000000 --- a/samples/UWPSample/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("UWPSample")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("UWPSample")] -[assembly: AssemblyCopyright("Copyright © 2021")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/samples/UWPSample/Properties/Default.rd.xml b/samples/UWPSample/Properties/Default.rd.xml deleted file mode 100644 index af00722cd..000000000 --- a/samples/UWPSample/Properties/Default.rd.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/UWPSample/Scatter/AutoUpdate/View.xaml b/samples/UWPSample/Scatter/AutoUpdate/View.xaml deleted file mode 100644 index 267fb3a41..000000000 --- a/samples/UWPSample/Scatter/AutoUpdate/View.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/Scatter/AutoUpdate/View.xaml.cs b/samples/UWPSample/Scatter/AutoUpdate/View.xaml.cs deleted file mode 100644 index b8f1ca37f..000000000 --- a/samples/UWPSample/Scatter/AutoUpdate/View.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Threading.Tasks; -using ViewModelsSamples.Scatter.AutoUpdate; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; - -namespace UWPSample.Scatter.AutoUpdate -{ - public sealed partial class View : UserControl - { - private bool? _isStreaming = false; - - public View() - { - InitializeComponent(); - } - - private async void Button_PointerPressed(object sender, PointerRoutedEventArgs e) - { - var vm = (ViewModel)DataContext; - _isStreaming = _isStreaming is null ? true : !_isStreaming; - - while (_isStreaming.Value) - { - vm.RemoveItem(); - vm.AddItem(); - await Task.Delay(1000); - } - } - } -} diff --git a/samples/UWPSample/Scatter/Basic/View.xaml b/samples/UWPSample/Scatter/Basic/View.xaml deleted file mode 100644 index 1f17231eb..000000000 --- a/samples/UWPSample/Scatter/Basic/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Scatter/Basic/View.xaml.cs b/samples/UWPSample/Scatter/Basic/View.xaml.cs deleted file mode 100644 index ccc7df8bb..000000000 --- a/samples/UWPSample/Scatter/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Scatter.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Scatter/Bubbles/View.xaml b/samples/UWPSample/Scatter/Bubbles/View.xaml deleted file mode 100644 index 00a3eb83c..000000000 --- a/samples/UWPSample/Scatter/Bubbles/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Scatter/Bubbles/View.xaml.cs b/samples/UWPSample/Scatter/Bubbles/View.xaml.cs deleted file mode 100644 index 9311f3ec1..000000000 --- a/samples/UWPSample/Scatter/Bubbles/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Scatter.Bubbles -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/Scatter/Custom/View.xaml b/samples/UWPSample/Scatter/Custom/View.xaml deleted file mode 100644 index 8c4accbea..000000000 --- a/samples/UWPSample/Scatter/Custom/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/Scatter/Custom/View.xaml.cs b/samples/UWPSample/Scatter/Custom/View.xaml.cs deleted file mode 100644 index 9b93e000a..000000000 --- a/samples/UWPSample/Scatter/Custom/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.Scatter.Custom -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StackedArea/Basic/View.xaml b/samples/UWPSample/StackedArea/Basic/View.xaml deleted file mode 100644 index 3f7b53020..000000000 --- a/samples/UWPSample/StackedArea/Basic/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/StackedArea/Basic/View.xaml.cs b/samples/UWPSample/StackedArea/Basic/View.xaml.cs deleted file mode 100644 index df6d9dc77..000000000 --- a/samples/UWPSample/StackedArea/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StackedArea.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StackedArea/StepArea/View.xaml b/samples/UWPSample/StackedArea/StepArea/View.xaml deleted file mode 100644 index ebc4e1b0a..000000000 --- a/samples/UWPSample/StackedArea/StepArea/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/StackedArea/StepArea/View.xaml.cs b/samples/UWPSample/StackedArea/StepArea/View.xaml.cs deleted file mode 100644 index 16ed87e48..000000000 --- a/samples/UWPSample/StackedArea/StepArea/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StackedArea.StepArea -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StackedBars/Basic/View.xaml b/samples/UWPSample/StackedBars/Basic/View.xaml deleted file mode 100644 index 0c113add9..000000000 --- a/samples/UWPSample/StackedBars/Basic/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/StackedBars/Basic/View.xaml.cs b/samples/UWPSample/StackedBars/Basic/View.xaml.cs deleted file mode 100644 index f9b4b8fb1..000000000 --- a/samples/UWPSample/StackedBars/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StackedBars.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StackedBars/Groups/View.xaml b/samples/UWPSample/StackedBars/Groups/View.xaml deleted file mode 100644 index 478db4874..000000000 --- a/samples/UWPSample/StackedBars/Groups/View.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/samples/UWPSample/StackedBars/Groups/View.xaml.cs b/samples/UWPSample/StackedBars/Groups/View.xaml.cs deleted file mode 100644 index 91078f089..000000000 --- a/samples/UWPSample/StackedBars/Groups/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StackedBars.Groups -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StepLines/Area/View.xaml b/samples/UWPSample/StepLines/Area/View.xaml deleted file mode 100644 index 903eef63d..000000000 --- a/samples/UWPSample/StepLines/Area/View.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/samples/UWPSample/StepLines/Area/View.xaml.cs b/samples/UWPSample/StepLines/Area/View.xaml.cs deleted file mode 100644 index 7bc6e1261..000000000 --- a/samples/UWPSample/StepLines/Area/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StepLines.Area -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StepLines/AutoUpdate/View.xaml b/samples/UWPSample/StepLines/AutoUpdate/View.xaml deleted file mode 100644 index 7107aaeee..000000000 --- a/samples/UWPSample/StepLines/AutoUpdate/View.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/StepLines/AutoUpdate/View.xaml.cs b/samples/UWPSample/StepLines/AutoUpdate/View.xaml.cs deleted file mode 100644 index 91d95054a..000000000 --- a/samples/UWPSample/StepLines/AutoUpdate/View.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Threading.Tasks; -using ViewModelsSamples.StepLines.AutoUpdate; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; - -namespace UWPSample.StepLines.AutoUpdate -{ - public sealed partial class View : UserControl - { - private bool? _isStreaming = false; - - public View() - { - InitializeComponent(); - } - - private async void Button_PointerPressed(object sender, PointerRoutedEventArgs e) - { - var vm = (ViewModel)DataContext; - _isStreaming = _isStreaming is null ? true : !_isStreaming; - - while (_isStreaming.Value) - { - vm.RemoveItem(); - vm.AddItem(); - await Task.Delay(1000); - } - } - } -} diff --git a/samples/UWPSample/StepLines/Basic/View.xaml b/samples/UWPSample/StepLines/Basic/View.xaml deleted file mode 100644 index 616208003..000000000 --- a/samples/UWPSample/StepLines/Basic/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/StepLines/Basic/View.xaml.cs b/samples/UWPSample/StepLines/Basic/View.xaml.cs deleted file mode 100644 index 379c5900b..000000000 --- a/samples/UWPSample/StepLines/Basic/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StepLines.Basic -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StepLines/Custom/View.xaml b/samples/UWPSample/StepLines/Custom/View.xaml deleted file mode 100644 index 258282659..000000000 --- a/samples/UWPSample/StepLines/Custom/View.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/samples/UWPSample/StepLines/Custom/View.xaml.cs b/samples/UWPSample/StepLines/Custom/View.xaml.cs deleted file mode 100644 index cef387e0f..000000000 --- a/samples/UWPSample/StepLines/Custom/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StepLines.Custom -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StepLines/Properties/View.xaml b/samples/UWPSample/StepLines/Properties/View.xaml deleted file mode 100644 index 9f13e84cf..000000000 --- a/samples/UWPSample/StepLines/Properties/View.xaml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/StepLines/Properties/View.xaml.cs b/samples/UWPSample/StepLines/Properties/View.xaml.cs deleted file mode 100644 index 7d7100ed5..000000000 --- a/samples/UWPSample/StepLines/Properties/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StepLines.Properties -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/StepLines/Zoom/View.xaml b/samples/UWPSample/StepLines/Zoom/View.xaml deleted file mode 100644 index d2330d1f9..000000000 --- a/samples/UWPSample/StepLines/Zoom/View.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/StepLines/Zoom/View.xaml.cs b/samples/UWPSample/StepLines/Zoom/View.xaml.cs deleted file mode 100644 index 0213f51ca..000000000 --- a/samples/UWPSample/StepLines/Zoom/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.StepLines.Zoom -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/UWPSample.csproj b/samples/UWPSample/UWPSample.csproj deleted file mode 100644 index 8b6c35ba7..000000000 --- a/samples/UWPSample/UWPSample.csproj +++ /dev/null @@ -1,878 +0,0 @@ - - - - - enable - 9.0 - Debug - x86 - {3EE1E8CC-075A-4E54-9E65-2D0390D6C5A3} - AppContainerExe - Properties - UWPSample - UWPSample - en-US - UAP - 10.0.19041.0 - 10.0.17763.0 - 14 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - true - false - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - true - - - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - true - true - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - true - true - - - true - bin\ARM64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM64 - false - prompt - true - true - - - bin\ARM64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM64 - false - prompt - true - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x64 - false - prompt - true - - - bin\x64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x64 - false - prompt - true - true - - - PackageReference - - - - App.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - MainPage.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - View.xaml - - - - - Designer - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - - - 6.2.13 - - - 2.5.0 - - - - - {b4853153-b34f-4909-9b8f-a0ad00a3ee85} - LiveChartsCore - - - {dfcdb92d-2678-464d-a679-3866702fc6bf} - LiveChartsCore.SkiaSharpView.Uno - - - {3b6f3fa0-d35d-49db-90da-709cc481ceee} - LiveChartsCore.SkiaSharpView - - - {bde9c3d2-5801-4be1-b79e-63686d04ce0f} - ViewModelsSamples - - - - - 14.0 - - - - \ No newline at end of file diff --git a/samples/UWPSample/VisualTest/DataTemplate/View.xaml b/samples/UWPSample/VisualTest/DataTemplate/View.xaml deleted file mode 100644 index 00ca1b660..000000000 --- a/samples/UWPSample/VisualTest/DataTemplate/View.xaml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/VisualTest/DataTemplate/View.xaml.cs b/samples/UWPSample/VisualTest/DataTemplate/View.xaml.cs deleted file mode 100644 index 20eb65370..000000000 --- a/samples/UWPSample/VisualTest/DataTemplate/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.VisualTest.DataTemplate -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/VisualTest/ReattachVisual/View.xaml b/samples/UWPSample/VisualTest/ReattachVisual/View.xaml deleted file mode 100644 index c1c0819aa..000000000 --- a/samples/UWPSample/VisualTest/ReattachVisual/View.xaml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/VisualTest/ReattachVisual/View.xaml.cs b/samples/UWPSample/VisualTest/ReattachVisual/View.xaml.cs deleted file mode 100644 index 508affee4..000000000 --- a/samples/UWPSample/VisualTest/ReattachVisual/View.xaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.VisualTest.ReattachVisual -{ - public sealed partial class View : UserControl - { - private bool _isInVisualTree = true; - - public View() - { - InitializeComponent(); - } - - private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) - { - if (_isInVisualTree) - { - _ = parent.Children.Remove(chart); - _ = parent.Children.Remove(pieChart); - _ = parent.Children.Remove(polarChart); - _isInVisualTree = false; - return; - } - - parent.Children.Add(chart); - parent.Children.Add(pieChart); - parent.Children.Add(polarChart); - _isInVisualTree = true; - } - } -} diff --git a/samples/UWPSample/VisualTest/Tabs/View.xaml b/samples/UWPSample/VisualTest/Tabs/View.xaml deleted file mode 100644 index e7f72e998..000000000 --- a/samples/UWPSample/VisualTest/Tabs/View.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - diff --git a/samples/UWPSample/VisualTest/Tabs/View.xaml.cs b/samples/UWPSample/VisualTest/Tabs/View.xaml.cs deleted file mode 100644 index 0802c3075..000000000 --- a/samples/UWPSample/VisualTest/Tabs/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.VisualTest.Tabs -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UWPSample/VisualTest/TwoChartsOneSeries/View.xaml b/samples/UWPSample/VisualTest/TwoChartsOneSeries/View.xaml deleted file mode 100644 index d759c35c8..000000000 --- a/samples/UWPSample/VisualTest/TwoChartsOneSeries/View.xaml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/samples/UWPSample/VisualTest/TwoChartsOneSeries/View.xaml.cs b/samples/UWPSample/VisualTest/TwoChartsOneSeries/View.xaml.cs deleted file mode 100644 index 5b4f8f608..000000000 --- a/samples/UWPSample/VisualTest/TwoChartsOneSeries/View.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Windows.UI.Xaml.Controls; - -namespace UWPSample.VisualTest.TwoChartsOneSeries -{ - public sealed partial class View : UserControl - { - public View() - { - InitializeComponent(); - } - } -} diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.Base/UnoPlatform_v5.Base.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.Base/UnoPlatform_v5.Base.csproj index 8d78f515e..e7623475e 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.Base/UnoPlatform_v5.Base.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.Base/UnoPlatform_v5.Base.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.DataContracts/UnoPlatform_v5.DataContracts.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.DataContracts/UnoPlatform_v5.DataContracts.csproj index 60d4bd525..46cf70947 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.DataContracts/UnoPlatform_v5.DataContracts.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.DataContracts/UnoPlatform_v5.DataContracts.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 true diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.Mobile/UnoPlatform_v5.Mobile.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.Mobile/UnoPlatform_v5.Mobile.csproj index 9274c4efb..c74c265ca 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.Mobile/UnoPlatform_v5.Mobile.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.Mobile/UnoPlatform_v5.Mobile.csproj @@ -1,6 +1,6 @@ - net7.0-android;net7.0-ios;net7.0-maccatalyst + net8.0-android;net8.0-ios;net8.0-maccatalyst $(OverrideTargetFrameworks) true Exe diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.Server/UnoPlatform_v5.Server.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.Server/UnoPlatform_v5.Server.csproj index dbfbc4317..0a96b4874 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.Server/UnoPlatform_v5.Server.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.Server/UnoPlatform_v5.Server.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.Skia.Gtk/UnoPlatform_v5.Skia.Gtk.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.Skia.Gtk/UnoPlatform_v5.Skia.Gtk.csproj index 18bd2acff..6228a42ce 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.Skia.Gtk/UnoPlatform_v5.Skia.Gtk.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.Skia.Gtk/UnoPlatform_v5.Skia.Gtk.csproj @@ -2,7 +2,7 @@ WinExe Exe - net7.0 + net8.0 app.manifest diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.Tests/UnoPlatform_v5.Tests.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.Tests/UnoPlatform_v5.Tests.csproj index b084cc606..8621c3a06 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.Tests/UnoPlatform_v5.Tests.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.Tests/UnoPlatform_v5.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.UITests/UnoPlatform_v5.UITests.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.UITests/UnoPlatform_v5.UITests.csproj index 59c8c2133..915899900 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.UITests/UnoPlatform_v5.UITests.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.UITests/UnoPlatform_v5.UITests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.Wasm/UnoPlatform_v5.Wasm.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.Wasm/UnoPlatform_v5.Wasm.csproj index 5255ac3d4..793f70670 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.Wasm/UnoPlatform_v5.Wasm.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.Wasm/UnoPlatform_v5.Wasm.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 $(NoWarn);NU1504;NU1505;NU1701 disable diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5.Windows/UnoPlatform_v5.Windows.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5.Windows/UnoPlatform_v5.Windows.csproj index 14723509f..54bc17266 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5.Windows/UnoPlatform_v5.Windows.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5.Windows/UnoPlatform_v5.Windows.csproj @@ -1,7 +1,7 @@ WinExe - net7.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 UnoPlatform_v5.Windows app.manifest x86;x64;arm64 diff --git a/samples/UnoPlatform_v5/UnoPlatform_v5/UnoPlatform_v5.csproj b/samples/UnoPlatform_v5/UnoPlatform_v5/UnoPlatform_v5.csproj index 046c470e3..b0aee0ab4 100644 --- a/samples/UnoPlatform_v5/UnoPlatform_v5/UnoPlatform_v5.csproj +++ b/samples/UnoPlatform_v5/UnoPlatform_v5/UnoPlatform_v5.csproj @@ -1,7 +1,7 @@ - $(TargetFrameworks);net7.0-windows10.0.19041 - $(TargetFrameworks);net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041 + $(TargetFrameworks);net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst $(OverrideTargetFrameworks) diff --git a/samples/ViewModelsSamples/Bars/AutoUpdate/ViewModel.cs b/samples/ViewModelsSamples/Bars/AutoUpdate/ViewModel.cs index 0c6a9c7d7..e588efa21 100644 --- a/samples/ViewModelsSamples/Bars/AutoUpdate/ViewModel.cs +++ b/samples/ViewModelsSamples/Bars/AutoUpdate/ViewModel.cs @@ -18,8 +18,8 @@ public partial class ViewModel : ObservableObject public ViewModel() { // Use ObservableCollections to let the chart listen for changes (or any INotifyCollectionChanged). // mark - _observableValues = new ObservableCollection - { + _observableValues = + [ // Use the ObservableValue or ObservablePoint types to let the chart listen for property changes // mark // or use any INotifyPropertyChanged implementation // mark new ObservablePoint(_index++, 2), @@ -35,15 +35,15 @@ public ViewModel() new(_index++, 3), new(_index++, 8), new(_index++, 3) - }; + ]; - Series = new ObservableCollection - { + Series = + [ new ColumnSeries { Values = _observableValues } - }; + ]; // in the following sample notice that the type int does not implement INotifyPropertyChanged // and our Series.Values property is of type List diff --git a/samples/ViewModelsSamples/Bars/DelayedAnimation/ViewModel.cs b/samples/ViewModelsSamples/Bars/DelayedAnimation/ViewModel.cs index 9696f92c9..2fa32acd7 100644 --- a/samples/ViewModelsSamples/Bars/DelayedAnimation/ViewModel.cs +++ b/samples/ViewModelsSamples/Bars/DelayedAnimation/ViewModel.cs @@ -43,7 +43,7 @@ public ViewModel() columnSeries1.PointMeasured += OnPointMeasured; columnSeries2.PointMeasured += OnPointMeasured; - Series = new List { columnSeries1, columnSeries2 }; + Series = [columnSeries1, columnSeries2]; } private void OnPointMeasured(ChartPoint point) diff --git a/samples/ViewModelsSamples/Bars/Spacing/ViewModel.cs b/samples/ViewModelsSamples/Bars/Spacing/ViewModel.cs index 141ce1619..aceae5dd5 100644 --- a/samples/ViewModelsSamples/Bars/Spacing/ViewModel.cs +++ b/samples/ViewModelsSamples/Bars/Spacing/ViewModel.cs @@ -2,8 +2,6 @@ using CommunityToolkit.Mvvm.ComponentModel; using LiveChartsCore; using LiveChartsCore.SkiaSharpView; -using LiveChartsCore.SkiaSharpView.Painting; -using SkiaSharp; namespace ViewModelsSamples.Bars.Spacing; @@ -19,7 +17,7 @@ public partial class ViewModel : ObservableObject Padding = 0, // Defines the max width a bar can have - MaxBarWidth = double.PositiveInfinity + MaxBarWidth = double.MaxValue } }; } diff --git a/samples/ViewModelsSamples/Financial/BasicCandlesticks/ViewModel.cs b/samples/ViewModelsSamples/Financial/BasicCandlesticks/ViewModel.cs index c4b845567..6660ab7db 100644 --- a/samples/ViewModelsSamples/Financial/BasicCandlesticks/ViewModel.cs +++ b/samples/ViewModelsSamples/Financial/BasicCandlesticks/ViewModel.cs @@ -63,20 +63,11 @@ public ViewModel() public ISeries[] Series { get; set; } } -public class FinancialData +public class FinancialData(DateTime date, double high, double open, double close, double low) { - public FinancialData(DateTime date, double high, double open, double close, double low) - { - Date = date; - High = high; - Open = open; - Close = close; - Low = low; - } - - public DateTime Date { get; set; } - public double High { get; set; } - public double Open { get; set; } - public double Close { get; set; } - public double Low { get; set; } + public DateTime Date { get; set; } = date; + public double High { get; set; } = high; + public double Open { get; set; } = open; + public double Close { get; set; } = close; + public double Low { get; set; } = low; } diff --git a/samples/ViewModelsSamples/General/ConditionalDraw/City.cs b/samples/ViewModelsSamples/General/ConditionalDraw/City.cs index 9d9c39a4f..aa68c9700 100644 --- a/samples/ViewModelsSamples/General/ConditionalDraw/City.cs +++ b/samples/ViewModelsSamples/General/ConditionalDraw/City.cs @@ -2,13 +2,8 @@ namespace ViewModelsSamples.General.ConditionalDraw; -public partial class City : ObservableObject +public partial class City(double population) : ObservableObject { - public City(double population) - { - _population = population; - } - [ObservableProperty] - private double _population; + private double _population = population; } diff --git a/samples/ViewModelsSamples/General/ConditionalDraw/ViewModel.cs b/samples/ViewModelsSamples/General/ConditionalDraw/ViewModel.cs index bad676fa7..b8cd03d99 100644 --- a/samples/ViewModelsSamples/General/ConditionalDraw/ViewModel.cs +++ b/samples/ViewModelsSamples/General/ConditionalDraw/ViewModel.cs @@ -13,16 +13,16 @@ namespace ViewModelsSamples.General.ConditionalDraw; public partial class ViewModel : ObservableObject { - private readonly ObservableCollection _values = new(); + private readonly ObservableCollection _values = []; public ViewModel() { var dangerPaint = new SolidColorPaint(SKColors.Red); - _values = new ObservableCollection - { + _values = + [ new(2), new(5), new(4), new(6), new(8), new(3), new(2), new(4), new(6) - }; + ]; var series = new ColumnSeries { diff --git a/samples/ViewModelsSamples/General/DrawOnCanvas/ViewModel.cs b/samples/ViewModelsSamples/General/DrawOnCanvas/ViewModel.cs index a0803ee30..53106bbb3 100644 --- a/samples/ViewModelsSamples/General/DrawOnCanvas/ViewModel.cs +++ b/samples/ViewModelsSamples/General/DrawOnCanvas/ViewModel.cs @@ -16,29 +16,25 @@ namespace ViewModelsSamples.General.DrawOnCanvas; public partial class ViewModel { private SolidColorPaint? _paint; - private SimpleGeometry? _simpleGeometry; - private MotionGeometry? _motionGeometry; + private MotionGeometry? _geometry; + private bool _isBigCircle = true; [RelayCommand] public void ChartUpdated(ChartCommandArgs args) { var chartView = (ICartesianChartView)args.Chart; - var isNewGeometry = _simpleGeometry is null; - - _simpleGeometry ??= new SimpleGeometry(); - if (_motionGeometry is null) + if (_geometry is null) { - _motionGeometry = new MotionGeometry(); - _motionGeometry.Animate( + _geometry = new MotionGeometry(); + _geometry.Animate( new(EasingFunctions.BounceOut, TimeSpan.FromMilliseconds(800))); } if (_paint is null) { _paint = new SolidColorPaint(SKColors.Blue) { IsStroke = true, StrokeThickness = 2 }; - _paint.AddGeometryToPaintTask(chartView.CoreCanvas, _simpleGeometry); - _paint.AddGeometryToPaintTask(chartView.CoreCanvas, _motionGeometry); + _paint.AddGeometryToPaintTask(chartView.CoreCanvas, _geometry); chartView.CoreCanvas.AddDrawableTask(_paint); } @@ -46,9 +42,10 @@ public void ChartUpdated(ChartCommandArgs args) var locationInChartValues = new LvcPointD(5, 5); var locationInPixels = chartView.ScaleDataToPixels(locationInChartValues); - _motionGeometry.X = (float)locationInPixels.X; - _motionGeometry.Y = (float)locationInPixels.Y; - _motionGeometry.Diameter = 70; + _geometry.X = (float)locationInPixels.X; + _geometry.Y = (float)locationInPixels.Y; + // lets toggle the diameter of the circle between 20 and 70 + _geometry.Diameter = (_isBigCircle = !_isBigCircle) ? 70 : 20; // if this is the first time we draw the geometry // we can complete the animations. @@ -56,26 +53,9 @@ public void ChartUpdated(ChartCommandArgs args) } } -public class SimpleGeometry : Geometry -{ - public override void OnDraw(SkiaSharpDrawingContext context, SKPaint paint) - { - // we can use SkiaSharp here to draw anything we want - var skCanvas = context.Canvas; - skCanvas.DrawCircle(200, 200, 50, paint); - } - - protected override LvcSize OnMeasure(IPaint paintTasks) - { - // you can measure the geometry here, this method is used when the geometry - // is used inside a layout, in this case it is not necessary. - return new(); - } -} - public class MotionGeometry : Geometry { - // you can use Motion properties to animate the geometry + // use Motion properties to animate the geometry private readonly FloatMotionProperty _diameter; public MotionGeometry() @@ -91,6 +71,9 @@ public float Diameter public override void OnDraw(SkiaSharpDrawingContext context, SKPaint paint) { + // we can use SkiaSharp here to draw anything we need // mark + // https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/basics/ // mark + // because we inherited from Geometry, this class already contains the X, Y // and some other motion properties that we can use. @@ -99,6 +82,8 @@ public override void OnDraw(SkiaSharpDrawingContext context, SKPaint paint) protected override LvcSize OnMeasure(IPaint paintTasks) { + // you can measure the geometry here, this method is used when the geometry + // is used inside a layout, in this case it is not necessary. return new(); } } diff --git a/samples/ViewModelsSamples/General/Legends/AvailablePosition.cs b/samples/ViewModelsSamples/General/Legends/AvailablePosition.cs index 81eb6b253..6a55595e1 100644 --- a/samples/ViewModelsSamples/General/Legends/AvailablePosition.cs +++ b/samples/ViewModelsSamples/General/Legends/AvailablePosition.cs @@ -2,14 +2,8 @@ namespace ViewModelsSamples.General.Legends; -public class AvailablePosition +public class AvailablePosition(string name, LegendPosition position) { - public AvailablePosition(string name, LegendPosition position) - { - Name = name; - Position = position; - } - - public string Name { get; set; } - public LegendPosition Position { get; set; } + public string Name { get; set; } = name; + public LegendPosition Position { get; set; } = position; } diff --git a/samples/ViewModelsSamples/General/RealTime/ViewModel.cs b/samples/ViewModelsSamples/General/RealTime/ViewModel.cs index bec4a2ef0..3f411faf4 100644 --- a/samples/ViewModelsSamples/General/RealTime/ViewModel.cs +++ b/samples/ViewModelsSamples/General/RealTime/ViewModel.cs @@ -14,13 +14,13 @@ namespace ViewModelsSamples.General.RealTime; public partial class ViewModel : ObservableObject { private readonly Random _random = new(); - private readonly List _values = new(); + private readonly List _values = []; private readonly DateTimeAxis _customAxis; public ViewModel() { - Series = new ObservableCollection - { + Series = + [ new LineSeries { Values = _values, @@ -28,7 +28,7 @@ public ViewModel() GeometryFill = null, GeometryStroke = null } - }; + ]; _customAxis = new DateTimeAxis(TimeSpan.FromSeconds(1), Formatter) { diff --git a/samples/ViewModelsSamples/General/Scrollable/ViewModel.cs b/samples/ViewModelsSamples/General/Scrollable/ViewModel.cs index 341f8f4ea..e48552f83 100644 --- a/samples/ViewModelsSamples/General/Scrollable/ViewModel.cs +++ b/samples/ViewModelsSamples/General/Scrollable/ViewModel.cs @@ -16,7 +16,7 @@ namespace ViewModelsSamples.General.Scrollable; public partial class ViewModel { private bool _isDown = false; - private readonly ObservableCollection _values = new(); + private readonly ObservableCollection _values = []; public ViewModel() { diff --git a/samples/ViewModelsSamples/General/Tooltips/AvailablePositions.cs b/samples/ViewModelsSamples/General/Tooltips/AvailablePositions.cs index c46af296a..a0c6bf2e0 100644 --- a/samples/ViewModelsSamples/General/Tooltips/AvailablePositions.cs +++ b/samples/ViewModelsSamples/General/Tooltips/AvailablePositions.cs @@ -2,14 +2,8 @@ namespace ViewModelsSamples.General.Tooltips; -public class AvailablePositions +public class AvailablePositions(string name, TooltipPosition position) { - public AvailablePositions(string name, TooltipPosition position) - { - Name = name; - Position = position; - } - - public string Name { get; set; } - public TooltipPosition Position { get; set; } + public string Name { get; set; } = name; + public TooltipPosition Position { get; set; } = position; } diff --git a/samples/ViewModelsSamples/Lines/AutoUpdate/ViewModel.cs b/samples/ViewModelsSamples/Lines/AutoUpdate/ViewModel.cs index 67398a217..3bb7e5786 100644 --- a/samples/ViewModelsSamples/Lines/AutoUpdate/ViewModel.cs +++ b/samples/ViewModelsSamples/Lines/AutoUpdate/ViewModel.cs @@ -18,8 +18,8 @@ public partial class ViewModel : ObservableObject public ViewModel() { // Use ObservableCollections to let the chart listen for changes (or any INotifyCollectionChanged). // mark - _observableValues = new ObservableCollection - { + _observableValues = + [ // Use the ObservableValue or ObservablePoint types to let the chart listen for property changes // mark // or use any INotifyPropertyChanged implementation // mark new ObservableValue(2), @@ -35,16 +35,16 @@ public ViewModel() new(3), new(4), new(3) - }; + ]; - Series = new ObservableCollection - { + Series = + [ new LineSeries { Values = _observableValues, Fill = null } - }; + ]; // in the following sample notice that the type int does not implement INotifyPropertyChanged // and our Series.Values property is of type List diff --git a/samples/ViewModelsSamples/Pies/AngularGauge/ViewModel.cs b/samples/ViewModelsSamples/Pies/AngularGauge/ViewModel.cs index 641b63d5d..85be2fdb4 100644 --- a/samples/ViewModelsSamples/Pies/AngularGauge/ViewModel.cs +++ b/samples/ViewModelsSamples/Pies/AngularGauge/ViewModel.cs @@ -35,6 +35,7 @@ public ViewModel() { new AngularTicksVisual { + Labeler = value => value.ToString("N1"), LabelsSize = 16, LabelsOuterOffset = 15, OuterOffset = 65, diff --git a/samples/ViewModelsSamples/Pies/AutoUpdate/ViewModel.cs b/samples/ViewModelsSamples/Pies/AutoUpdate/ViewModel.cs index d7bb498d1..5ccd9e9c0 100644 --- a/samples/ViewModelsSamples/Pies/AutoUpdate/ViewModel.cs +++ b/samples/ViewModelsSamples/Pies/AutoUpdate/ViewModel.cs @@ -15,8 +15,8 @@ public partial class ViewModel : ObservableObject public ViewModel() { // Use ObservableCollections to let the chart listen for changes (or any INotifyCollectionChanged). // mark - Series = new ObservableCollection - { + Series = + [ // Use the ObservableValue or ObservablePoint types to let the chart listen for property changes // mark // or use any INotifyPropertyChanged implementation // mark new PieSeries { Values = new[] { new ObservableValue(2) } }, @@ -25,7 +25,7 @@ public ViewModel() new PieSeries { Values = new[] { new ObservableValue(7) } }, new PieSeries { Values = new[] { new ObservableValue(4) } }, new PieSeries { Values = new[] { new ObservableValue(3) } } - }; + ]; } public ObservableCollection Series { get; set; } diff --git a/samples/ViewModelsSamples/Pies/Doughnut/ViewModel.cs b/samples/ViewModelsSamples/Pies/Doughnut/ViewModel.cs index 39520ad48..eeacfaece 100644 --- a/samples/ViewModelsSamples/Pies/Doughnut/ViewModel.cs +++ b/samples/ViewModelsSamples/Pies/Doughnut/ViewModel.cs @@ -11,6 +11,6 @@ public partial class ViewModel : ObservableObject public IEnumerable Series { get; set; } = new[] { 2, 4, 1, 4, 3 }.AsPieSeries((value, series) => { - series.InnerRadius = 70; + series.MaxRadialColumnWidth = 60; }); } diff --git a/samples/ViewModelsSamples/Pies/NightingaleRose/ViewModel.cs b/samples/ViewModelsSamples/Pies/NightingaleRose/ViewModel.cs index 0a5f344e0..666b0c954 100644 --- a/samples/ViewModelsSamples/Pies/NightingaleRose/ViewModel.cs +++ b/samples/ViewModelsSamples/Pies/NightingaleRose/ViewModel.cs @@ -16,7 +16,7 @@ public ViewModel() Series = data.AsPieSeries((value, series) => { // this method is called once per element in the array - // we are decremting the outer radius 10 percent (0.1) + // we are decrementing the outer radius 50px // on every element in the array. series.InnerRadius = 50; diff --git a/samples/ViewModelsSamples/Scatter/AutoUpdate/ViewModel.cs b/samples/ViewModelsSamples/Scatter/AutoUpdate/ViewModel.cs index ba675fa62..174917151 100644 --- a/samples/ViewModelsSamples/Scatter/AutoUpdate/ViewModel.cs +++ b/samples/ViewModelsSamples/Scatter/AutoUpdate/ViewModel.cs @@ -18,8 +18,8 @@ public partial class ViewModel : ObservableObject public ViewModel() { // Use ObservableCollections to let the chart listen for changes (or any INotifyCollectionChanged). // mark - _observableValues = new ObservableCollection - { + _observableValues = + [ // Use the WeightedPoint, ObservableValue or ObservablePoint types to let the chart listen for property changes // mark // or use any INotifyPropertyChanged implementation // mark new WeightedPoint(_index++, 2, 6), @@ -35,12 +35,12 @@ public ViewModel() new(_index++, 3, 8), new(_index++, 8, 9), new(_index++, 3, 4) - }; + ]; - Series = new ObservableCollection - { + Series = + [ new ScatterSeries { Values = _observableValues, GeometrySize = 50 } - }; + ]; // in the following series notice that the type int does not implement INotifyPropertyChanged // and our Series.Values collection is of type List diff --git a/samples/ViewModelsSamples/StepLines/AutoUpdate/ViewModel.cs b/samples/ViewModelsSamples/StepLines/AutoUpdate/ViewModel.cs index 549d038a3..05dc04353 100644 --- a/samples/ViewModelsSamples/StepLines/AutoUpdate/ViewModel.cs +++ b/samples/ViewModelsSamples/StepLines/AutoUpdate/ViewModel.cs @@ -18,8 +18,8 @@ public partial class ViewModel : ObservableObject public ViewModel() { // Use ObservableCollections to let the chart listen for changes (or any INotifyCollectionChanged). // mark - _observableValues = new ObservableCollection - { + _observableValues = + [ // Use the ObservableValue or ObservablePoint types to let the chart listen for property changes // mark // or use any INotifyPropertyChanged implementation // mark new ObservablePoint(_index++, 2), @@ -35,16 +35,16 @@ public ViewModel() new(_index++, 3), new(_index++, 4), new(_index++, 3) - }; + ]; - Series = new ObservableCollection - { + Series = + [ new StepLineSeries { Values = _observableValues, // Fill = null } - }; + ]; // in the following series notice that the type int does not implement INotifyPropertyChanged // and our Series.Values collection is of type List diff --git a/samples/ViewModelsSamples/ViewModelsSamples.csproj b/samples/ViewModelsSamples/ViewModelsSamples.csproj index b4530735c..a6acc1c75 100644 --- a/samples/ViewModelsSamples/ViewModelsSamples.csproj +++ b/samples/ViewModelsSamples/ViewModelsSamples.csproj @@ -1,18 +1,15 @@ - - netstandard2.0;net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041 - - 14.2 - 14.0 - 21.0 - 10.0.17763.0 - 10.0.17763.0 + netstandard2.0;net8.0-android;net8.0-ios;net8.0-maccatalyst + + $(TargetFrameworks); + net462; + net8.0-windows10.0.19041.0; + false - 11.0 + 12.0 Enable diff --git a/samples/WPFSample/Command.cs b/samples/WPFSample/Command.cs index ea1f0e079..40b011afc 100644 --- a/samples/WPFSample/Command.cs +++ b/samples/WPFSample/Command.cs @@ -3,16 +3,10 @@ namespace WPFSample; -public class Command : ICommand +public class Command(Action command) : ICommand { - private readonly Action command; public event EventHandler CanExecuteChanged; - public Command(Action command) - { - this.command = command; - } - public bool CanExecute(object parameter) { return true; diff --git a/samples/WPFSample/WPFSample.csproj b/samples/WPFSample/WPFSample.csproj index 3c0e4b579..9cc42bde6 100644 --- a/samples/WPFSample/WPFSample.csproj +++ b/samples/WPFSample/WPFSample.csproj @@ -2,10 +2,10 @@ WinExe - net6.0-windows + net8.0-windows true false - 11.0 + 12.0 diff --git a/samples/WinFormsSample/WinFormsSample.csproj b/samples/WinFormsSample/WinFormsSample.csproj index 5179eb22d..43cc65038 100644 --- a/samples/WinFormsSample/WinFormsSample.csproj +++ b/samples/WinFormsSample/WinFormsSample.csproj @@ -2,10 +2,10 @@ WinExe - net6.0-windows + net8.0-windows true false - 11.0 + 12.0 diff --git a/samples/WinUISample/WinUISample/WinUISample.csproj b/samples/WinUISample/WinUISample/WinUISample.csproj index 25029a47c..79b65d54b 100644 --- a/samples/WinUISample/WinUISample/WinUISample.csproj +++ b/samples/WinUISample/WinUISample/WinUISample.csproj @@ -1,12 +1,12 @@ WinExe - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 10.0.17763.0 WinUISample app.manifest x86;x64;arm64 - win10-x86;win10-x64;win10-arm64 + win-x86;win-x64;win-arm64 win10-$(Platform).pubxml true true diff --git a/samples/XamarinSample/XamarinSample/XamarinSample.Android/XamarinSample.Android.csproj b/samples/XamarinSample/XamarinSample/XamarinSample.Android/XamarinSample.Android.csproj index e535939a9..5ac815558 100644 --- a/samples/XamarinSample/XamarinSample/XamarinSample.Android/XamarinSample.Android.csproj +++ b/samples/XamarinSample/XamarinSample/XamarinSample.Android/XamarinSample.Android.csproj @@ -90,6 +90,8 @@ {bde9c3d2-5801-4be1-b79e-63686d04ce0f} ViewModelsSamples + Android + false {EC154436-ED83-4EBD-8021-26CD4B758F70} diff --git a/samples/XamarinSample/XamarinSample/XamarinSample/AppShell.xaml.cs b/samples/XamarinSample/XamarinSample/XamarinSample/AppShell.xaml.cs index f8d15b40c..90dfaa014 100644 --- a/samples/XamarinSample/XamarinSample/XamarinSample/AppShell.xaml.cs +++ b/samples/XamarinSample/XamarinSample/XamarinSample/AppShell.xaml.cs @@ -8,7 +8,7 @@ namespace XamarinSample; public partial class AppShell : Shell { private bool _isLoaded = false; - private readonly Dictionary _routesSamples = new(); + private readonly Dictionary _routesSamples = []; public AppShell() { diff --git a/samples/XamarinSample/XamarinSample/XamarinSample/XamarinSample.csproj b/samples/XamarinSample/XamarinSample/XamarinSample/XamarinSample.csproj index 38e5b7f06..036452400 100644 --- a/samples/XamarinSample/XamarinSample/XamarinSample/XamarinSample.csproj +++ b/samples/XamarinSample/XamarinSample/XamarinSample/XamarinSample.csproj @@ -4,7 +4,7 @@ netstandard2.0 true false - 11.0 + 12.0 @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/LiveChartsCore.Behaviours/ChartBehaviour.Android.cs b/src/LiveChartsCore.Behaviours/ChartBehaviour.Android.cs index f13a43fe0..4584a0736 100644 --- a/src/LiveChartsCore.Behaviours/ChartBehaviour.Android.cs +++ b/src/LiveChartsCore.Behaviours/ChartBehaviour.Android.cs @@ -41,6 +41,11 @@ public abstract partial class ChartBehaviour private CustomScaleListener _customScaleListener = null!; private DateTime _previousPress = DateTime.MinValue; + /// + /// Called on android hover events. + /// + /// the sender. + /// the event args. protected void OnAndroidHover(object? sender, View.HoverEventArgs e) { if (e.Event is null) return; @@ -49,6 +54,11 @@ protected void OnAndroidHover(object? sender, View.HoverEventArgs e) Moved?.Invoke(sender, new(p, e.Event)); } + /// + /// Called on android touch events. + /// + /// the sender. + /// the event args. protected void OnAndroidTouched(object? sender, View.TouchEventArgs e) { var viewGroup = (ViewGroup?)sender; @@ -66,6 +76,12 @@ protected void OnAndroidTouched(object? sender, View.TouchEventArgs e) _ = _scaleDetector.OnTouchEvent(e.Event); + // MotionEventActions.ButtonPress + // is supported from API 23, the min target it 21 + // we are intentionally ignoring the warning here + // because the switch should never reach the case from api 21 or 22 + +#pragma warning disable CA1416 switch (e.Event.ActionMasked) { case MotionEventActions.ButtonPress: @@ -110,6 +126,7 @@ protected void OnAndroidTouched(object? sender, View.TouchEventArgs e) default: break; } +#pragma warning restore CA1416 _lastTouch = p; @@ -125,21 +142,14 @@ protected void OnAndroidTouched(object? sender, View.TouchEventArgs e) viewGroup.RequestDisallowInterceptTouchEvent(isChartInteraction); } - private class CustomScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener + private class CustomScaleListener(Action onScaled) : ScaleGestureDetector.SimpleOnScaleGestureListener { - private readonly Action _onScaled; - - public CustomScaleListener(Action onScaled) - { - _onScaled = onScaled; - } - public bool Paused { get; set; } public override bool OnScale(ScaleGestureDetector? detector) { if (detector is null || detector.ScaleFactor == 1 || Paused) return false; - _onScaled(detector.ScaleFactor); + onScaled(detector.ScaleFactor); return true; } } diff --git a/src/LiveChartsCore.Behaviours/ChartBehaviour.MacCatalyst.cs b/src/LiveChartsCore.Behaviours/ChartBehaviour.MacCatalyst.cs index f25772112..0c350ce29 100644 --- a/src/LiveChartsCore.Behaviours/ChartBehaviour.MacCatalyst.cs +++ b/src/LiveChartsCore.Behaviours/ChartBehaviour.MacCatalyst.cs @@ -36,6 +36,13 @@ public partial class ChartBehaviour { private DateTime _previousPress = DateTime.MinValue; +#if MACCATALYST + + /// + /// Builds a mac catalyst gesture recognizer. + /// + /// the view. + /// the recognizer. protected UIHoverGestureRecognizer GetMacCatalystHover(UIView view) { return new UIHoverGestureRecognizer((UIHoverGestureRecognizer e) => @@ -58,7 +65,13 @@ protected UIHoverGestureRecognizer GetMacCatalystHover(UIView view) } }); } +#endif + /// + /// Builds a mac catalyst gesture recognizer. + /// + /// the view. + /// the recognizer. protected UILongPressGestureRecognizer GetMacCatalystLongPress(UIView view) { return new UILongPressGestureRecognizer((UILongPressGestureRecognizer e) => @@ -94,6 +107,12 @@ protected UILongPressGestureRecognizer GetMacCatalystLongPress(UIView view) } private float _previousScale = 1; + + /// + /// Builds a mac catalyst gesture recognizer. + /// + /// the view. + /// the recognizer. protected UIPinchGestureRecognizer GetMacCatalystPinch(UIView view) { return new UIPinchGestureRecognizer((UIPinchGestureRecognizer e) => @@ -126,6 +145,12 @@ protected UIPinchGestureRecognizer GetMacCatalystPinch(UIView view) } private CGPoint? _last; + + /// + /// Builds a mac catalyst gesture recognizer. + /// + /// The view. + /// The recognizer. protected UIPanGestureRecognizer GetMacCatalystOnPan(UIView view) { return new UIPanGestureRecognizer((UIPanGestureRecognizer e) => @@ -141,7 +166,9 @@ protected UIPanGestureRecognizer GetMacCatalystOnPan(UIView view) _last = l; }) { +#if MACCATALYST AllowedScrollTypesMask = UIScrollTypeMask.Discrete | UIScrollTypeMask.Continuous, +#endif MinimumNumberOfTouches = 0, ShouldRecognizeSimultaneously = (g1, g2) => true }; diff --git a/src/LiveChartsCore.Behaviours/ChartBehaviour.Windows.cs b/src/LiveChartsCore.Behaviours/ChartBehaviour.Windows.cs index 18c51f016..a41443e1d 100644 --- a/src/LiveChartsCore.Behaviours/ChartBehaviour.Windows.cs +++ b/src/LiveChartsCore.Behaviours/ChartBehaviour.Windows.cs @@ -32,6 +32,11 @@ namespace LiveChartsCore.Behaviours; /// public partial class ChartBehaviour { + /// + /// Called on windows pointer pressed events. + /// + /// The sender. + /// The event args. protected void OnWindowsPointerPressed(object sender, PointerRoutedEventArgs e) { var p = e.GetCurrentPoint(sender as UIElement); @@ -42,6 +47,11 @@ protected void OnWindowsPointerPressed(object sender, PointerRoutedEventArgs e) new(new(p.Position.X, p.Position.Y), p.Properties.IsRightButtonPressed, e)); } + /// + /// Called on windows pointer moved events. + /// + /// The sender. + /// The events. protected void OnWindowsPointerMoved(object sender, PointerRoutedEventArgs e) { var p = e.GetCurrentPoint(sender as UIElement); @@ -52,6 +62,11 @@ protected void OnWindowsPointerMoved(object sender, PointerRoutedEventArgs e) new(new(p.Position.X, p.Position.Y), e)); } + /// + /// Called on windows pointer released events. + /// + /// The sender. + /// The event args. protected void OnWindowsPointerReleased(object sender, PointerRoutedEventArgs e) { var p = e.GetCurrentPoint(sender as UIElement); @@ -62,12 +77,22 @@ protected void OnWindowsPointerReleased(object sender, PointerRoutedEventArgs e) new(new(p.Position.X, p.Position.Y), p.Properties.IsRightButtonPressed, e)); } + /// + /// Called on windows pointer wheel changed events. + /// + /// The sender. + /// The event args. protected void OnWindowsPointerWheelChanged(object sender, PointerRoutedEventArgs e) { var p = e.GetCurrentPoint(sender as UIElement); Scrolled?.Invoke(sender, new(new(p.Position.X, p.Position.Y), p.Properties.MouseWheelDelta, e)); } + /// + /// Called on windows pointer entered events. + /// + /// The sender. + /// The event args. protected void OnWindowsPointerExited(object sender, PointerRoutedEventArgs e) { Exited?.Invoke(sender, new(e)); diff --git a/src/LiveChartsCore.Behaviours/Events/EventArgs.cs b/src/LiveChartsCore.Behaviours/Events/EventArgs.cs index 079f81ddf..d8d1a4ec1 100644 --- a/src/LiveChartsCore.Behaviours/Events/EventArgs.cs +++ b/src/LiveChartsCore.Behaviours/Events/EventArgs.cs @@ -25,19 +25,15 @@ namespace LiveChartsCore.Behaviours.Events; /// /// Defines the screen event args. /// -public class EventArgs +/// +/// Initializes a new instance of the class. +/// +/// The original event. +public class EventArgs(object originalEvent) { - /// - /// Initializes a new instance of the class. - /// - /// The original event. - public EventArgs(object originalEvent) - { - OriginalEvent = originalEvent; - } /// /// Gets the original event. /// - public object OriginalEvent { get; } + public object OriginalEvent { get; } = originalEvent; } diff --git a/src/LiveChartsCore.Behaviours/Events/PinchEventArgs.cs b/src/LiveChartsCore.Behaviours/Events/PinchEventArgs.cs index d28efe6db..c5cd40264 100644 --- a/src/LiveChartsCore.Behaviours/Events/PinchEventArgs.cs +++ b/src/LiveChartsCore.Behaviours/Events/PinchEventArgs.cs @@ -27,28 +27,22 @@ namespace LiveChartsCore.Behaviours.Events; /// /// Defines the pinch event args. /// -public class PinchEventArgs : EventArgs +/// +/// Initializes a new instance of the class. +/// +/// The scale. +/// The start. +/// The original event. +public class PinchEventArgs(float scale, LvcPoint pinchStart, object originalEvent) : EventArgs(originalEvent) { - /// - /// Initializes a new instance of the class. - /// - /// The scale. - /// The start. - /// The original event. - public PinchEventArgs(float scale, LvcPoint pinchStart, object originalEvent) - : base(originalEvent) - { - Scale = scale; - PinchStart = pinchStart; - } /// /// Gets the scale. /// - public float Scale { get; } + public float Scale { get; } = scale; /// /// Gets the pinch star location. /// - public LvcPoint PinchStart { get; set; } + public LvcPoint PinchStart { get; set; } = pinchStart; } diff --git a/src/LiveChartsCore.Behaviours/Events/PressedEventArgs.cs b/src/LiveChartsCore.Behaviours/Events/PressedEventArgs.cs index 2aca80083..9a64ebeef 100644 --- a/src/LiveChartsCore.Behaviours/Events/PressedEventArgs.cs +++ b/src/LiveChartsCore.Behaviours/Events/PressedEventArgs.cs @@ -27,22 +27,17 @@ namespace LiveChartsCore.Behaviours.Events; /// /// Defines the pointer event args. /// -public class PressedEventArgs : ScreenEventArgs +/// +/// Initializes a new instance of the class. +/// +/// The pointer location. +/// Indicates whether the action is secondary. +/// The original event. +public class PressedEventArgs(LvcPoint location, bool isSecondaryPress, object originalEvent) : ScreenEventArgs(location, originalEvent) { - /// - /// Initializes a new instance of the class. - /// - /// The pointer location. - /// Indicates whether the action is secondary. - /// The original event. - public PressedEventArgs(LvcPoint location, bool isSecondaryPress, object originalEvent) - : base(location, originalEvent) - { - IsSecondaryPress = isSecondaryPress; - } /// /// Gets a value indicating whether the action is a secondary press. /// - public bool IsSecondaryPress { get; } + public bool IsSecondaryPress { get; } = isSecondaryPress; } diff --git a/src/LiveChartsCore.Behaviours/Events/ScreenEventArgs.cs b/src/LiveChartsCore.Behaviours/Events/ScreenEventArgs.cs index de073c169..704ef05f8 100644 --- a/src/LiveChartsCore.Behaviours/Events/ScreenEventArgs.cs +++ b/src/LiveChartsCore.Behaviours/Events/ScreenEventArgs.cs @@ -27,21 +27,16 @@ namespace LiveChartsCore.Behaviours.Events; /// /// Defines the screen event args. /// -public class ScreenEventArgs : EventArgs +/// +/// Initializes a new instance of the class. +/// +/// The pointer location. +/// The original event. +public class ScreenEventArgs(LvcPoint location, object originalEvent) : EventArgs(originalEvent) { - /// - /// Initializes a new instance of the class. - /// - /// The pointer location. - /// The original event. - public ScreenEventArgs(LvcPoint location, object originalEvent) - : base(originalEvent) - { - Location = location; - } /// /// Gets the pointer location. /// - public LvcPoint Location { get; } + public LvcPoint Location { get; } = location; } diff --git a/src/LiveChartsCore.Behaviours/Events/ScrollEventArgs.cs b/src/LiveChartsCore.Behaviours/Events/ScrollEventArgs.cs index 9c57b57a4..e95257cef 100644 --- a/src/LiveChartsCore.Behaviours/Events/ScrollEventArgs.cs +++ b/src/LiveChartsCore.Behaviours/Events/ScrollEventArgs.cs @@ -27,22 +27,17 @@ namespace LiveChartsCore.Behaviours.Events; /// /// Defines the scroll event args. /// -public class ScrollEventArgs : ScreenEventArgs +/// +/// Initializes a new instance of the class. +/// +/// The pointer location. +/// Indicates the scroll delta. +/// The original event. +public class ScrollEventArgs(LvcPoint location, double scrollDelta, object originalEvent) : ScreenEventArgs(location, originalEvent) { - /// - /// Initializes a new instance of the class. - /// - /// The pointer location. - /// Indicates the scroll delta. - /// The original event. - public ScrollEventArgs(LvcPoint location, double scrollDelta, object originalEvent) - : base(location, originalEvent) - { - ScrollDelta = scrollDelta; - } /// /// Gets the scroll delta. /// - public double ScrollDelta { get; } + public double ScrollDelta { get; } = scrollDelta; } diff --git a/src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.csproj b/src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.csproj index fd2ecf215..75ea7a7ca 100644 --- a/src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.csproj +++ b/src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.csproj @@ -1,14 +1,20 @@ + enable + 12.0 + - net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst; - net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst + netstandard2.0; + net6.0; + net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst; - $(TargetFrameworks);net6.0-windows10.0.19041;net7.0-windows10.0.19041 + $(TargetFrameworks); + net462; + net6.0-windows10.0.19041.0; + net8.0-windows10.0.19041.0 - enable 11.0 13.1 @@ -17,9 +23,15 @@ 10.0.17763.0 6.5 + + win-x86;win-x64;win-arm64; + LiveChartsCore.Behaviours LiveChartsCore.Behaviours - 2.0.0-rc2 + 2.0.0-rc3 icon.png Adds user interaction for touch screens, touch pads and mouse. MIT @@ -30,12 +42,22 @@ bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + + + $(NoWarn);NETSDK1206 + + + + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + true + + - + diff --git a/src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.nuspec b/src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.nuspec index 1dfe911a2..2fe6b206c 100644 --- a/src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.nuspec +++ b/src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.nuspec @@ -2,7 +2,7 @@ LiveChartsCore.Behaviours - 2.0.0-rc2 + 2.0.0-rc3 LiveChartsCore.Behaviours BetoRodriguez true @@ -19,38 +19,38 @@ - + - + - + - + - + - + - + - + - + - + diff --git a/src/LiveChartsCore/BarSeries.cs b/src/LiveChartsCore/BarSeries.cs index 3dc1c2f57..c5fc6b4b9 100644 --- a/src/LiveChartsCore/BarSeries.cs +++ b/src/LiveChartsCore/BarSeries.cs @@ -213,7 +213,8 @@ protected override void OnPointerLeft(ChartPoint point) base.OnPointerLeft(point); } - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { Stroke, Fill, DataLabelsPaint, _errorPaint }; } diff --git a/src/LiveChartsCore/CartesianChart.cs b/src/LiveChartsCore/CartesianChart.cs index 94abc5d20..82d24f8c3 100644 --- a/src/LiveChartsCore/CartesianChart.cs +++ b/src/LiveChartsCore/CartesianChart.cs @@ -40,7 +40,7 @@ namespace LiveChartsCore; public class CartesianChart : Chart where TDrawingContext : DrawingContext { - internal readonly ISizedGeometry _zoomingSection; + private readonly ISizedGeometry _zoomingSection; private readonly ICartesianChartView _chartView; private int _nextSeries = 0; private double _zoomingSpeed = 0; @@ -48,7 +48,7 @@ public class CartesianChart : Chart private DrawMarginFrame? _previousDrawMarginFrame; private const double MaxAxisBound = 0.05; private const double MaxAxisActiveBound = 0.15; - private HashSet> _crosshair = new(); + private HashSet> _crosshair = []; /// /// Initializes a new instance of the class. @@ -79,7 +79,7 @@ public CartesianChart( /// The x axes. /// public ICartesianAxis[] XAxes { get; private set; } = - Array.Empty>(); + []; /// /// Gets the y axes. @@ -88,7 +88,7 @@ public CartesianChart( /// The y axes. /// public ICartesianAxis[] YAxes { get; private set; } = - Array.Empty>(); + []; /// /// Gets the sections. @@ -101,7 +101,7 @@ public CartesianChart( /// public override IEnumerable> Series => - _chartView.Series.Cast>(); + _chartView.Series?.Cast>() ?? []; /// public override IEnumerable> VisibleSeries => @@ -403,8 +403,25 @@ protected internal override void Measure() var viewDrawMargin = _chartView.DrawMargin; ControlSize = _chartView.ControlSize; - YAxes = _chartView.YAxes.Cast>().ToArray(); - XAxes = _chartView.XAxes.Cast>().ToArray(); + var x = _chartView.XAxes; + var y = _chartView.YAxes; + + if (x is null || y is null) + { + // in theory nulls are not valid, see ChartTest.cs for more context. + var provider = LiveCharts.DefaultSettings.GetProvider(); + + x = [provider.GetDefaultCartesianAxis()]; + y = [provider.GetDefaultCartesianAxis()]; + } + + XAxes = x.Cast>().ToArray(); + YAxes = y.Cast>().ToArray(); + + if (XAxes.Length == 0 || YAxes.Length == 0) + { + throw new Exception($"{nameof(XAxes)} and {nameof(YAxes)} must contain at least one element."); + } _zoomingSpeed = _chartView.ZoomingSpeed; _zoomMode = _chartView.ZoomMode; @@ -476,7 +493,11 @@ protected internal override void Measure() var yAxis = YAxes[series.ScalesYAt]; var seriesBounds = series.GetBounds(this, xAxis, yAxis).Bounds; - if (seriesBounds.IsEmpty) continue; + if (seriesBounds.IsEmpty) + { + ce._isInternalSet = false; + continue; + } AppendLimits(xAxis, yAxis, seriesBounds); @@ -851,7 +872,7 @@ protected internal override void Measure() public override void Unload() { base.Unload(); - _crosshair = new(); + _crosshair = []; _isFirstDraw = true; } diff --git a/src/LiveChartsCore/CartesianSeries.cs b/src/LiveChartsCore/CartesianSeries.cs index eb9797059..2f1f08d8b 100644 --- a/src/LiveChartsCore/CartesianSeries.cs +++ b/src/LiveChartsCore/CartesianSeries.cs @@ -94,7 +94,7 @@ public Func, string>? XToolTipLabelFormatter public Func, string>? YToolTipLabelFormatter { get => _yTooltipLabelFormatter; - set { SetProperty(ref _yTooltipLabelFormatter, value); _obsolete_formatter = value; } + set => SetProperty(ref _yTooltipLabelFormatter, value); } /// diff --git a/src/LiveChartsCore/Chart.cs b/src/LiveChartsCore/Chart.cs index 8f1223bd0..702b7f118 100644 --- a/src/LiveChartsCore/Chart.cs +++ b/src/LiveChartsCore/Chart.cs @@ -44,27 +44,29 @@ public abstract class Chart : IChart { #region fields - internal readonly HashSet> _everMeasuredElements = new(); - internal HashSet> _toDeleteElements = new(); + internal readonly HashSet> _everMeasuredElements = []; + internal HashSet> _toDeleteElements = []; internal bool _isToolTipOpen = false; internal bool _isPointerIn; internal LvcPoint _pointerPosition = new(-10, -10); internal float _titleHeight = 0f; internal LvcSize _legendSize; internal bool _preserveFirstDraw = false; - internal readonly HashSet _drawnSeries = new(); + internal readonly HashSet _drawnSeries = []; internal bool _isFirstDraw = true; private readonly ActionThrottler _updateThrottler; private readonly ActionThrottler _tooltipThrottler; private readonly ActionThrottler _panningThrottler; - private bool _isTooltipCanceled; private LvcPoint _pointerPanningStartPosition = new(-10, -10); private LvcPoint _pointerPanningPosition = new(-10, -10); private LvcPoint _pointerPreviousPanningPosition = new(-10, -10); private bool _isPanning = false; - private readonly Dictionary _activePoints = new(); + private readonly Dictionary _activePoints = []; private LvcSize _previousSize = new(); +#if NET5_0_OR_GREATER private readonly bool _isMobile; + private bool _isTooltipCanceled; +#endif #endregion @@ -328,7 +330,9 @@ internal virtual void InvokePointerDown(LvcPoint point, bool isSecondaryAction) lock (Canvas.Sync) { +#if NET5_0_OR_GREATER if (_isMobile) _isTooltipCanceled = false; +#endif var strategy = VisibleSeries.GetTooltipFindingStrategy(); @@ -373,6 +377,7 @@ internal virtual void InvokePointerMove(LvcPoint point) internal virtual void InvokePointerUp(LvcPoint point, bool isSecondaryAction) { +#if NET5_0_OR_GREATER if (_isMobile) { lock (Canvas.Sync) @@ -382,6 +387,7 @@ internal virtual void InvokePointerUp(LvcPoint point, bool isSecondaryAction) View.InvokeOnUIThread(CloseTooltip); } +#endif if (!_isPanning) return; _isPanning = false; @@ -578,7 +584,7 @@ protected void CollectVisuals() _ = _everMeasuredElements.Remove(visual); } - _toDeleteElements = new HashSet>(); + _toDeleteElements = []; } /// @@ -661,7 +667,9 @@ private Task TooltipThrottlerUnlocked() { lock (Canvas.Sync) { +#if NET5_0_OR_GREATER if (_isTooltipCanceled) return; +#endif DrawToolTip(); Canvas.Invalidate(); } diff --git a/src/LiveChartsCore/ConditionalDraw/ConditionalDrawBuilder.cs b/src/LiveChartsCore/ConditionalDraw/ConditionalDrawBuilder.cs index b9d262601..afa727ce9 100644 --- a/src/LiveChartsCore/ConditionalDraw/ConditionalDrawBuilder.cs +++ b/src/LiveChartsCore/ConditionalDraw/ConditionalDrawBuilder.cs @@ -29,29 +29,21 @@ namespace LiveChartsCore.ConditionalDraw; /// /// Defines a instance. /// +/// +/// Initializes a new builder for the given paint. +/// +/// The series. +/// The paint. [Obsolete("Replaced by MaPoints extensiion.")] -public class ConditionalPaintBuilder +public class ConditionalPaintBuilder(Series series, IPaint paint) where TDrawingContext : DrawingContext where TVisual : class, IGeometry, new() where TLabel : class, ILabelGeometry, new() { private bool _isPaintInCanvas = false; private object _clipFor = new(); - private readonly Series _series; - private readonly IPaint _paint; private Func, bool>? _whenPredicate; - /// - /// Initializes a new builder for the given paint. - /// - /// The series. - /// The paint. - public ConditionalPaintBuilder(Series series, IPaint paint) - { - _series = series; - _paint = paint; - } - /// /// Applies the paint when the given condition is true. /// @@ -60,8 +52,8 @@ public Series When( Func, bool> predicate) { _whenPredicate = predicate; - _series.PointMeasured += OnMeasured; - return _series; + series.PointMeasured += OnMeasured; + return series; } /// @@ -69,7 +61,7 @@ public Series When( /// public void UnSubscribe() { - _series.PointMeasured -= OnMeasured; + series.PointMeasured -= OnMeasured; } private void OnMeasured(ChartPoint point) @@ -83,8 +75,8 @@ private void OnMeasured(ChartPoint point) if (!_isPaintInCanvas) { - canvas.AddDrawableTask(_paint); - if (_paint.ZIndex == 0) _paint.ZIndex = int.MaxValue; + canvas.AddDrawableTask(paint); + if (paint.ZIndex == 0) paint.ZIndex = int.MaxValue; _isPaintInCanvas = true; } @@ -95,15 +87,15 @@ private void OnMeasured(ChartPoint point) { var drawLocation = cartesianChart.DrawMarginLocation; var drawMarginSize = cartesianChart.DrawMarginSize; - _paint.SetClipRectangle(cartesianChart.Canvas, new LvcRectangle(drawLocation, drawMarginSize)); + paint.SetClipRectangle(cartesianChart.Canvas, new LvcRectangle(drawLocation, drawMarginSize)); } } if (isTriggered) { - _paint.AddGeometryToPaintTask(canvas, drawable); + paint.AddGeometryToPaintTask(canvas, drawable); - foreach (var paint in _series.GetPaintTasks()) + foreach (var paint in series.GetPaintTasks()) { if (paint is null) continue; paint.RemoveGeometryFromPainTask(canvas, drawable); @@ -111,7 +103,7 @@ private void OnMeasured(ChartPoint point) } else { - _paint.RemoveGeometryFromPainTask(canvas, drawable); + paint.RemoveGeometryFromPainTask(canvas, drawable); } } } diff --git a/src/LiveChartsCore/CoreAxis.cs b/src/LiveChartsCore/CoreAxis.cs index 848d59fd8..0a5b9af2e 100644 --- a/src/LiveChartsCore/CoreAxis.cs +++ b/src/LiveChartsCore/CoreAxis.cs @@ -52,7 +52,7 @@ public abstract class CoreAxis /// /// The active separators /// - protected internal readonly Dictionary>> activeSeparators = new(); + protected internal readonly Dictionary>> activeSeparators = []; internal float _xo = 0f, _yo = 0f; internal LvcSize _size; @@ -102,7 +102,6 @@ public abstract class CoreAxis private Align? _labelsAlignment; private bool _inLineNamePlacement; private IEnumerable? _customSeparators; - private int _stepCount; internal double? _logBase; #endregion @@ -242,7 +241,14 @@ public IPaint? SubticksPaint public IPaint? ZeroPaint { get => _zeroPaint; - set => SetPaintProperty(ref _zeroPaint, value, true); + set + { + SetPaintProperty(ref _zeroPaint, value, true); + + // clear the reference to thre previous line. + // so a new instance will be created for the new paint task. + _zeroLine = null; + } } /// @@ -307,8 +313,6 @@ public LvcColor? CrosshairLabelsBackground /// public override void Invalidate(Chart chart) { - _stepCount = 0; - var cartesianChart = (CartesianChart)chart; var controlSize = cartesianChart.ControlSize; @@ -405,7 +409,7 @@ public override void Invalidate(Chart chart) if (!activeSeparators.TryGetValue(cartesianChart, out var separators)) { - separators = new Dictionary>(); + separators = []; activeSeparators[cartesianChart] = separators; } @@ -607,8 +611,6 @@ NamePadding is not null || SeparatorsPaint is not null || LabelsPaint is not nul UpdateLabel(visualSeparator.Label, x, y + tyco, labelContent, hasRotation, r, UpdateMode.Update); if (hasActivePaint) _ = measured.Add(visualSeparator); - - if (_stepCount++ > 10000) ThrowInfiniteSeparators(); } foreach (var separatorValueKey in separators.ToArray()) @@ -805,12 +807,22 @@ private IEnumerable EnumerateSeparators(double start, double end, double { if (CustomSeparators is not null) { - foreach (var s in CustomSeparators) yield return s; + foreach (var s in CustomSeparators) + yield return s; + yield break; } var relativeEnd = end - start; - for (var i = 0d; i <= relativeEnd; i += step) yield return start + i; + + if (relativeEnd / step > 10000) + ThrowInfiniteSeparators(); + + // start from -step to include the first separator/sub-separator + // and end at relativeEnd + step to include the last separator/sub-separator + + for (var i = -step; i <= relativeEnd + step; i += step) + yield return start + i; } private static ChartPoint? FindClosestPoint( @@ -891,8 +903,6 @@ public virtual LvcSize GetPossibleSize(Chart chart) var m = textGeometry.Measure(LabelsPaint); if (m.Width > w) w = m.Width; if (m.Height > h) h = m.Height; - - if (_stepCount++ > 10000) ThrowInfiniteSeparators(); } return new LvcSize(w, h); @@ -988,11 +998,8 @@ protected override void OnPaintChanged(string? propertyName) OnPropertyChanged(propertyName); } - /// - /// Gets the paint tasks. - /// - /// - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _separatorsPaint, _labelsPaint, _namePaint, _zeroPaint, _ticksPaint, _subticksPaint, _subseparatorsPaint }; } @@ -1046,8 +1053,6 @@ private LvcSize GetPossibleMaxLabelSize() maxLabelSize = new LvcSize( maxLabelSize.Width > m.Width ? maxLabelSize.Width : m.Width, maxLabelSize.Height > m.Height ? maxLabelSize.Height : m.Height); - - if (_stepCount++ > 10000) ThrowInfiniteSeparators(); } return maxLabelSize; @@ -1259,7 +1264,7 @@ private void UpdateSubseparators( float xs = 0f, ys = 0f; if (_orientation == AxisOrientation.X) { - xs = scale.MeasureInPixels(s * kl); + xs = scale.MeasureInPixels(s + s * kl); } else { @@ -1411,6 +1416,7 @@ private void UpdateLabel( } label.Text = text; + label.TextSize = (float)_textSize; label.Padding = _padding; label.X = x; label.Y = y; @@ -1456,8 +1462,9 @@ private string TryGetLabelOrLogError(Func labeler, double value) private void ThrowInfiniteSeparators() { + var axisName = string.IsNullOrEmpty(Name) ? "" : $"named \"{Name}\" "; throw new Exception( - $"The {_orientation} axis has an excessive number of separators. " + + $"The {_orientation} axis {axisName}has an excessive number of separators. " + $"If you set the step manually, ensure the number of separators is less than 10,000. " + $"This could also be caused because you are zooming too deep, " + $"try to set a limit to the current chart zoom using the Axis.{nameof(MinZoomDelta)} property. " + diff --git a/src/LiveChartsCore/CoreFinancialSeries.cs b/src/LiveChartsCore/CoreFinancialSeries.cs index 8f4556c17..a4456d788 100644 --- a/src/LiveChartsCore/CoreFinancialSeries.cs +++ b/src/LiveChartsCore/CoreFinancialSeries.cs @@ -439,12 +439,8 @@ protected internal override void SoftDeleteOrDisposePoint(ChartPoint point, Scal label.RemoveOnCompleted = true; } - /// - /// Gets the paint tasks. - /// - /// - /// - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _upFill, _upStroke, _downFill, _downStroke, DataLabelsPaint }; } diff --git a/src/LiveChartsCore/CoreHeatLandSeries.cs b/src/LiveChartsCore/CoreHeatLandSeries.cs index 594536afc..9545fec6c 100644 --- a/src/LiveChartsCore/CoreHeatLandSeries.cs +++ b/src/LiveChartsCore/CoreHeatLandSeries.cs @@ -41,13 +41,13 @@ public class CoreHeatLandSeries : IGeoSeries, { private IPaint? _heatPaint; private bool _isHeatInCanvas = false; - private LvcColor[] _heatMap = Array.Empty(); + private LvcColor[] _heatMap = []; private double[]? _colorStops; private IEnumerable? _lands; private bool _isVisible; - private readonly HashSet> _subscribedTo = new(); + private readonly HashSet> _subscribedTo = []; private readonly CollectionDeepObserver _observer; - private readonly HashSet _everUsed = new(); + private readonly HashSet _everUsed = []; /// /// Initializes a new instance of the class. @@ -131,7 +131,7 @@ public void Measure(MapContext context) var heat = HeatFunctions.InterpolateColor((float)land.Value, bounds, HeatMap, heatStops); var mapLand = context.View.ActiveMap.FindLand(land.Name); - if (mapLand is null) return; + if (mapLand is null) continue; var shapesQuery = mapLand.Data .Select(x => x.Shape) diff --git a/src/LiveChartsCore/CoreHeatSeries.cs b/src/LiveChartsCore/CoreHeatSeries.cs index 751c2a12e..70acf8b4c 100644 --- a/src/LiveChartsCore/CoreHeatSeries.cs +++ b/src/LiveChartsCore/CoreHeatSeries.cs @@ -46,7 +46,7 @@ public abstract class CoreHeatSeries private IPaint? _paintTaks; private Bounds _weightBounds = new(); private int _heatKnownLength = 0; - private List> _heatStops = new(); + private List> _heatStops = []; private LvcColor[] _heatMap = { LvcColor.FromArgb(255, 87, 103, 222), // cold (min value) @@ -353,7 +353,7 @@ public override Sketch GetMiniaturesSketch() } /// - internal override IPaint?[] GetPaintTasks() + protected internal override IPaint?[] GetPaintTasks() { return new[] { _paintTaks }; } diff --git a/src/LiveChartsCore/CoreLineSeries.cs b/src/LiveChartsCore/CoreLineSeries.cs index 1a74fd5ca..02dab12b0 100644 --- a/src/LiveChartsCore/CoreLineSeries.cs +++ b/src/LiveChartsCore/CoreLineSeries.cs @@ -49,8 +49,8 @@ public class CoreLineSeries, new() where TDrawingContext : DrawingContext { - internal readonly Dictionary> _fillPathHelperDictionary = new(); - internal readonly Dictionary> _strokePathHelperDictionary = new(); + internal readonly Dictionary> _fillPathHelperDictionary = []; + internal readonly Dictionary> _strokePathHelperDictionary = []; private float _lineSmoothness = 0.65f; private float _geometrySize = 14f; private bool _enableNullSplitting = true; @@ -162,13 +162,13 @@ public override void Invalidate(Chart chart) if (!_strokePathHelperDictionary.TryGetValue(chart.Canvas.Sync, out var strokePathHelperContainer)) { - strokePathHelperContainer = new List(); + strokePathHelperContainer = []; _strokePathHelperDictionary[chart.Canvas.Sync] = strokePathHelperContainer; } if (!_fillPathHelperDictionary.TryGetValue(chart.Canvas.Sync, out var fillPathHelperContainer)) { - fillPathHelperContainer = new List(); + fillPathHelperContainer = []; _fillPathHelperDictionary[chart.Canvas.Sync] = fillPathHelperContainer; } @@ -549,11 +549,8 @@ public override void RemoveFromUI(Chart chart) _ = _strokePathHelperDictionary.Remove(chart.Canvas.Sync); } - /// - /// Gets the paint tasks. - /// - /// - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { Stroke, Fill, _geometryFill, _geometryStroke, DataLabelsPaint, _errorPaint }; } @@ -761,23 +758,15 @@ private SegmentVisual GetSegmentVisual(int index, List container, return new SegmentVisual(isNew, path); } - private class SplineData + private class SplineData(ChartPoint start) { - public SplineData(ChartPoint start) - { - Previous = start; - Current = start; - Next = start; - AfterNext = start; - } + public ChartPoint Previous { get; set; } = start; - public ChartPoint Previous { get; set; } + public ChartPoint Current { get; set; } = start; - public ChartPoint Current { get; set; } + public ChartPoint Next { get; set; } = start; - public ChartPoint Next { get; set; } - - public ChartPoint AfterNext { get; set; } + public ChartPoint AfterNext { get; set; } = start; public bool IsFirst { get; set; } = true; @@ -790,16 +779,10 @@ public void GoNext(ChartPoint point) } } - private class SegmentVisual + private class SegmentVisual(bool isNew, TPathGeometry path) { - public SegmentVisual(bool isNew, TPathGeometry path) - { - IsNew = isNew; - Path = path; - } - - public bool IsNew { get; set; } + public bool IsNew { get; set; } = isNew; - public TPathGeometry Path { get; set; } + public TPathGeometry Path { get; set; } = path; } } diff --git a/src/LiveChartsCore/CorePieSeries.cs b/src/LiveChartsCore/CorePieSeries.cs index 5f0c0c931..9da0f2181 100644 --- a/src/LiveChartsCore/CorePieSeries.cs +++ b/src/LiveChartsCore/CorePieSeries.cs @@ -151,7 +151,7 @@ public IPaint? Fill public Func, string>? ToolTipLabelFormatter { get => _tooltipLabelFormatter; - set { SetProperty(ref _tooltipLabelFormatter, value); _obsolete_formatter = value; } + set => SetProperty(ref _tooltipLabelFormatter, value); } /// @@ -169,9 +169,6 @@ public override void Invalidate(Chart chart) minDimension = minDimension - (Stroke?.StrokeThickness ?? 0) * 2 - maxPushout * 2; - var maxOuterRadius = (float)MaxOuterRadius; - minDimension *= maxOuterRadius; - var pieLabelsCorrection = chart.SeriesContext.GetPieOuterLabelsSpace(); minDimension -= pieLabelsCorrection; @@ -503,9 +500,9 @@ public override int GetStackGroup() } /// - internal override IPaint?[] GetPaintTasks() + protected internal override IPaint?[] GetPaintTasks() { - return new[] { _fill, _stroke, DataLabelsPaint }; + return [_fill, _stroke, DataLabelsPaint]; } /// diff --git a/src/LiveChartsCore/CorePolarAxis.cs b/src/LiveChartsCore/CorePolarAxis.cs index 832d5f306..aa9a8e8dc 100644 --- a/src/LiveChartsCore/CorePolarAxis.cs +++ b/src/LiveChartsCore/CorePolarAxis.cs @@ -52,7 +52,7 @@ public abstract class CorePolarAxis /// The active separators /// - protected readonly Dictionary>> activeSeparators = new(); + protected readonly Dictionary>> activeSeparators = []; internal PolarAxisOrientation _orientation; private double _minStep = 0; @@ -279,7 +279,7 @@ public override void Invalidate(Chart chart) if (!activeSeparators.TryGetValue(polarChart, out var separators)) { - separators = new Dictionary>(); + separators = []; activeSeparators[polarChart] = separators; } @@ -601,11 +601,8 @@ protected override void OnPaintChanged(string? propertyName) OnPropertyChanged(propertyName); } - /// - /// Gets the paint tasks. - /// - /// - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _separatorsPaint, _labelsPaint, _namePaint }; } diff --git a/src/LiveChartsCore/CorePolarLineSeries.cs b/src/LiveChartsCore/CorePolarLineSeries.cs index 874799fe3..5d6940fee 100644 --- a/src/LiveChartsCore/CorePolarLineSeries.cs +++ b/src/LiveChartsCore/CorePolarLineSeries.cs @@ -47,8 +47,8 @@ public class CorePolarLineSeries, new() where TDrawingContext : DrawingContext { - private readonly Dictionary> _fillPathHelperDictionary = new(); - private readonly Dictionary> _strokePathHelperDictionary = new(); + private readonly Dictionary> _fillPathHelperDictionary = []; + private readonly Dictionary> _strokePathHelperDictionary = []; private float _lineSmoothness = 0.65f; private float _geometrySize = 14f; private bool _enableNullSplitting = true; @@ -167,7 +167,7 @@ public Func, string>? AngleToolTipLabelForma public Func, string>? RadiusToolTipLabelFormatter { get => _radiusTooltipLabelFormatter; - set { SetProperty(ref _radiusTooltipLabelFormatter, value); _obsolete_formatter = value; } + set => SetProperty(ref _radiusTooltipLabelFormatter, value); } /// @@ -218,13 +218,13 @@ public override void Invalidate(Chart chart) if (!_strokePathHelperDictionary.TryGetValue(chart.Canvas.Sync, out var strokePathHelperContainer)) { - strokePathHelperContainer = new List(); + strokePathHelperContainer = []; _strokePathHelperDictionary[chart.Canvas.Sync] = strokePathHelperContainer; } if (!_fillPathHelperDictionary.TryGetValue(chart.Canvas.Sync, out var fillPathHelperContainer)) { - fillPathHelperContainer = new List(); + fillPathHelperContainer = []; _fillPathHelperDictionary[chart.Canvas.Sync] = fillPathHelperContainer; } @@ -593,7 +593,7 @@ protected internal IEnumerable GetSpline( for (var i = 0; i < points.Length; i++) { - var isClosed = IsClosed && points.Length > 3; + var isClosed = IsClosed && points.Length > 2; var a1 = i + 1 - points.Length; var a2 = i + 2 - points.Length; @@ -775,11 +775,8 @@ public override void SoftDeleteOrDispose(IChartView chart) OnVisibilityChanged(); } - /// - /// Gets the paint tasks. - /// - /// - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { Stroke, Fill, _geometryFill, _geometryStroke, DataLabelsPaint }; } diff --git a/src/LiveChartsCore/CoreStepLineSeries.cs b/src/LiveChartsCore/CoreStepLineSeries.cs index 96af5eaff..01d55e70e 100644 --- a/src/LiveChartsCore/CoreStepLineSeries.cs +++ b/src/LiveChartsCore/CoreStepLineSeries.cs @@ -48,8 +48,8 @@ public class CoreStepLineSeries, new() where TDrawingContext : DrawingContext { - private readonly Dictionary> _fillPathHelperDictionary = new(); - private readonly Dictionary> _strokePathHelperDictionary = new(); + private readonly Dictionary> _fillPathHelperDictionary = []; + private readonly Dictionary> _strokePathHelperDictionary = []; private float _geometrySize = 14f; private IPaint? _geometryFill; private IPaint? _geometryStroke; @@ -133,13 +133,13 @@ public override void Invalidate(Chart chart) if (!_strokePathHelperDictionary.TryGetValue(chart.Canvas.Sync, out var strokePathHelperContainer)) { - strokePathHelperContainer = new List(); + strokePathHelperContainer = []; _strokePathHelperDictionary[chart.Canvas.Sync] = strokePathHelperContainer; } if (!_fillPathHelperDictionary.TryGetValue(chart.Canvas.Sync, out var fillPathHelperContainer)) { - fillPathHelperContainer = new List(); + fillPathHelperContainer = []; _fillPathHelperDictionary[chart.Canvas.Sync] = fillPathHelperContainer; } @@ -492,7 +492,7 @@ public override void RemoveFromUI(Chart chart) /// Gets the paint tasks. /// /// - internal override IPaint?[] GetPaintTasks() + protected internal override IPaint?[] GetPaintTasks() { return new[] { Stroke, Fill, _geometryFill, _geometryStroke, DataLabelsPaint }; } diff --git a/src/LiveChartsCore/Defaults/BoxValue.cs b/src/LiveChartsCore/Defaults/BoxValue.cs index 0a7457bef..d332d9c5b 100644 --- a/src/LiveChartsCore/Defaults/BoxValue.cs +++ b/src/LiveChartsCore/Defaults/BoxValue.cs @@ -105,19 +105,11 @@ public BoxValue( public double Median { get => _median; set { _median = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/DateTimePoint.cs b/src/LiveChartsCore/Defaults/DateTimePoint.cs index 6519da4cc..2eb209e06 100644 --- a/src/LiveChartsCore/Defaults/DateTimePoint.cs +++ b/src/LiveChartsCore/Defaults/DateTimePoint.cs @@ -70,19 +70,11 @@ public DateTimePoint(DateTime dateTime, double? value) public double? Value { get => _value; set { _value = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/ErrorDateTimePoint.cs b/src/LiveChartsCore/Defaults/ErrorDateTimePoint.cs index b1c83158a..7f9419428 100644 --- a/src/LiveChartsCore/Defaults/ErrorDateTimePoint.cs +++ b/src/LiveChartsCore/Defaults/ErrorDateTimePoint.cs @@ -119,19 +119,11 @@ public ErrorDateTimePoint(DateTime dateTime, double y, double xError, double yEr public double YErrorJ { get => _eyj; set { _eyj = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/ErrorPoint.cs b/src/LiveChartsCore/Defaults/ErrorPoint.cs index cd5e5c8f0..0a1ac3317 100644 --- a/src/LiveChartsCore/Defaults/ErrorPoint.cs +++ b/src/LiveChartsCore/Defaults/ErrorPoint.cs @@ -117,19 +117,11 @@ public ErrorPoint(double x, double y, double xError, double yError) public double YErrorJ { get => _eyj; set { _eyj = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/ErrorValue.cs b/src/LiveChartsCore/Defaults/ErrorValue.cs index a5f0f4a45..0965e2294 100644 --- a/src/LiveChartsCore/Defaults/ErrorValue.cs +++ b/src/LiveChartsCore/Defaults/ErrorValue.cs @@ -91,19 +91,11 @@ public ErrorValue(double y, double yError) public double YErrorJ { get => _eyj; set { _eyj = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/FinancialPoint.cs b/src/LiveChartsCore/Defaults/FinancialPoint.cs index f1df0e050..9e85c8bfd 100644 --- a/src/LiveChartsCore/Defaults/FinancialPoint.cs +++ b/src/LiveChartsCore/Defaults/FinancialPoint.cs @@ -102,19 +102,11 @@ public FinancialPoint(DateTime date, double? high, double? open, double? close, public double? Low { get => _low; set { _low = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/FinancialPointI.cs b/src/LiveChartsCore/Defaults/FinancialPointI.cs index a3d5047cf..08b0c16ab 100644 --- a/src/LiveChartsCore/Defaults/FinancialPointI.cs +++ b/src/LiveChartsCore/Defaults/FinancialPointI.cs @@ -96,19 +96,11 @@ public FinancialPointI(double high, double open, double close, double low) public double Low { get => _low; set { _low = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/MappedChartEntity.cs b/src/LiveChartsCore/Defaults/MappedChartEntity.cs index 9b4f93746..e6d227f2b 100644 --- a/src/LiveChartsCore/Defaults/MappedChartEntity.cs +++ b/src/LiveChartsCore/Defaults/MappedChartEntity.cs @@ -32,18 +32,10 @@ namespace LiveChartsCore.Defaults; public sealed class MappedChartEntity : IChartEntity { /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; } diff --git a/src/LiveChartsCore/Defaults/ObservablePoint.cs b/src/LiveChartsCore/Defaults/ObservablePoint.cs index b503e0678..907fcd1c8 100644 --- a/src/LiveChartsCore/Defaults/ObservablePoint.cs +++ b/src/LiveChartsCore/Defaults/ObservablePoint.cs @@ -69,19 +69,11 @@ public ObservablePoint(double? x, double? y) public double? Y { get => _y; set { _y = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/ObservablePolarPoint.cs b/src/LiveChartsCore/Defaults/ObservablePolarPoint.cs index af4e6a3b8..67835ab83 100644 --- a/src/LiveChartsCore/Defaults/ObservablePolarPoint.cs +++ b/src/LiveChartsCore/Defaults/ObservablePolarPoint.cs @@ -62,19 +62,11 @@ public ObservablePolarPoint(double? angle, double? radius) public double? Radius { get => _radius; set { _radius = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/ObservableValue.cs b/src/LiveChartsCore/Defaults/ObservableValue.cs index 2785a041b..fc41cb14c 100644 --- a/src/LiveChartsCore/Defaults/ObservableValue.cs +++ b/src/LiveChartsCore/Defaults/ObservableValue.cs @@ -61,19 +61,11 @@ public ObservableValue(double? value) public double? Value { get => _value; set { _value = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/TimeSpanPoint.cs b/src/LiveChartsCore/Defaults/TimeSpanPoint.cs index debdd1268..bfb5c2bb8 100644 --- a/src/LiveChartsCore/Defaults/TimeSpanPoint.cs +++ b/src/LiveChartsCore/Defaults/TimeSpanPoint.cs @@ -69,19 +69,11 @@ public TimeSpanPoint(TimeSpan timeSpan, double? value) public double? Value { get => _value; set { _value = value; OnPropertyChanged(); } } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/Defaults/WeightedPoint.cs b/src/LiveChartsCore/Defaults/WeightedPoint.cs index 58a24e5ba..141341f77 100644 --- a/src/LiveChartsCore/Defaults/WeightedPoint.cs +++ b/src/LiveChartsCore/Defaults/WeightedPoint.cs @@ -86,19 +86,11 @@ public WeightedPoint(double? x, double? y, double? weight) public event PropertyChangedEventHandler? PropertyChanged; /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public ChartEntityMetaData? MetaData { get; set; } /// -#if NET5_0_OR_GREATER [System.Text.Json.Serialization.JsonIgnore] -#else - [Newtonsoft.Json.JsonIgnore] -#endif public Coordinate Coordinate { get; set; } = Coordinate.Empty; /// diff --git a/src/LiveChartsCore/DrawMarginFrame.cs b/src/LiveChartsCore/DrawMarginFrame.cs index 80f60c0f1..e5f43fb77 100644 --- a/src/LiveChartsCore/DrawMarginFrame.cs +++ b/src/LiveChartsCore/DrawMarginFrame.cs @@ -60,11 +60,8 @@ public IPaint? Fill set => SetPaintProperty(ref _fill, value); } - /// - /// Gets the paint tasks. - /// - /// - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _stroke, _fill }; } diff --git a/src/LiveChartsCore/Drawing/Animatable.cs b/src/LiveChartsCore/Drawing/Animatable.cs index 62de9f6d0..5a4b6f23e 100644 --- a/src/LiveChartsCore/Drawing/Animatable.cs +++ b/src/LiveChartsCore/Drawing/Animatable.cs @@ -45,7 +45,7 @@ protected Animatable() { } public bool RemoveOnCompleted { get; set; } /// - public Dictionary MotionProperties { get; } = new(); + public Dictionary MotionProperties { get; } = []; /// public void SetTransition(Animation? animation, params string[]? propertyName) diff --git a/src/LiveChartsCore/Drawing/LvcSize.cs b/src/LiveChartsCore/Drawing/LvcSize.cs index 3efc64844..080bf42c9 100644 --- a/src/LiveChartsCore/Drawing/LvcSize.cs +++ b/src/LiveChartsCore/Drawing/LvcSize.cs @@ -25,28 +25,23 @@ namespace LiveChartsCore.Drawing; /// /// Defines a size. /// -public struct LvcSize +/// +/// Initializes a new instance of the struct. +/// +/// The width. +/// The height. +public struct LvcSize(float width, float height) { - /// - /// Initializes a new instance of the struct. - /// - /// The width. - /// The height. - public LvcSize(float width, float height) - { - Width = width; - Height = height; - } /// /// Gets or sets the width. /// - public float Width { get; set; } + public float Width { get; set; } = width; /// /// Gets or sets the height. /// - public float Height { get; set; } + public float Height { get; set; } = height; /// /// Determines whether the instance is equals to the given instance. diff --git a/src/LiveChartsCore/Geo/CoreMap.cs b/src/LiveChartsCore/Geo/CoreMap.cs index 8e6a834bb..ca7047507 100644 --- a/src/LiveChartsCore/Geo/CoreMap.cs +++ b/src/LiveChartsCore/Geo/CoreMap.cs @@ -62,7 +62,7 @@ public CoreMap(StreamReader streamReader, string layerName = "default") /// /// Gets the map layers dictionary. /// - public Dictionary> Layers { get; protected set; } = new(); + public Dictionary> Layers { get; protected set; } = []; /// /// Finds a land by short name. @@ -122,20 +122,13 @@ public MapLayer AddLayerFromStreamReader( Layers.Add(layerName, layer); } - GeoJsonFile? geoJson; - -#if NET5_0_OR_GREATER - geoJson = System.Text.Json.JsonSerializer.Deserialize( + var geoJson = System.Text.Json.JsonSerializer.Deserialize( streamReader.ReadToEnd(), new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase - }); -#else - geoJson = Newtonsoft.Json.JsonConvert.DeserializeObject(streamReader.ReadToEnd()); -#endif + }) ?? throw new Exception("Map not found"); - if (geoJson is null) throw new Exception("Map not found"); layer.AddFile(geoJson); return layer; } diff --git a/src/LiveChartsCore/Geo/LandDefinition.cs b/src/LiveChartsCore/Geo/LandDefinition.cs index e31a1d8a8..907e3ed95 100644 --- a/src/LiveChartsCore/Geo/LandDefinition.cs +++ b/src/LiveChartsCore/Geo/LandDefinition.cs @@ -27,35 +27,29 @@ namespace LiveChartsCore.Geo; /// /// Defines the data of a lane in a map. /// -public class LandDefinition +/// +/// Initializes a new instance of the class. +/// +/// The short name. +/// The name. +/// The set of. +public class LandDefinition(string shortName, string name, string setOf) { - /// - /// Initializes a new instance of the class. - /// - /// The short name. - /// The name. - /// The set of. - public LandDefinition(string shortName, string name, string setOf) - { - Name = name; - ShortName = shortName; - SetOf = setOf; - } /// /// Gets the short name. /// - public string ShortName { get; } + public string ShortName { get; } = shortName; /// /// Gets the name. /// - public string Name { get; } + public string Name { get; } = name; /// /// Gets or sets the set of reference. /// - public string SetOf { get; set; } + public string SetOf { get; set; } = setOf; /// /// Gets the HSize. @@ -86,5 +80,5 @@ public LandDefinition(string shortName, string name, string setOf) /// /// Gets or sets the data. /// - public LandData[] Data { get; set; } = Array.Empty(); + public LandData[] Data { get; set; } = []; } diff --git a/src/LiveChartsCore/Geo/MapContext.cs b/src/LiveChartsCore/Geo/MapContext.cs index c011cc43f..26d30aa54 100644 --- a/src/LiveChartsCore/Geo/MapContext.cs +++ b/src/LiveChartsCore/Geo/MapContext.cs @@ -28,41 +28,34 @@ namespace LiveChartsCore.Geo; /// Defines a map context. /// /// -public class MapContext +/// +/// Initializes a new instance of class. +/// +public class MapContext( + GeoMap core, + IGeoMapView view, + CoreMap map, + MapProjector projector) where TDrawingContext : DrawingContext { - /// - /// Initializes a new instance of class. - /// - public MapContext( - GeoMap core, - IGeoMapView view, - CoreMap map, - MapProjector projector) - { - CoreMap = core; - MapFile = map; - Projector = projector; - View = view; - } /// /// Gets the core map. /// - public GeoMap CoreMap { get; } + public GeoMap CoreMap { get; } = core; /// /// Gets the map file. /// - public CoreMap MapFile { get; } + public CoreMap MapFile { get; } = map; /// /// Gets the map projector. /// - public MapProjector Projector { get; } + public MapProjector Projector { get; } = projector; /// /// Gets the map view. /// - public IGeoMapView View { get; } + public IGeoMapView View { get; } = view; } diff --git a/src/LiveChartsCore/Geo/MapLayer.cs b/src/LiveChartsCore/Geo/MapLayer.cs index 1423c9652..4f98989aa 100644 --- a/src/LiveChartsCore/Geo/MapLayer.cs +++ b/src/LiveChartsCore/Geo/MapLayer.cs @@ -30,21 +30,15 @@ namespace LiveChartsCore.Geo; /// /// Defines a map layer. /// -public class MapLayer +/// +/// Initializes a new from the given . +/// +/// The layer name. +/// The stroke. +/// The fill. +public class MapLayer(string layerName, IPaint stroke, IPaint fill) where TDrawingContext : DrawingContext { - /// - /// Initializes a new from the given . - /// - /// The layer name. - /// The stroke. - /// The fill. - public MapLayer(string layerName, IPaint stroke, IPaint fill) - { - Name = layerName; - Stroke = stroke; - Fill = fill; - } /// /// Gets or sets the name. @@ -52,7 +46,7 @@ public MapLayer(string layerName, IPaint stroke, IPaint /// The name. /// - public string Name { get; set; } + public string Name { get; set; } = layerName; /// /// Gets or sets the layer process index. @@ -67,27 +61,27 @@ public MapLayer(string layerName, IPaint stroke, IPaint /// Gets or sets the stroke. /// - public IPaint? Stroke { get; set; } + public IPaint? Stroke { get; set; } = stroke; /// /// Gets or sets the fill. /// - public IPaint? Fill { get; set; } + public IPaint? Fill { get; set; } = fill; /// /// Gets or sets the X bounds. /// - public double[] Max { get; set; } = Array.Empty(); + public double[] Max { get; set; } = []; /// /// Gets or sets the Y bounds. /// - public double[] Min { get; set; } = Array.Empty(); + public double[] Min { get; set; } = []; /// /// Gets the lands. /// - public Dictionary Lands { get; private set; } = new(); + public Dictionary Lands { get; private set; } = []; /// /// Gets or sets the land condition, it must return true if the land is required. diff --git a/src/LiveChartsCore/Geo/MapShapeContext.cs b/src/LiveChartsCore/Geo/MapShapeContext.cs index e23b2cbab..e75207cdf 100644 --- a/src/LiveChartsCore/Geo/MapShapeContext.cs +++ b/src/LiveChartsCore/Geo/MapShapeContext.cs @@ -30,45 +30,38 @@ namespace LiveChartsCore.Geo; /// /// Defines the map shape context class. /// -public class MapShapeContext +/// +/// Initializes a new instance of the class. +/// +/// The chart. +/// The heat paint. +/// The heat stops. +/// The bounds. +public class MapShapeContext( + IGeoMapView chart, + IPaint heatPaint, + List> heatStops, + Bounds bounds) where TDrawingContext : DrawingContext { - /// - /// Initializes a new instance of the class. - /// - /// The chart. - /// The heat paint. - /// The heat stops. - /// The bounds. - public MapShapeContext( - IGeoMapView chart, - IPaint heatPaint, - List> heatStops, - Bounds bounds) - { - Chart = chart; - HeatPaint = heatPaint; - HeatStops = heatStops; - Bounds = bounds; - } /// /// Gets the chart. /// - public IGeoMapView Chart { get; } + public IGeoMapView Chart { get; } = chart; /// /// Gets the heat paint. /// - public IPaint HeatPaint { get; } + public IPaint HeatPaint { get; } = heatPaint; /// /// Gets the heat stops. /// - public List> HeatStops { get; } + public List> HeatStops { get; } = heatStops; /// /// Gets the bounds dictionary. /// - public Bounds Bounds { get; } + public Bounds Bounds { get; } = bounds; } diff --git a/src/LiveChartsCore/Geo/ZoomOnPointerView.cs b/src/LiveChartsCore/Geo/ZoomOnPointerView.cs index 241124653..8677fae0b 100644 --- a/src/LiveChartsCore/Geo/ZoomOnPointerView.cs +++ b/src/LiveChartsCore/Geo/ZoomOnPointerView.cs @@ -28,26 +28,21 @@ namespace LiveChartsCore.Geo; /// /// Defines the /// -public class ZoomOnPointerView +/// +/// Initializes a new instance of the command. +/// +/// The pivot. +/// The direction. +public class ZoomOnPointerView(LvcPoint pivot, ZoomDirection direction) { - /// - /// Initializes a new instance of the command. - /// - /// The pivot. - /// The direction. - public ZoomOnPointerView(LvcPoint pivot, ZoomDirection direction) - { - Pivot = pivot; - Direction = direction; - } /// /// Gets the pivot. /// - public LvcPoint Pivot { get; } + public LvcPoint Pivot { get; } = pivot; /// /// Gets the direction. /// - public ZoomDirection Direction { get; } + public ZoomDirection Direction { get; } = direction; } diff --git a/src/LiveChartsCore/GeoMap.cs b/src/LiveChartsCore/GeoMap.cs index 7b141cc2c..8e76c0d44 100644 --- a/src/LiveChartsCore/GeoMap.cs +++ b/src/LiveChartsCore/GeoMap.cs @@ -38,7 +38,7 @@ namespace LiveChartsCore; public class GeoMap where TDrawingContext : DrawingContext { - private readonly HashSet> _everMeasuredSeries = new(); + private readonly HashSet> _everMeasuredSeries = []; private readonly ActionThrottler _updateThrottler; private readonly ActionThrottler _panningThrottler; private bool _isHeatInCanvas = false; @@ -239,7 +239,7 @@ internal void Measure() _mapFactory.GenerateLands(context); var toDeleteSeries = new HashSet>(_everMeasuredSeries); - foreach (var series in View.Series.Cast>()) + foreach (var series in View.Series?.Cast>() ?? []) { series.Measure(context); _ = _everMeasuredSeries.Add(series); diff --git a/src/LiveChartsCore/ISeries.cs b/src/LiveChartsCore/ISeries.cs index ac562b040..fad5677b6 100644 --- a/src/LiveChartsCore/ISeries.cs +++ b/src/LiveChartsCore/ISeries.cs @@ -62,7 +62,7 @@ public interface ISeries /// /// The values. /// - IEnumerable? Values { get; set; } + ICollection? Values { get; set; } /// /// Gets or sets a value indicating whether this instance is visible. @@ -224,12 +224,4 @@ public interface ISeries : ISeries /// The mapping. /// Func? Mapping { get; set; } - - /// - /// Gets or sets the values. - /// - /// - /// The values. - /// - new IEnumerable? Values { get; set; } } diff --git a/src/LiveChartsCore/Kernel/ActionThrottler.cs b/src/LiveChartsCore/Kernel/ActionThrottler.cs index 44040170f..5913c5e37 100644 --- a/src/LiveChartsCore/Kernel/ActionThrottler.cs +++ b/src/LiveChartsCore/Kernel/ActionThrottler.cs @@ -28,23 +28,16 @@ namespace LiveChartsCore.Kernel; /// /// An object that is able to throttle an action. /// -public class ActionThrottler +/// +/// Initializes a new instance of the class. +/// +/// The target action to throttle. +/// The throttling time. +public class ActionThrottler(Func targetAction, TimeSpan time) { private readonly object _sync = new(); - private readonly Func _action; private bool _isWaiting = false; - /// - /// Initializes a new instance of the class. - /// - /// The target action to throttle. - /// The throttling time. - public ActionThrottler(Func targetAction, TimeSpan time) - { - _action = targetAction; - ThrottlerTimeSpan = time; - } - #if DEBUG /// /// Gets the calls. @@ -61,7 +54,7 @@ public ActionThrottler(Func targetAction, TimeSpan time) /// /// The throttler time span. /// - public TimeSpan ThrottlerTimeSpan { get; set; } + public TimeSpan ThrottlerTimeSpan { get; set; } = time; /// /// Schedules a call to the target action. @@ -89,7 +82,7 @@ public async void Call() _isWaiting = false; } - await Task.WhenAny(_action()); + await Task.WhenAny(targetAction()); } /// @@ -98,6 +91,6 @@ public async void Call() /// public void ForceCall() { - _ = _action(); + _ = targetAction(); } } diff --git a/src/LiveChartsCore/Kernel/ChartElement.cs b/src/LiveChartsCore/Kernel/ChartElement.cs index 29dd9ed00..abc394db5 100644 --- a/src/LiveChartsCore/Kernel/ChartElement.cs +++ b/src/LiveChartsCore/Kernel/ChartElement.cs @@ -37,8 +37,8 @@ public abstract class ChartElement : IChartElement _userSets = new(); - private readonly List> _deletingTasks = new(); + internal readonly HashSet _userSets = []; + private readonly List> _deletingTasks = []; /// /// Occurs when a property value changes. @@ -80,8 +80,8 @@ public virtual void RemoveFromUI(Chart chart) /// /// Gets the paint tasks registered by the . /// - /// - internal abstract IPaint?[] GetPaintTasks(); + /// The paint tasks. + protected internal abstract IPaint?[] GetPaintTasks(); /// /// Sets a property value and handles the paints in the canvas. diff --git a/src/LiveChartsCore/Kernel/ChartEntityMetaData.cs b/src/LiveChartsCore/Kernel/ChartEntityMetaData.cs index e397e19c9..249fd6cc5 100644 --- a/src/LiveChartsCore/Kernel/ChartEntityMetaData.cs +++ b/src/LiveChartsCore/Kernel/ChartEntityMetaData.cs @@ -29,20 +29,14 @@ namespace LiveChartsCore.Kernel; /// /// Represents additional data required by LiveCharts to draw a point. /// -public class ChartEntityMetaData +/// +/// Initializes a new instance of the class. +/// +/// The callback to call when the entity index changes. +public class ChartEntityMetaData(Action? onEntityIndexChanged = null) { - private readonly Action? _entityIndexChangedCallback; private int _entityIndex; - /// - /// Initializes a new instance of the class. - /// - /// The callback to call when the entity index changes. - public ChartEntityMetaData(Action? onEntityIndexChanged = null) - { - _entityIndexChangedCallback = onEntityIndexChanged; - } - /// /// Gets the entity index, a consecutive integer based on the position of the entity in the data collection. /// @@ -53,12 +47,12 @@ public int EntityIndex { if (value == _entityIndex) return; _entityIndex = value; - _entityIndexChangedCallback?.Invoke(value); + onEntityIndexChanged?.Invoke(value); } } /// /// Gets the chart points dictionary. /// - public Dictionary ChartPoints { get; set; } = new(); + public Dictionary ChartPoints { get; set; } = []; } diff --git a/src/LiveChartsCore/Kernel/CollectionDeepObserver.cs b/src/LiveChartsCore/Kernel/CollectionDeepObserver.cs index 70bccadef..a022df239 100644 --- a/src/LiveChartsCore/Kernel/CollectionDeepObserver.cs +++ b/src/LiveChartsCore/Kernel/CollectionDeepObserver.cs @@ -36,7 +36,7 @@ public class CollectionDeepObserver { private readonly NotifyCollectionChangedEventHandler _onCollectionChanged; private readonly PropertyChangedEventHandler _onItemPropertyChanged; - private readonly HashSet _itemsListening = new(); + private readonly HashSet _itemsListening = []; /// /// The check i notify property changed @@ -71,7 +71,7 @@ public CollectionDeepObserver( /// /// The instance. /// - public void Initialize(IEnumerable? instance) + public void Initialize(IEnumerable? instance) { if (instance is null) return; @@ -90,7 +90,7 @@ public void Initialize(IEnumerable? instance) /// /// The instance. /// - public void Dispose(IEnumerable? instance) + public void Dispose(IEnumerable? instance) { if (instance is null) return; diff --git a/src/LiveChartsCore/Kernel/Drawing/Sketch.cs b/src/LiveChartsCore/Kernel/Drawing/Sketch.cs index ba3967562..a81be0d60 100644 --- a/src/LiveChartsCore/Kernel/Drawing/Sketch.cs +++ b/src/LiveChartsCore/Kernel/Drawing/Sketch.cs @@ -29,21 +29,15 @@ namespace LiveChartsCore.Kernel.Drawing; /// Defines the paint context. /// /// The type of the drawing context. -public class Sketch +/// +/// Initializes a new instance of the class. +/// +/// The widht. +/// The height. +/// The svg path. +public class Sketch(double width, double height, string? svg) where TDrawingContext : DrawingContext { - /// - /// Initializes a new instance of the class. - /// - /// The widht. - /// The height. - /// The svg path. - public Sketch(double width, double height, string? svg) - { - Svg = svg; - Width = width; - Height = height; - } /// /// Gets or sets the width. @@ -51,7 +45,7 @@ public Sketch(double width, double height, string? svg) /// /// The width. /// kjio9 - public double Width { get; set; } + public double Width { get; set; } = width; /// /// Gets or sets the height. @@ -59,12 +53,12 @@ public Sketch(double width, double height, string? svg) /// /// The height. /// - public double Height { get; set; } + public double Height { get; set; } = height; /// /// Gets or sets the Svg. /// / - public string? Svg { get; set; } + public string? Svg { get; set; } = svg; /// /// Gets or sets the paint schedules. @@ -72,5 +66,5 @@ public Sketch(double width, double height, string? svg) /// /// The paint tasks schedule. /// - public List> PaintSchedules { get; set; } = new(); + public List> PaintSchedules { get; set; } = []; } diff --git a/src/LiveChartsCore/Kernel/Events/ChartCommandArgs.cs b/src/LiveChartsCore/Kernel/Events/ChartCommandArgs.cs index 10347e2ee..fba1982e7 100644 --- a/src/LiveChartsCore/Kernel/Events/ChartCommandArgs.cs +++ b/src/LiveChartsCore/Kernel/Events/ChartCommandArgs.cs @@ -28,19 +28,15 @@ namespace LiveChartsCore.Kernel.Events; /// /// Command arguments that describe when a chart event occurs. /// -public class ChartCommandArgs +/// +/// Initializes a new instance of the class. +/// +/// The chart that fired the event. +public class ChartCommandArgs(IChartView chart) { - /// - /// Initializes a new instance of the class. - /// - /// The chart that fired the event. - public ChartCommandArgs(IChartView chart) - { - Chart = chart; - } /// /// Gets the sender chart. /// - public IChartView Chart { get; } + public IChartView Chart { get; } = chart; } diff --git a/src/LiveChartsCore/Kernel/Events/PointerCommandArgs.cs b/src/LiveChartsCore/Kernel/Events/PointerCommandArgs.cs index d23516924..5fe90d32e 100644 --- a/src/LiveChartsCore/Kernel/Events/PointerCommandArgs.cs +++ b/src/LiveChartsCore/Kernel/Events/PointerCommandArgs.cs @@ -29,31 +29,25 @@ namespace LiveChartsCore.Kernel.Events; /// /// Command arguments that describe a pointer event in a LiveChart view. /// -public class PointerCommandArgs : ChartCommandArgs +/// +/// Initializes a new instance of the class. +/// +/// The chart that fired the event. +/// The pointer position. +/// The original event args. +public class PointerCommandArgs( + IChartView chart, + LvcPointD pointerPosition, + object originalEventArgs) : ChartCommandArgs(chart) { - /// - /// Initializes a new instance of the class. - /// - /// The chart that fired the event. - /// The pointer position. - /// The original event args. - public PointerCommandArgs( - IChartView chart, - LvcPointD pointerPosition, - object originalEventArgs) - : base(chart) - { - PointerPosition = pointerPosition; - OriginalEventArgs = originalEventArgs; - } /// /// Gets the pointer position relative to the chart. /// - public LvcPointD PointerPosition { get; set; } + public LvcPointD PointerPosition { get; set; } = pointerPosition; /// /// Gets the framework-specific event arguments. /// - public object OriginalEventArgs { get; set; } + public object OriginalEventArgs { get; set; } = originalEventArgs; } diff --git a/src/LiveChartsCore/Kernel/Extensions.cs b/src/LiveChartsCore/Kernel/Extensions.cs index 0e5285b65..df78ad8de 100644 --- a/src/LiveChartsCore/Kernel/Extensions.cs +++ b/src/LiveChartsCore/Kernel/Extensions.cs @@ -709,14 +709,9 @@ private static IEnumerable YieldReturnUntilNextNullChartPoint( builder.Finished = true; } - private class GapsBuilder : IDisposable + private class GapsBuilder(IEnumerator enumerator) : IDisposable { - public GapsBuilder(IEnumerator enumerator) - { - Enumerator = enumerator; - } - - public IEnumerator Enumerator { get; } + public IEnumerator Enumerator { get; } = enumerator; public bool IsEmpty { get; set; } = true; @@ -728,23 +723,15 @@ public void Dispose() } } - internal class SplineData + internal class SplineData(ChartPoint start) { - public SplineData(ChartPoint start) - { - Previous = start; - Current = start; - Next = start; - AfterNext = start; - } - - public ChartPoint Previous { get; set; } + public ChartPoint Previous { get; set; } = start; - public ChartPoint Current { get; set; } + public ChartPoint Current { get; set; } = start; - public ChartPoint Next { get; set; } + public ChartPoint Next { get; set; } = start; - public ChartPoint AfterNext { get; set; } + public ChartPoint AfterNext { get; set; } = start; public bool IsFirst { get; set; } = true; public bool IsNextEmpty { get; set; } diff --git a/src/LiveChartsCore/Kernel/LiveChartsSettings.cs b/src/LiveChartsCore/Kernel/LiveChartsSettings.cs index 91d8bcbd7..a440515f3 100644 --- a/src/LiveChartsCore/Kernel/LiveChartsSettings.cs +++ b/src/LiveChartsCore/Kernel/LiveChartsSettings.cs @@ -24,7 +24,6 @@ using System; using System.Collections.Generic; -using LiveChartsCore.Defaults; using LiveChartsCore.Drawing; using LiveChartsCore.Kernel.Providers; using LiveChartsCore.Measure; @@ -38,7 +37,7 @@ namespace LiveChartsCore.Kernel; public class LiveChartsSettings { private object? _currentProvider; - private readonly Dictionary _mappers = new(); + private readonly Dictionary _mappers = []; private object _theme = new(); /// @@ -382,9 +381,7 @@ public Theme GetTheme() } /// - /// Enables LiveCharts to be able to plot short, int, long, float, double, decimal, short?, int?, long?, float?, double?, decimal?, - /// , , , and - /// . + /// Enables LiveCharts to be able to plot short, int, long, float, double, decimal, short?, int?, long?, float?, double?, decimal?. /// /// public LiveChartsSettings AddDefaultMappers() diff --git a/src/LiveChartsCore/Kernel/Providers/DataFactory.cs b/src/LiveChartsCore/Kernel/Providers/DataFactory.cs index 173a358f2..c7cb1027c 100644 --- a/src/LiveChartsCore/Kernel/Providers/DataFactory.cs +++ b/src/LiveChartsCore/Kernel/Providers/DataFactory.cs @@ -40,7 +40,7 @@ public class DataFactory where TDrawingContext : DrawingContext { private readonly bool _isTModelChartEntity = false; - private readonly Dictionary> _chartIndexEntityMap = new(); + private readonly Dictionary> _chartIndexEntityMap = []; private ISeries? _series; /// @@ -380,12 +380,12 @@ private IEnumerable EnumerateChartEntities(ISeries series, _ = _chartIndexEntityMap.TryGetValue(canvas.Sync, out var d); if (d is null) { - d = new Dictionary(); + d = []; _chartIndexEntityMap[canvas.Sync] = d; } var IndexEntityMap = d; - foreach (var item in series.Values) + foreach (var item in series.Values.Cast()) { if (item is null) { diff --git a/src/LiveChartsCore/Kernel/SeriesContext.cs b/src/LiveChartsCore/Kernel/SeriesContext.cs index 2123f6ee4..be8c9e553 100644 --- a/src/LiveChartsCore/Kernel/SeriesContext.cs +++ b/src/LiveChartsCore/Kernel/SeriesContext.cs @@ -33,11 +33,14 @@ namespace LiveChartsCore.Kernel; /// Defines a series context. /// /// The type of the drawing context. -public class SeriesContext +/// +/// Initializes a new instance of the class. +/// +/// The series. +/// The chart +public class SeriesContext(IEnumerable> series, IChart chart) where TDrawingContext : DrawingContext { - private readonly IEnumerable> _series; - private int _columnsCount = 0; private int _rowsCount = 0; private int _boxCount = 0; @@ -47,26 +50,13 @@ public class SeriesContext private bool _arePieLabeleMeasured = false; private float _pieLabelsSize = 0f; - private readonly Dictionary, int> _columnPositions = new(); - private readonly Dictionary, int> _rowPositions = new(); - private readonly Dictionary, int> _boxPositions = new(); - private readonly Dictionary _stackColumnPositions = new(); - private readonly Dictionary _stackRowsPositions = new(); - - private readonly Dictionary> _stackers = new(); + private readonly Dictionary, int> _columnPositions = []; + private readonly Dictionary, int> _rowPositions = []; + private readonly Dictionary, int> _boxPositions = []; + private readonly Dictionary _stackColumnPositions = []; + private readonly Dictionary _stackRowsPositions = []; - private readonly IChart _chart; - - /// - /// Initializes a new instance of the class. - /// - /// The series. - /// The chart - public SeriesContext(IEnumerable> series, IChart chart) - { - _series = series; - _chart = chart; - } + private readonly Dictionary> _stackers = []; #region columns and rows @@ -202,7 +192,7 @@ private void IndexBars() _stackedColumnsCount = 0; _stackedRowsCount = 0; - foreach (var item in _series) + foreach (var item in series) { if (!item.IsBarSeries() && !item.IsBoxSeries()) continue; @@ -288,7 +278,7 @@ private Stacker GetStacker(IChartSeries series private void CalculatePieLabelsOuterSpace() where TLabel : class, ILabelGeometry, new() { - foreach (var series in _series) + foreach (var series in series) { if (!series.IsPieSeries()) continue; var pieSeries = (IPieSeries)series; @@ -302,7 +292,7 @@ private void CalculatePieLabelsOuterSpace() var stacker = GetStackPosition(series, series.GetStackGroup()) ?? throw new NullReferenceException("Unexpected null stacker"); - foreach (var point in pieSeries.Fetch(_chart)) + foreach (var point in pieSeries.Fetch(chart)) { _ = stacker.GetStack(point); // builds the stacked value for the point. diff --git a/src/LiveChartsCore/Kernel/Stacker.cs b/src/LiveChartsCore/Kernel/Stacker.cs index 56d5f2472..9389e5120 100644 --- a/src/LiveChartsCore/Kernel/Stacker.cs +++ b/src/LiveChartsCore/Kernel/Stacker.cs @@ -33,9 +33,9 @@ namespace LiveChartsCore.Kernel; public class Stacker where TDrawingContext : DrawingContext { - private readonly Dictionary, int> _stackPositions = new(); - private readonly List> _stack = new(); - private readonly Dictionary _totals = new(); + private readonly Dictionary, int> _stackPositions = []; + private readonly List> _stack = []; + private readonly Dictionary _totals = []; private int _stackCount = 0; private int _knownMaxLenght = 0; diff --git a/src/LiveChartsCore/Kernel/TooltipPlacementContext.cs b/src/LiveChartsCore/Kernel/TooltipPlacementContext.cs index b38fec0cb..eddba87ae 100644 --- a/src/LiveChartsCore/Kernel/TooltipPlacementContext.cs +++ b/src/LiveChartsCore/Kernel/TooltipPlacementContext.cs @@ -27,21 +27,17 @@ namespace LiveChartsCore.Kernel; /// /// Defines the tooltip placement context class. /// -public class TooltipPlacementContext +/// +/// Intializes a new instance of the class. +/// +/// +public class TooltipPlacementContext(TooltipPosition position) { - /// - /// Intializes a new instance of the class. - /// - /// - public TooltipPlacementContext(TooltipPosition position) - { - Position = position; - } /// /// Gets the tool tip position. /// - public TooltipPosition Position { get; set; } + public TooltipPosition Position { get; set; } = position; /// /// Gets or sets the value for the pop-up placement. diff --git a/src/LiveChartsCore/LiveChartsCore.csproj b/src/LiveChartsCore/LiveChartsCore.csproj index 64c7f75a8..49b10d6a0 100644 --- a/src/LiveChartsCore/LiveChartsCore.csproj +++ b/src/LiveChartsCore/LiveChartsCore.csproj @@ -2,22 +2,30 @@ enable - 11.0 + 12.0 - netstandard2.0;netcoreapp2.0;net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst - - $(TargetFrameworks);net6.0-windows10.0.19041;net462 + + netstandard2.0; + net6.0; + net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst + + + $(TargetFrameworks); + net462; + net6.0-windows10.0.19041.0; + net8.0-windows10.0.19041.0; - 14.2 - 14.0 - 21.0 - 10.0.17763.0 - 10.0.17763.0 + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 LiveChartsCore LiveChartsCore - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for .Net, this is the core package probably you need another package also unless you are building your own backed. MIT @@ -52,7 +60,9 @@ - + diff --git a/src/LiveChartsCore/Measure/AxisLimit.cs b/src/LiveChartsCore/Measure/AxisLimit.cs index 31034e389..37df73eb0 100644 --- a/src/LiveChartsCore/Measure/AxisLimit.cs +++ b/src/LiveChartsCore/Measure/AxisLimit.cs @@ -25,49 +25,41 @@ namespace LiveChartsCore.Measure; /// /// Defines the axis limit structure. /// -public struct AxisLimit +/// +/// Initializes a new instance of the struct. +/// +/// The min value. +/// The masx value. +/// The min delta. +/// The data min value. +/// The data max value. +public struct AxisLimit(double min, double max, double minDelta, double dataMin, double dataMax) { - /// - /// Initializes a new instance of the struct. - /// - /// The min value. - /// The masx value. - /// The min delta. - /// The data min value. - /// The data max value. - public AxisLimit(double min, double max, double minDelta, double dataMin, double dataMax) - { - Min = min; - Max = max; - MinDelta = minDelta; - DataMin = dataMin; - DataMax = dataMax; - } /// /// Gets or sets the minimum value. /// - public double Min { get; set; } + public double Min { get; set; } = min; /// /// Gets or sets the maximum value. /// - public double Max { get; set; } + public double Max { get; set; } = max; /// /// Gets or sets the minimum value. /// - public double DataMin { get; set; } + public double DataMin { get; set; } = dataMin; /// /// Gets or sets the maximum value. /// - public double DataMax { get; set; } + public double DataMax { get; set; } = dataMax; /// /// Gets or sets the min delta. /// - public double MinDelta { get; set; } + public double MinDelta { get; set; } = minDelta; internal static void ValidateLimits(ref double min, ref double max) { diff --git a/src/LiveChartsCore/Measure/VectorManager.cs b/src/LiveChartsCore/Measure/VectorManager.cs index 925dc03b7..ce23f27da 100644 --- a/src/LiveChartsCore/Measure/VectorManager.cs +++ b/src/LiveChartsCore/Measure/VectorManager.cs @@ -32,27 +32,21 @@ namespace LiveChartsCore.Measure; /// /// The type of the segment. /// The type of the drawing context. -public class VectorManager +/// +/// Initializes a new instance of the class. +/// +/// The area geometry +public class VectorManager(IVectorGeometry areaGeometry) where TDrawingContext : DrawingContext where TSegment : IConsecutivePathSegment, IAnimatable { - private LinkedListNode? _nextNode; + private LinkedListNode? _nextNode = areaGeometry.Commands.First; private LinkedListNode? _currentNode; - /// - /// Initializes a new instance of the class. - /// - /// The area geometry - public VectorManager(IVectorGeometry areaGeometry) - { - AreaGeometry = areaGeometry; - _nextNode = areaGeometry.Commands.First; - } - /// /// Gets the area geometry. /// - public IVectorGeometry AreaGeometry { get; private set; } + public IVectorGeometry AreaGeometry { get; private set; } = areaGeometry; /// /// Adds a segment to the area geometry. diff --git a/src/LiveChartsCore/Motion/MotionCanvas.cs b/src/LiveChartsCore/Motion/MotionCanvas.cs index 0a29dc940..0939df793 100644 --- a/src/LiveChartsCore/Motion/MotionCanvas.cs +++ b/src/LiveChartsCore/Motion/MotionCanvas.cs @@ -35,9 +35,9 @@ namespace LiveChartsCore.Motion; public class MotionCanvas : IDisposable where TDrawingContext : DrawingContext { - internal HashSet> _paintTasks = new(); + internal HashSet> _paintTasks = []; private readonly Stopwatch _stopwatch = new(); - private readonly List _fpsStack = new(); + private readonly List _fpsStack = []; private long _previousFrameTime; private long _previousLogTime; private object _sync = new(); @@ -81,7 +81,7 @@ public MotionCanvas() /// /// Gets the animatables collection. /// - public HashSet Trackers { get; } = new HashSet(); + public HashSet Trackers { get; } = []; /// /// Draws the frame. diff --git a/src/LiveChartsCore/PieChart.cs b/src/LiveChartsCore/PieChart.cs index bfbb00723..f1b592653 100644 --- a/src/LiveChartsCore/PieChart.cs +++ b/src/LiveChartsCore/PieChart.cs @@ -37,32 +37,23 @@ namespace LiveChartsCore; /// /// The type of the drawing context. /// -public class PieChart : Chart +/// +/// Initializes a new instance of the class. +/// +/// The view. +/// The default platform configuration. +/// The canvas. +public class PieChart( + IPieChartView view, + Action defaultPlatformConfig, + MotionCanvas canvas) : Chart(canvas, defaultPlatformConfig, view) where TDrawingContext : DrawingContext { - private readonly IPieChartView _chartView; private int _nextSeries = 0; - /// - /// Initializes a new instance of the class. - /// - /// The view. - /// The default platform configuration. - /// The canvas. - /// Forces the legends to redraw with every measure request. - public PieChart( - IPieChartView view, - Action defaultPlatformConfig, - MotionCanvas canvas, - bool requiresLegendMeasureAlways = false) - : base(canvas, defaultPlatformConfig, view) - { - _chartView = view; - } - /// public override IEnumerable> Series => - _chartView.Series.Cast>(); + view.Series?.Cast>() ?? []; /// public override IEnumerable> VisibleSeries => @@ -74,7 +65,7 @@ public PieChart( /// /// The view. /// - public override IChartView View => _chartView; + public override IChartView View => view; /// /// Gets the value bounds. @@ -107,7 +98,7 @@ public PieChart( /// public override IEnumerable FindHoveredPointsBy(LvcPoint pointerPosition) { - return _chartView.Series + return view.Series .Where(series => (series is IPieSeries pieSeries) && !pieSeries.IsFillSeries) .Where(series => series.IsHoverable) .SelectMany(series => series.FindHitPoints(this, pointerPosition, TooltipFindingStrategy.CompareAll)); @@ -142,19 +133,19 @@ protected internal override void Measure() MeasureWork = new object(); - var viewDrawMargin = _chartView.DrawMargin; - ControlSize = _chartView.ControlSize; + var viewDrawMargin = view.DrawMargin; + ControlSize = view.ControlSize; - VisualElements = _chartView.VisualElements ?? Array.Empty>(); + VisualElements = view.VisualElements ?? Array.Empty>(); - LegendPosition = _chartView.LegendPosition; - Legend = _chartView.Legend; + LegendPosition = view.LegendPosition; + Legend = view.Legend; - TooltipPosition = _chartView.TooltipPosition; - Tooltip = _chartView.Tooltip; + TooltipPosition = view.TooltipPosition; + Tooltip = view.Tooltip; - AnimationsSpeed = _chartView.AnimationsSpeed; - EasingFunction = _chartView.EasingFunction; + AnimationsSpeed = view.AnimationsSpeed; + EasingFunction = view.EasingFunction; SeriesContext = new SeriesContext(VisibleSeries, this); var isNewTheme = LiveCharts.DefaultSettings.CurrentThemeId != ThemeId; diff --git a/src/LiveChartsCore/PolarChart.cs b/src/LiveChartsCore/PolarChart.cs index 98087cb57..95bd96569 100644 --- a/src/LiveChartsCore/PolarChart.cs +++ b/src/LiveChartsCore/PolarChart.cs @@ -37,36 +37,27 @@ namespace LiveChartsCore; /// /// The type of the drawing context. /// -public class PolarChart : Chart +/// +/// Initializes a new instance of the class. +/// +/// The view. +/// The default platform configuration. +/// The canvas. +public class PolarChart( + IPolarChartView view, + Action defaultPlatformConfig, + MotionCanvas canvas) : Chart(canvas, defaultPlatformConfig, view) where TDrawingContext : DrawingContext { - private readonly IPolarChartView _chartView; private int _nextSeries = 0; - /// - /// Initializes a new instance of the class. - /// - /// The view. - /// The default platform configuration. - /// The canvas. - /// Forces the legends to redraw with every measure request. - public PolarChart( - IPolarChartView view, - Action defaultPlatformConfig, - MotionCanvas canvas, - bool requiresLegendMeasureAlways = false) - : base(canvas, defaultPlatformConfig, view) - { - _chartView = view; - } - /// /// Gets the angle axes. /// /// /// The x axes. /// - public IPolarAxis[] AngleAxes { get; private set; } = Array.Empty(); + public IPolarAxis[] AngleAxes { get; private set; } = []; /// /// Gets the radius axes. @@ -74,11 +65,11 @@ public PolarChart( /// /// The y axes. /// - public IPolarAxis[] RadiusAxes { get; private set; } = Array.Empty(); + public IPolarAxis[] RadiusAxes { get; private set; } = []; /// public override IEnumerable> Series => - _chartView.Series.Cast>(); + view.Series?.Cast>() ?? []; /// public override IEnumerable> VisibleSeries => @@ -119,7 +110,7 @@ public PolarChart( /// /// The view. /// - public override IChartView View => _chartView; + public override IChartView View => view; /// /// Finds the points near to the specified point. @@ -163,29 +154,46 @@ protected internal override void Measure() #region copy the current data in the view - var viewDrawMargin = _chartView.DrawMargin; - ControlSize = _chartView.ControlSize; + var viewDrawMargin = view.DrawMargin; + ControlSize = view.ControlSize; + + var a = view.AngleAxes; + var r = view.RadiusAxes; + + if (a is null || r is null) + { + // in theory nulls are not valid, see ChartTest.cs for more context. + var provider = LiveCharts.DefaultSettings.GetProvider(); + + a = [provider.GetDefaultPolarAxis()]; + r = [provider.GetDefaultPolarAxis()]; + } + + AngleAxes = a.Cast().ToArray(); + RadiusAxes = r.Cast().ToArray(); - AngleAxes = _chartView.AngleAxes.Cast().ToArray(); - RadiusAxes = _chartView.RadiusAxes.Cast().ToArray(); + if (AngleAxes.Length == 0 || RadiusAxes.Length == 0) + { + throw new Exception($"{nameof(AngleAxes)} and {nameof(RadiusAxes)} must contain at least one element."); + } var theme = LiveCharts.DefaultSettings.GetTheme(); - LegendPosition = _chartView.LegendPosition; - Legend = _chartView.Legend; + LegendPosition = view.LegendPosition; + Legend = view.Legend; - TooltipPosition = _chartView.TooltipPosition; - Tooltip = _chartView.Tooltip; + TooltipPosition = view.TooltipPosition; + Tooltip = view.Tooltip; - AnimationsSpeed = _chartView.AnimationsSpeed; - EasingFunction = _chartView.EasingFunction; + AnimationsSpeed = view.AnimationsSpeed; + EasingFunction = view.EasingFunction; - FitToBounds = _chartView.FitToBounds; - TotalAnge = (float)_chartView.TotalAngle; - InnerRadius = (float)_chartView.InnerRadius; - InitialRotation = (float)_chartView.InitialRotation; + FitToBounds = view.FitToBounds; + TotalAnge = (float)view.TotalAngle; + InnerRadius = (float)view.InnerRadius; + InitialRotation = (float)view.InitialRotation; - VisualElements = _chartView.VisualElements ?? Array.Empty>(); + VisualElements = view.VisualElements ?? Array.Empty>(); #endregion @@ -237,12 +245,17 @@ protected internal override void Measure() var seriesBounds = series.GetBounds(this, secondaryAxis, primaryAxis).Bounds; - if (seriesBounds.IsEmpty) continue; + if (seriesBounds.IsEmpty) + { + ce._isThemeSet = false; + continue; + } secondaryAxis.DataBounds.AppendValue(seriesBounds.SecondaryBounds); primaryAxis.DataBounds.AppendValue(seriesBounds.PrimaryBounds); secondaryAxis.VisibleDataBounds.AppendValue(seriesBounds.SecondaryBounds); primaryAxis.VisibleDataBounds.AppendValue(seriesBounds.PrimaryBounds); + ce._isThemeSet = false; } #region empty bounds diff --git a/src/LiveChartsCore/Section.cs b/src/LiveChartsCore/Section.cs index 9bc699756..317c42a4b 100644 --- a/src/LiveChartsCore/Section.cs +++ b/src/LiveChartsCore/Section.cs @@ -151,11 +151,8 @@ public IPaint? LabelPaint /// public int? ZIndex { get => _zIndex; set => SetProperty(ref _zIndex, value); } - /// - /// Gets the paint tasks. - /// - /// - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _stroke, _fill, _labelPaint }; } diff --git a/src/LiveChartsCore/Series.cs b/src/LiveChartsCore/Series.cs index 705b2184d..14d5c6bd5 100644 --- a/src/LiveChartsCore/Series.cs +++ b/src/LiveChartsCore/Series.cs @@ -56,7 +56,7 @@ public abstract class Series /// /// The subscribed to /// - protected readonly HashSet subscribedTo = new(); + protected readonly HashSet subscribedTo = []; /// /// The implements icp @@ -76,7 +76,7 @@ public abstract class Series /// /// The ever fetched points. /// - protected internal HashSet everFetched = new(); + protected internal HashSet everFetched = []; /// /// Indicates whether the custom measure handler was requested already. @@ -93,14 +93,8 @@ public abstract class Series /// protected bool _geometrySvgChanged = false; - /// - /// Will be deleted on future versions - /// - [Obsolete] - protected Func, string>? _obsolete_formatter = null; - private readonly CollectionDeepObserver _observer; - private IEnumerable? _values; + private ICollection? _values; private string? _name; private Func? _mapping; private int _zIndex; @@ -146,7 +140,7 @@ SeriesProperties IInternalSeries.SeriesProperties /// /// Gets or sets the data set to draw in the chart. /// - public IEnumerable? Values + public ICollection? Values { get => _values; set @@ -158,8 +152,6 @@ public IEnumerable? Values } } - IEnumerable? ISeries.Values { get => Values; set => Values = (IEnumerable?)value; } - /// public double Pivot { get => pivot; set => SetProperty(ref pivot, (float)value); } @@ -233,22 +225,6 @@ public string? GeometrySvg /// public int ZIndex { get => _zIndex; set => SetProperty(ref _zIndex, value); } - /// - /// Gets or sets the tool tip label formatter, this function will build the label when a point in this series - /// is shown inside a tool tip. - /// - /// - /// The tool tip label formatter. - /// - [Obsolete( - $"You must now use {nameof(CartesianSeries.XToolTipLabelFormatter)} or " + - $"{nameof(CartesianSeries.YToolTipLabelFormatter)} instead.")] - public Func, string>? TooltipLabelFormatter - { - get => _obsolete_formatter; - set => _obsolete_formatter = value; - } - /// /// Gets or sets the data label formatter, this function will build the label when a point in this series /// is shown as data label. @@ -428,7 +404,7 @@ public override void RemoveFromUI(Chart chart) base.RemoveFromUI(chart); DataFactory?.Dispose(chart); _dataFactory = null; - everFetched = new HashSet(); + everFetched = []; } /// diff --git a/src/LiveChartsCore/StrokeAndFillCartesianSeries.cs b/src/LiveChartsCore/StrokeAndFillCartesianSeries.cs index c5efe1037..6a8c4dc8a 100644 --- a/src/LiveChartsCore/StrokeAndFillCartesianSeries.cs +++ b/src/LiveChartsCore/StrokeAndFillCartesianSeries.cs @@ -74,12 +74,8 @@ public IPaint? Fill set => SetPaintProperty(ref _fill, value); } - /// - /// Gets the paint tasks. - /// - /// - /// - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _stroke, _fill, DataLabelsPaint }; } diff --git a/src/LiveChartsCore/Themes/Theme.cs b/src/LiveChartsCore/Themes/Theme.cs index a2e3edbe6..20076fadf 100644 --- a/src/LiveChartsCore/Themes/Theme.cs +++ b/src/LiveChartsCore/Themes/Theme.cs @@ -40,7 +40,7 @@ public class Theme /// /// Gets or sets the theme colors. /// - public LvcColor[] Colors { get; set; } = Array.Empty(); + public LvcColor[] Colors { get; set; } = []; /// /// Gets or sets the axis builder. @@ -48,7 +48,7 @@ public class Theme /// /// The axis builder. /// - public List>> AxisBuilder { get; set; } = new(); + public List>> AxisBuilder { get; set; } = []; /// /// Gets or sets the draw margin frame builder. @@ -56,7 +56,7 @@ public class Theme /// /// The draw margin frame builder. /// - public List>> DrawMarginFrameBuilder { get; set; } = new(); + public List>> DrawMarginFrameBuilder { get; set; } = []; /// /// Gets or sets the series builder. @@ -64,7 +64,7 @@ public class Theme /// /// The pie series builder. /// - public List>> SeriesBuilder { get; set; } = new(); + public List>> SeriesBuilder { get; set; } = []; /// /// Gets or sets the pie series builder. @@ -72,7 +72,7 @@ public class Theme /// /// The pie series builder. /// - public List>> PieSeriesBuilder { get; set; } = new(); + public List>> PieSeriesBuilder { get; set; } = []; /// /// Gets or sets the gauge series builder. @@ -80,7 +80,7 @@ public class Theme /// /// The pie series builder. /// - public List>> GaugeSeriesBuilder { get; set; } = new(); + public List>> GaugeSeriesBuilder { get; set; } = []; /// /// Gets or sets the gauge fill series builder. @@ -88,7 +88,7 @@ public class Theme /// /// The pie series builder. /// - public List>> GaugeFillSeriesBuilder { get; set; } = new(); + public List>> GaugeFillSeriesBuilder { get; set; } = []; /// /// Gets or sets the Cartesian series builder. @@ -96,7 +96,7 @@ public class Theme /// /// The pie series builder. /// - public List>> CartesianSeriesBuilder { get; set; } = new(); + public List>> CartesianSeriesBuilder { get; set; } = []; /// /// Gets or sets the stepline series builder. @@ -104,7 +104,7 @@ public class Theme /// /// The pie series builder. /// - public List>> StepLineSeriesBuilder { get; set; } = new(); + public List>> StepLineSeriesBuilder { get; set; } = []; /// /// Gets or sets the stacked stepline series builder. @@ -112,7 +112,7 @@ public class Theme /// /// The pie series builder. /// - public List>> StackedStepLineSeriesBuilder { get; set; } = new(); + public List>> StackedStepLineSeriesBuilder { get; set; } = []; /// /// Gets or sets the line series builder. @@ -120,7 +120,7 @@ public class Theme /// /// The pie series builder. /// - public List>> LineSeriesBuilder { get; set; } = new(); + public List>> LineSeriesBuilder { get; set; } = []; /// /// Gets or sets the line series builder. @@ -128,7 +128,7 @@ public class Theme /// /// The polar series builder. /// - public List>> PolarSeriesBuilder { get; set; } = new(); + public List>> PolarSeriesBuilder { get; set; } = []; /// /// Gets or sets the line series builder. @@ -136,7 +136,7 @@ public class Theme /// /// The polar series builder. /// - public List>> PolarLineSeriesBuilder { get; set; } = new(); + public List>> PolarLineSeriesBuilder { get; set; } = []; /// /// Gets or sets the line series builder. @@ -144,7 +144,7 @@ public class Theme /// /// The polar series builder. /// - public List>> StackedPolarSeriesBuilder { get; set; } = new(); + public List>> StackedPolarSeriesBuilder { get; set; } = []; /// /// Gets or sets the line series builder. @@ -152,7 +152,7 @@ public class Theme /// /// The pie series builder. /// - public List>> HeatSeriesBuilder { get; set; } = new(); + public List>> HeatSeriesBuilder { get; set; } = []; /// /// Gets or sets the financial series builder. @@ -160,7 +160,7 @@ public class Theme /// /// The pie series builder. /// - public List>> FinancialSeriesBuilder { get; set; } = new(); + public List>> FinancialSeriesBuilder { get; set; } = []; /// /// Gets or sets the stacked line series builder. @@ -168,7 +168,7 @@ public class Theme /// /// The pie series builder. /// - public List>> StackedLineSeriesBuilder { get; set; } = new(); + public List>> StackedLineSeriesBuilder { get; set; } = []; /// /// Gets or sets the bar series builder. @@ -176,7 +176,7 @@ public class Theme /// /// The pie series builder. /// - public List>> BarSeriesBuilder { get; set; } = new(); + public List>> BarSeriesBuilder { get; set; } = []; /// /// Gets or sets the column series builder. @@ -184,7 +184,7 @@ public class Theme /// /// The pie series builder. /// - public List>> ColumnSeriesBuilder { get; set; } = new(); + public List>> ColumnSeriesBuilder { get; set; } = []; /// /// Gets or sets the row series builder. @@ -192,7 +192,7 @@ public class Theme /// /// The pie series builder. /// - public List>> RowSeriesBuilder { get; set; } = new(); + public List>> RowSeriesBuilder { get; set; } = []; /// /// Gets or sets the stacked bar series builder. @@ -200,7 +200,7 @@ public class Theme /// /// The pie series builder. /// - public List>> StackedBarSeriesBuilder { get; set; } = new(); + public List>> StackedBarSeriesBuilder { get; set; } = []; /// /// Gets or sets the stacked column series builder. @@ -208,7 +208,7 @@ public class Theme /// /// The pie series builder. /// - public List>> StackedColumnSeriesBuilder { get; set; } = new(); + public List>> StackedColumnSeriesBuilder { get; set; } = []; /// /// Gets or sets the stacked row series builder. @@ -216,7 +216,7 @@ public class Theme /// /// The pie series builder. /// - public List>> StackedRowSeriesBuilder { get; set; } = new(); + public List>> StackedRowSeriesBuilder { get; set; } = []; /// /// Gets or sets the scatter series builder. @@ -224,7 +224,7 @@ public class Theme /// /// The pie series builder. /// - public List>> ScatterSeriesBuilder { get; set; } = new(); + public List>> ScatterSeriesBuilder { get; set; } = []; /// /// Gets or sets the error series builder. @@ -232,7 +232,7 @@ public class Theme /// /// The pie series builder. /// - public List>> BoxSeriesBuilder { get; set; } = new(); + public List>> BoxSeriesBuilder { get; set; } = []; /// /// Applies the theme to an axis. diff --git a/src/LiveChartsCore/VisualElements/AngularTicksVisual.cs b/src/LiveChartsCore/VisualElements/AngularTicksVisual.cs index 6f840fcfe..475b216c5 100644 --- a/src/LiveChartsCore/VisualElements/AngularTicksVisual.cs +++ b/src/LiveChartsCore/VisualElements/AngularTicksVisual.cs @@ -22,9 +22,9 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using LiveChartsCore.Drawing; +using LiveChartsCore.Kernel; using LiveChartsCore.Kernel.Sketches; namespace LiveChartsCore.VisualElements; @@ -50,7 +50,8 @@ public class AngularTicksVisual _visuals = new(); + private readonly Dictionary _visuals = []; + private Func _labeler = Labelers.Default; /// /// Gets or sets the labels paint. @@ -90,6 +91,11 @@ public IPaint? Stroke /// public double LabelsSize { get => _labelsSize; set => SetProperty(ref _labelsSize, value); } + /// + /// Gets or sets the labeler, a function that receives a number and return the label content as string. + /// + public Func Labeler { get => _labeler; set => SetProperty(ref _labeler, value); } + /// protected internal override void OnInvalidated(Chart chart) { @@ -204,7 +210,7 @@ protected internal override void OnInvalidated(Chart chart) visual.Tick.X1 = cx + (float)Math.Cos(beta) * ticksRadius; visual.Tick.Y1 = cy + (float)Math.Sin(beta) * ticksRadius; - visual.Label.Text = i.ToString(); + visual.Label.Text = Labeler(i); visual.Label.X = cx + (float)Math.Cos(beta) * labelsRadius; visual.Label.Y = cy + (float)Math.Sin(beta) * labelsRadius; visual.Label.TextSize = labelsSize; @@ -262,8 +268,6 @@ protected internal override void OnInvalidated(Chart chart) Stroke?.RemoveGeometryFromPainTask(chart.Canvas, subtick); _ = _visuals.Remove(key); } - - Trace.WriteLine(_visuals.Count); } /// @@ -276,7 +280,8 @@ public override LvcSize Measure(Chart chart) protected internal override void SetParent(IGeometry parent) { } - internal override IAnimatable?[] GetDrawnGeometries() + /// + protected internal override IAnimatable?[] GetDrawnGeometries() { var count = _visuals.Count + // the ticks @@ -300,23 +305,17 @@ protected internal override void SetParent(IGeometry parent) return l; } - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _stroke, _labelsPaint }; } - private class TickVisual + private class TickVisual(TLabelGeometry label, TLineGeometry line, TLineGeometry[] subseparator) { - public TickVisual(TLabelGeometry label, TLineGeometry line, TLineGeometry[] subseparator) - { - Label = label; - Tick = line; - Subseparator = subseparator; - } - - public TLabelGeometry Label { get; set; } - public TLineGeometry Tick { get; set; } - public TLineGeometry[] Subseparator { get; set; } + public TLabelGeometry Label { get; set; } = label; + public TLineGeometry Tick { get; set; } = line; + public TLineGeometry[] Subseparator { get; set; } = subseparator; public object UpdateId { get; set; } = new(); } } diff --git a/src/LiveChartsCore/VisualElements/BaseGeometryVisual.cs b/src/LiveChartsCore/VisualElements/BaseGeometryVisual.cs index 574cf45a4..bc316c015 100644 --- a/src/LiveChartsCore/VisualElements/BaseGeometryVisual.cs +++ b/src/LiveChartsCore/VisualElements/BaseGeometryVisual.cs @@ -74,7 +74,7 @@ public IPaint? Stroke } /// - internal override IPaint?[] GetPaintTasks() + protected internal override IPaint?[] GetPaintTasks() { return new[] { _fill, _stroke }; } diff --git a/src/LiveChartsCore/VisualElements/GeometryVisual.cs b/src/LiveChartsCore/VisualElements/GeometryVisual.cs index e76908249..75974b307 100644 --- a/src/LiveChartsCore/VisualElements/GeometryVisual.cs +++ b/src/LiveChartsCore/VisualElements/GeometryVisual.cs @@ -66,7 +66,8 @@ public IPaint? LabelPaint set => SetPaintProperty(ref _labelPaint, value); } - internal override IAnimatable?[] GetDrawnGeometries() + /// + protected internal override IAnimatable?[] GetDrawnGeometries() { return new IAnimatable?[] { _geometry, _labelGeometry }; } @@ -169,7 +170,8 @@ public override LvcSize Measure(Chart chart) return new LvcSize(w, h); } - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { Fill, Stroke, _labelPaint }; } diff --git a/src/LiveChartsCore/VisualElements/LabelVisual.cs b/src/LiveChartsCore/VisualElements/LabelVisual.cs index 37d917245..6fc397ea5 100644 --- a/src/LiveChartsCore/VisualElements/LabelVisual.cs +++ b/src/LiveChartsCore/VisualElements/LabelVisual.cs @@ -22,6 +22,7 @@ using System; using LiveChartsCore.Drawing; +using LiveChartsCore.Kernel; using LiveChartsCore.Measure; namespace LiveChartsCore.VisualElements; @@ -96,12 +97,14 @@ public IPaint? Paint /// public float MaxWidth { get => _maxWidth; set => SetProperty(ref _maxWidth, value); } - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _paint }; } - internal override IAnimatable?[] GetDrawnGeometries() + /// + protected internal override IAnimatable?[] GetDrawnGeometries() { return new IAnimatable?[] { _labelGeometry }; } diff --git a/src/LiveChartsCore/VisualElements/NeedleVisual.cs b/src/LiveChartsCore/VisualElements/NeedleVisual.cs index b02d12330..1bb8c1cb8 100644 --- a/src/LiveChartsCore/VisualElements/NeedleVisual.cs +++ b/src/LiveChartsCore/VisualElements/NeedleVisual.cs @@ -134,12 +134,14 @@ protected internal override void SetParent(IGeometry parent) _geometry.Parent = parent; } - internal override IAnimatable?[] GetDrawnGeometries() + /// + protected internal override IAnimatable?[] GetDrawnGeometries() { return new IAnimatable?[] { _geometry }; } - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _fill }; } diff --git a/src/LiveChartsCore/VisualElements/RelativePanel.cs b/src/LiveChartsCore/VisualElements/RelativePanel.cs index cb9c4c301..c672cc51d 100644 --- a/src/LiveChartsCore/VisualElements/RelativePanel.cs +++ b/src/LiveChartsCore/VisualElements/RelativePanel.cs @@ -52,7 +52,7 @@ public RelativePanel() /// /// Gets the children collection. /// - public HashSet> Children { get; } = new(); + public HashSet> Children { get; } = []; /// /// Gets or sets the background paint. @@ -68,12 +68,14 @@ public IPaint? BackgroundPaint /// public TBackgroundGeometry BackgroundGeometry { get; } = new(); - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _backgroundPaint }; } - internal override IAnimatable?[] GetDrawnGeometries() + /// + protected internal override IAnimatable?[] GetDrawnGeometries() { return new IAnimatable?[] { BackgroundGeometry }; } diff --git a/src/LiveChartsCore/VisualElements/StackPanel.cs b/src/LiveChartsCore/VisualElements/StackPanel.cs index a32f7c3e5..1a0f5b8f4 100644 --- a/src/LiveChartsCore/VisualElements/StackPanel.cs +++ b/src/LiveChartsCore/VisualElements/StackPanel.cs @@ -55,7 +55,7 @@ public StackPanel() /// /// Gets the children collection. /// - public List> Children { get; } = new(); + public List> Children { get; } = []; /// /// Gets or sets the panel orientation. @@ -101,12 +101,14 @@ public IPaint? BackgroundPaint /// public double MaxHeight { get => _maxHeight; set => SetProperty(ref _maxHeight, value); } - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _backgroundPaint }; } - internal override IAnimatable?[] GetDrawnGeometries() + /// + protected internal override IAnimatable?[] GetDrawnGeometries() { return new IAnimatable?[] { BackgroundGeometry }; } @@ -176,7 +178,7 @@ public override LvcSize Measure(Chart chart) var mx = 0f; var my = 0f; - List line = new(); + List line = []; LvcSize alignCurrentLine() { @@ -212,7 +214,7 @@ LvcSize alignCurrentLine() if (child.Size.Height > my) my = child.Size.Height; } - line = new(); + line = []; return new LvcSize(mx, my); } @@ -287,15 +289,9 @@ public override void RemoveFromUI(Chart chart) base.RemoveFromUI(chart); } - private class MeasureResult + private class MeasureResult(VisualElement visual, LvcSize size) { - public MeasureResult(VisualElement visual, LvcSize size) - { - Visual = visual; - Size = size; - } - - public VisualElement Visual { get; set; } - public LvcSize Size { get; set; } + public VisualElement Visual { get; set; } = visual; + public LvcSize Size { get; set; } = size; } } diff --git a/src/LiveChartsCore/VisualElements/TableLayout.cs b/src/LiveChartsCore/VisualElements/TableLayout.cs index 2c32bc074..d505f84a6 100644 --- a/src/LiveChartsCore/VisualElements/TableLayout.cs +++ b/src/LiveChartsCore/VisualElements/TableLayout.cs @@ -37,7 +37,7 @@ public class TableLayout : VisualElement, new() { private IPaint? _backgroundPaint; - private readonly Dictionary> _positions = new(); + private readonly Dictionary> _positions = []; private LvcSize[,] _measuredSizes = new LvcSize[0, 0]; private int _maxRow = 0; private int _maxColumn = 0; @@ -149,7 +149,7 @@ public void AddChild( Align? verticalAlign = null) { if (!_positions.TryGetValue(row, out var r)) - _positions.Add(row, r = new Dictionary()); + _positions.Add(row, r = []); r[column] = new(row, column, child, verticalAlign, horizontalAlign); if (row > _maxRow) _maxRow = row; @@ -252,12 +252,14 @@ protected internal override void SetParent(IGeometry parent) BackgroundGeometry.Parent = parent; } - internal override IAnimatable?[] GetDrawnGeometries() + /// + protected internal override IAnimatable?[] GetDrawnGeometries() { return new IAnimatable?[] { BackgroundGeometry }; } - internal override IPaint?[] GetPaintTasks() + /// + protected internal override IPaint?[] GetPaintTasks() { return new[] { _backgroundPaint }; } @@ -287,54 +289,46 @@ internal override IEnumerable> IsHitBy(Chart /// Defines a cell in the . /// - public class TableCell + /// + /// Initializes a new instance of the class. + /// + /// The row index. + /// The column index. + /// The visual to add. + /// The cell vertical alignment, if null the alignment will be defined by the layout. + /// The cell horizontal alignment, if null the alignment will be defined by the layout. + public class TableCell( + int row, + int column, + VisualElement visualElement, + Align? verticalAlign = null, + Align? horizontalAlign = null) { - /// - /// Initializes a new instance of the class. - /// - /// The row index. - /// The column index. - /// The visual to add. - /// The cell vertical alignment, if null the alignment will be defined by the layout. - /// The cell horizontal alignment, if null the alignment will be defined by the layout. - public TableCell( - int row, - int column, - VisualElement visualElement, - Align? verticalAlign = null, - Align? horizontalAlign = null) - { - Row = row; - Column = column; - VisualElement = visualElement; - VerticalAlign = verticalAlign; - HorizontalAlign = horizontalAlign; - } /// /// Gets the row. /// - public int Row { get; } + public int Row { get; } = row; /// /// Gets the column. /// - public int Column { get; } + public int Column { get; } = column; /// /// Gets or sets the vertical alignment. /// - public Align? VerticalAlign { get; } + public Align? VerticalAlign { get; } = verticalAlign; /// /// Gets or sets the horizontal alignment. /// - public Align? HorizontalAlign { get; } + public Align? HorizontalAlign { get; } = horizontalAlign; /// /// Gets the visual element. /// - public VisualElement VisualElement { get; } + public VisualElement VisualElement { get; } = visualElement; } } diff --git a/src/LiveChartsCore/VisualElements/VariableGeometryVisual.cs b/src/LiveChartsCore/VisualElements/VariableGeometryVisual.cs index 5324a7ab3..2dc6a3249 100644 --- a/src/LiveChartsCore/VisualElements/VariableGeometryVisual.cs +++ b/src/LiveChartsCore/VisualElements/VariableGeometryVisual.cs @@ -31,31 +31,25 @@ namespace LiveChartsCore.VisualElements; /// Defines a visual element that is useful to create series miniatures in the tool tips and legends. /// /// The type of the drawing context. -public class VariableGeometryVisual : BaseGeometryVisual +/// +/// Initializes a new instance of the class. +/// +/// +public class VariableGeometryVisual(ISizedGeometry geometry) : BaseGeometryVisual where TDrawingContext : DrawingContext { - private ISizedGeometry _geometry; private bool _isInitialized; - /// - /// Initializes a new instance of the class. - /// - /// - public VariableGeometryVisual(ISizedGeometry geometry) - { - _geometry = geometry; - } - /// /// Gets or sets the geometry. /// public ISizedGeometry Geometry { - get => _geometry; + get => geometry; set { - if (_geometry == value) return; - _geometry = value; + if (geometry == value) return; + geometry = value; _isInitialized = false; OnPropertyChanged(); } @@ -66,9 +60,10 @@ public ISizedGeometry Geometry /// public event Action>? GeometryInitialized; - internal override IAnimatable?[] GetDrawnGeometries() + /// + protected internal override IAnimatable?[] GetDrawnGeometries() { - return new IAnimatable?[] { _geometry }; + return new IAnimatable?[] { geometry }; } /// @@ -127,8 +122,8 @@ protected internal override void OnInvalidated(Chart chart) /// protected internal override void SetParent(IGeometry parent) { - if (_geometry is null) return; - _geometry.Parent = parent; + if (geometry is null) return; + geometry.Parent = parent; } /// diff --git a/src/LiveChartsCore/VisualElements/VisualElement.cs b/src/LiveChartsCore/VisualElements/VisualElement.cs index 61b37b661..9cd9e689e 100644 --- a/src/LiveChartsCore/VisualElements/VisualElement.cs +++ b/src/LiveChartsCore/VisualElements/VisualElement.cs @@ -198,7 +198,11 @@ internal void InvokePointerDown(VisualElementEventArgs args) PointerDown?.Invoke(this, args); } - internal abstract IAnimatable?[] GetDrawnGeometries(); + /// + /// Gets the geometries to draw. + /// + /// The geometries. + protected internal abstract IAnimatable?[] GetDrawnGeometries(); internal virtual void AlignToTopLeftCorner() { diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/CartesianChart.axaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/CartesianChart.axaml.cs index bc161f226..665f7cf79 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/CartesianChart.axaml.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/CartesianChart.axaml.cs @@ -206,7 +206,7 @@ public CartesianChart() /// public static readonly AvaloniaProperty> EasingFunctionProperty = AvaloniaProperty.Register>( - nameof(AnimationsSpeed), LiveCharts.DefaultSettings.EasingFunction, inherits: true); + nameof(EasingFunction), LiveCharts.DefaultSettings.EasingFunction, inherits: true); /// /// The tool tip position property @@ -850,12 +850,12 @@ private void OnCoreMeasuring(IChartView chart) Measuring?.Invoke(this); } - private void CartesianChart_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void CartesianChart_AttachedToVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { _core?.Load(); } - private void CartesianChart_DetachedFromVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void CartesianChart_DetachedFromVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { _core?.Unload(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/GeoMap.axaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/GeoMap.axaml.cs index 5f42f7255..287b4794f 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/GeoMap.axaml.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/GeoMap.axaml.cs @@ -274,7 +274,7 @@ private void OnPointerLeave(object? sender, PointerEventArgs e) _core?.InvokePointerLeft(); } - private void GeoMap_DetachedFromVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void GeoMap_DetachedFromVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { if (_core is null) return; _core.Unload(); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj index dbbab79a0..ed9b12ace 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj @@ -1,12 +1,14 @@ Library - 11.0 + 12.0 enable - netcoreapp2.0;netstandard2.0;net462;net6.0 + + netstandard2.0;net6.0;net8.0; + LiveChartsCore.SkiaSharpView.Avalonia LiveChartsCore.SkiaSharpView.Avalonia - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for AvaloniaUI. MIT diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/MotionCanvas.axaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/MotionCanvas.axaml.cs index efee6ad2c..2a892d280 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/MotionCanvas.axaml.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/MotionCanvas.axaml.cs @@ -22,7 +22,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; @@ -35,7 +34,7 @@ using LiveChartsCore.Motion; using LiveChartsCore.SkiaSharpView.Drawing; using SkiaSharp; -using a = Avalonia.Media; +using AvaloniaMedia = Avalonia.Media; namespace LiveChartsCore.SkiaSharpView.Avalonia; @@ -91,10 +90,10 @@ public List> PaintTasks /// Renders the control. /// p /// - public override void Render(a.DrawingContext context) + public override void Render(AvaloniaMedia.DrawingContext context) { if (_isDeatached) return; - var drawOperation = new CustomDrawOp(this, CanvasCore, new Rect(0, 0, Bounds.Width, Bounds.Height)); + var drawOperation = new CustomDrawOp(CanvasCore, new Rect(0, 0, Bounds.Width, Bounds.Height)); context.Custom(drawOperation); if (CanvasCore.IsValid) return; @@ -125,13 +124,13 @@ private void OnCanvasCoreInvalidated(MotionCanvas sende InvalidateVisual(); } - private void MotionCanvas_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void MotionCanvas_AttachedToVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { _isDeatached = false; CanvasCore.Invalidated += OnCanvasCoreInvalidated; } - private void MotionCanvas_DetachedFromVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void MotionCanvas_DetachedFromVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { _isDeatached = true; CanvasCore.Invalidated -= OnCanvasCoreInvalidated; @@ -139,24 +138,30 @@ private void MotionCanvas_DetachedFromVisualTree(object sender, VisualTreeAttach } // based on: - // https://github.com/AvaloniaUI/Avalonia/blob/release/11.0.0-preview1/samples/RenderDemo/Pages/CustomSkiaPage.cs - private class CustomDrawOp : ICustomDrawOperation + // https://github.com/AvaloniaUI/Avalonia/blob/release/11.0.0/samples/RenderDemo/Pages/CustomSkiaPage.cs + private class CustomDrawOp(MotionCanvas motionCanvas, Rect bounds) + : ICustomDrawOperation { - private readonly MotionCanvas _avaloniaControl; - private readonly MotionCanvas _motionCanvas; + public Rect Bounds { get; } = bounds; - public CustomDrawOp( - MotionCanvas avaloniaControl, MotionCanvas motionCanvas, Rect bounds) + public void Render(AvaloniaMedia.ImmediateDrawingContext context) { - _avaloniaControl = avaloniaControl; - _motionCanvas = motionCanvas; - Bounds = bounds; + if (!context.TryGetFeature(out var leaseFeature)) + throw new Exception("SkiaSharp is not supported."); + + using var lease = leaseFeature.Lease(); + + motionCanvas.DrawFrame( + new SkiaSharpDrawingContext( + motionCanvas, + new SKImageInfo((int)Bounds.Width, (int)Bounds.Height), + lease.SkSurface, + lease.SkCanvas, + false)); } public void Dispose() { } - public Rect Bounds { get; } - public bool HitTest(Point p) { return false; @@ -166,29 +171,5 @@ public bool Equals(ICustomDrawOperation? other) { return false; } - - public void Render(a.ImmediateDrawingContext context) - { - if (!context.TryGetFeature(out var leaseFeature)) - throw new Exception("SkiaSharp is not supported."); - - using var lease = leaseFeature.Lease(); - -#if DEBUG - if (LiveCharts.EnableLogging) - { - Trace.WriteLine( - $"[rendering] ".PadRight(60) + - $"tread: {Environment.CurrentManagedThreadId}"); - } -#endif - _motionCanvas.DrawFrame( - new SkiaSharpDrawingContext( - _motionCanvas, - new SKImageInfo((int)Bounds.Width, (int)Bounds.Height), - lease.SkSurface, - lease.SkCanvas, - false)); - } } } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PieChart.axaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PieChart.axaml.cs index 7b0042005..54d8d9672 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PieChart.axaml.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PieChart.axaml.cs @@ -646,7 +646,7 @@ private void Chart_PointerMoved(object? sender, PointerEventArgs e) _core?.InvokePointerMove(new LvcPoint((float)p.X, (float)p.Y)); } - private void Chart_PointerPressed(object sender, PointerPressedEventArgs e) + private void Chart_PointerPressed(object? sender, PointerPressedEventArgs e) { var p = e.GetPosition(this); @@ -659,7 +659,7 @@ private void Chart_PointerPressed(object sender, PointerPressedEventArgs e) _core?.InvokePointerDown(new LvcPoint((float)p.X, (float)p.Y), false); } - private void PieChart_PointerReleased(object sender, PointerReleasedEventArgs e) + private void PieChart_PointerReleased(object? sender, PointerReleasedEventArgs e) { var p = e.GetPosition(this); @@ -696,12 +696,12 @@ private void Chart_PointerLeave(object? sender, PointerEventArgs e) _core?.InvokePointerLeft(); } - private void OnAttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void OnAttachedToVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { _core?.Load(); } - private void PieChart_DetachedFromVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void PieChart_DetachedFromVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { _core?.Unload(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PolarChart.axaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PolarChart.axaml.cs index 41293b4d6..3bca3486b 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PolarChart.axaml.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/PolarChart.axaml.cs @@ -773,12 +773,12 @@ private void PolarChart_PointerLeave(object? sender, PointerEventArgs e) _core?.InvokePointerLeft(); } - private void OnAttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void OnAttachedToVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { _core?.Load(); } - private void PolarChart_DetachedFromVisualTree(object sender, VisualTreeAttachmentEventArgs e) + private void PolarChart_DetachedFromVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { _core?.Unload(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/CartesianChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/CartesianChart.cs index 68cc522c1..17d2de249 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/CartesianChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/CartesianChart.cs @@ -406,7 +406,7 @@ private void OnMouseWheel(object? sender, MouseWheelEventArgs e) c.Zoom(new LvcPoint((float)p.X, (float)p.Y), e.Delta > 0 ? ZoomDirection.ZoomIn : ZoomDirection.ZoomOut); } - private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e) + private void OnManipulationDelta(object? sender, ManipulationDeltaEventArgs e) { if (core is null) throw new Exception("core not found"); var c = (CartesianChart)core; @@ -425,7 +425,7 @@ private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e) return; } } - private void OnManipulationStarting(object sender, ManipulationStartingEventArgs e) + private void OnManipulationStarting(object? sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = this; e.Handled = true; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj index dbe0f419c..72a42b175 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj @@ -1,13 +1,13 @@ - + enable - 11.0 + 12.0 true - net462;netcoreapp3.1 + net462;netcoreapp3.1 LiveChartsCore.SkiaSharpView.WPF LiveChartsCore.SkiaSharpView.WPF - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for WPF. MIT @@ -23,7 +23,7 @@ - + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PieChart.cs index c4c98645c..727c62c39 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PieChart.cs @@ -64,6 +64,7 @@ public PieChart() MouseDown += OnMouseDown; tooltip = new SKDefaultTooltip(); + legend = new SKDefaultLegend(); } /// @@ -200,7 +201,6 @@ protected override void InitializeCore() { if (canvas is null) throw new Exception("canvas not found"); core = new PieChart(this, config => config.UseDefaults(), canvas.CanvasCore); - legend = new SKDefaultLegend(); // Template.FindName("legend", this) as IChartLegend; core.Update(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PolarChart.cs index 8a5f48fb5..79f0696a7 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/PolarChart.cs @@ -80,6 +80,7 @@ public PolarChart() MouseUp += OnMouseUp; tooltip = new SKDefaultTooltip(); + legend = new SKDefaultLegend(); } #region dependency properties @@ -294,7 +295,6 @@ protected override void InitializeCore() if (canvas is null) throw new Exception("canvas not found"); core = new PolarChart(this, config => config.UseDefaults(), canvas.CanvasCore); - legend = new SKDefaultLegend(); // Template.FindName("legend", this) as IChartLegend; core.Update(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/ResolutionHelper.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/ResolutionHelper.cs index e34121489..125f066c5 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/ResolutionHelper.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/ResolutionHelper.cs @@ -25,26 +25,20 @@ namespace LiveChartsCore.SkiaSharpView.WPF; /// /// A helper class to get the screen resolution. /// -public class ResolutionHelper +/// +/// Initializes a new instance of the class. +/// +/// The horizontal resolution. +/// The vertical resolution. +public class ResolutionHelper(float dpix, float dpiy) { /// /// Gets or sets the horizontal dpi. /// - public float dpix { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The horizontal resolution. - /// The vertical resolution. - public ResolutionHelper(float dpix, float dpiy) - { - this.dpix = dpix; - this.dpiy = dpiy; - } + public float dpix { get; set; } = dpix; /// /// Gets or sets the vertical dpi. /// - public float dpiy { get; set; } + public float dpiy { get; set; } = dpiy; } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj index d16ce0cf1..a286877dc 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj @@ -1,15 +1,16 @@ - + + 12.0 + enable + WinExe true Library - 11.0 - enable - net462;netcoreapp3.1 + net462;netcoreapp3.1 LiveChartsCore.SkiaSharpView.WinForms LiveChartsCore.SkiaSharpView.WinForms - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for WindowsForms. MIT @@ -19,13 +20,18 @@ https://github.com/beto-rodriguez/LiveCharts2 + + + $(NoWarn);NU1701 + + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml true - + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/MotionCanvas.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/MotionCanvas.cs index f2126d156..aa6afda3a 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/MotionCanvas.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/MotionCanvas.cs @@ -40,7 +40,7 @@ namespace LiveChartsCore.SkiaSharpView.WinForms; public partial class MotionCanvas : UserControl { private bool _isDrawingLoopRunning = false; - private List> _paintTasksSchedule = new(); + private List> _paintTasksSchedule = []; /// /// Initializes a new instance of the class. diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PieChart.cs index 9bdb28601..4e35130ae 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PieChart.cs @@ -133,7 +133,7 @@ public override IEnumerable> GetVisualsAt protected override void InitializeCore() { core = new PieChart( - this, config => config.UseDefaults(), motionCanvas.CanvasCore, true); + this, config => config.UseDefaults(), motionCanvas.CanvasCore); if (((IChartView)this).DesignerMode) return; core.Update(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PolarChart.cs index 204cdda25..d0632c564 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/PolarChart.cs @@ -184,7 +184,7 @@ public IEnumerable RadiusAxes protected override void InitializeCore() { core = new PolarChart( - this, config => config.UseDefaults(), motionCanvas.CanvasCore, true); + this, config => config.UseDefaults(), motionCanvas.CanvasCore); if (((IChartView)this).DesignerMode) return; core.Update(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.Xamarin.Forms.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.Xamarin.Forms.csproj index 15151f9e4..97e6ee8ab 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.Xamarin.Forms.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.Xamarin.Forms.csproj @@ -1,12 +1,12 @@ - + - 11.0 + 12.0 enable netstandard2.0; LiveChartsCore.SkiaSharpView.XamarinForms LiveChartsCore.SkiaSharpView.XamarinForms - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for XamarinForms. MIT @@ -22,7 +22,7 @@ - + @@ -31,30 +31,6 @@ - - - PolarChart.xaml - - - MotionCanvas.xaml - - - - - - MSBuild:UpdateDesignTimeXaml - - - MSBuild:UpdateDesignTimeXaml - - - MSBuild:UpdateDesignTimeXaml - - - MSBuild:UpdateDesignTimeXaml - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/BoxSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/BoxSeries.cs index 7674c327d..25b487bcd 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/BoxSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/BoxSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class BoxSeries : CoreBoxSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class BoxSeries : CoreBoxSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/CandlesticksSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/CandlesticksSeries.cs index c1774069e..06d5a33ad 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/CandlesticksSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/CandlesticksSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class CandlesticksSeries : CandlesticksSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class CandlesticksSeries : CandlesticksSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/ColumnSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/ColumnSeries.cs index 7d43f8edc..b8932857f 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/ColumnSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/ColumnSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class ColumnSeries : ColumnSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class ColumnSeries : ColumnSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/ArcGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/ArcGeometry.cs index c2e4ce5ee..cf14697ab 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/ArcGeometry.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/ArcGeometry.cs @@ -53,7 +53,6 @@ public override void OnDraw(SkiaSharpDrawingContext context, SKPaint paint) using var path = new SKPath(); var cx = CenterX; var cy = CenterY; - var wedge = 20; var r = Width * 0.5f; var startAngle = StartAngle; var sweepAngle = SweepAngle; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/HeatPathShape.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/HeatPathShape.cs index 489f72f71..426ca77b8 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/HeatPathShape.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/HeatPathShape.cs @@ -33,7 +33,9 @@ namespace LiveChartsCore.SkiaSharpView.Drawing.Geometries; /// Defines a path geometry with a specified color. /// /// +#pragma warning disable CS0612 // Type or member is obsolete public class HeatPathShape : PathGeometry, IHeatPathShape +#pragma warning restore CS0612 // Type or member is obsolete { private readonly ColorMotionProperty _fillProperty; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/PopUpGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/PopUpGeometry.cs index 1e8895024..62b3bfbfb 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/PopUpGeometry.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/PopUpGeometry.cs @@ -51,6 +51,7 @@ public class PopUpGeometry : SizedGeometry /// public PopUpPlacement Placement { get; set; } = PopUpPlacement.Bottom; + /// public override void OnDraw(SkiaSharpDrawingContext context, SKPaint paint) { using var path = new SKPath(); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/SVGPathGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/SVGPathGeometry.cs index a4b38d051..7ea5ccc6e 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/SVGPathGeometry.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/SVGPathGeometry.cs @@ -69,7 +69,7 @@ public SVGPathGeometry(Func pathSource) /// memory, this has no secondary effects in most of the cases, but if you are parsing a lot of paths /// (maybe over 500) then you must consider cleaning the cache when you no longer need a path. /// - public static readonly Dictionary Cache = new(); + public static readonly Dictionary Cache = []; /// /// Gets or sets the path. diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Segments/MoveToPathCommand.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Segments/MoveToPathCommand.cs index d9c6979be..8438674ff 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Segments/MoveToPathCommand.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Segments/MoveToPathCommand.cs @@ -50,7 +50,6 @@ public MoveToPathCommand() /// public override void Execute(SKPath path, long currentTime, Animatable pathGeometry) { - currentTime = currentTime; path.MoveTo(X, Y); } } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/SkiaSharpDrawingContext.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/SkiaSharpDrawingContext.cs index 449252191..3c103401b 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/SkiaSharpDrawingContext.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/SkiaSharpDrawingContext.cs @@ -31,33 +31,21 @@ namespace LiveChartsCore.SkiaSharpView.Drawing; /// Defines a skia sharp drawing context. /// /// -public class SkiaSharpDrawingContext : DrawingContext +/// +/// Initializes a new instance of the class. +/// +/// The motion canvas. +/// The information. +/// The surface. +/// The canvas. +/// Indicates whether the canvas is cleared on frame draw. +public class SkiaSharpDrawingContext( + MotionCanvas motionCanvas, + SKImageInfo info, + SKSurface? surface, + SKCanvas canvas, + bool clearOnBeginDraw = true) : DrawingContext { - private readonly bool _clearOnBegingDraw; - - /// - /// Initializes a new instance of the class. - /// - /// The motion canvas. - /// The information. - /// The surface. - /// The canvas. - /// Indicates whether the canvas is cleared on frame draw. - public SkiaSharpDrawingContext( - MotionCanvas motionCanvas, - SKImageInfo info, - SKSurface surface, - SKCanvas canvas, - bool clearOnBeginDraw = true) - { - MotionCanvas = motionCanvas; - Info = info; - Surface = surface; - Canvas = canvas; - PaintTask = null!; - Paint = null!; - _clearOnBegingDraw = clearOnBeginDraw; - } /// /// Initializes a new instance of the class. @@ -71,7 +59,7 @@ public SkiaSharpDrawingContext( public SkiaSharpDrawingContext( MotionCanvas motionCanvas, SKImageInfo info, - SKSurface surface, + SKSurface? surface, SKCanvas canvas, SKColor background, bool clearOnBeginDraw = true) @@ -86,7 +74,7 @@ public SkiaSharpDrawingContext( /// /// The motion canvas. /// - public MotionCanvas MotionCanvas { get; set; } + public MotionCanvas MotionCanvas { get; set; } = motionCanvas; /// /// Gets or sets the information. @@ -94,7 +82,7 @@ public SkiaSharpDrawingContext( /// /// The information. /// - public SKImageInfo Info { get; set; } + public SKImageInfo Info { get; set; } = info; /// /// Gets or sets the surface. @@ -102,7 +90,7 @@ public SkiaSharpDrawingContext( /// /// The surface. /// - public SKSurface Surface { get; set; } + public SKSurface? Surface { get; set; } = surface; /// /// Gets or sets the canvas. @@ -110,7 +98,7 @@ public SkiaSharpDrawingContext( /// /// The canvas. /// - public SKCanvas Canvas { get; set; } + public SKCanvas Canvas { get; set; } = canvas; /// /// Gets or sets the paint task. @@ -118,7 +106,7 @@ public SkiaSharpDrawingContext( /// /// The paint task. /// - public Paint PaintTask { get; set; } + public Paint PaintTask { get; set; } = null!; /// /// Gets or sets the paint. @@ -126,7 +114,7 @@ public SkiaSharpDrawingContext( /// /// The paint. /// - public SKPaint Paint { get; set; } + public SKPaint Paint { get; set; } = null!; /// /// Gets or sets the background. @@ -136,7 +124,7 @@ public SkiaSharpDrawingContext( /// public override void OnBeginDraw() { - if (_clearOnBegingDraw) Canvas.Clear(); + if (clearOnBeginDraw) Canvas.Clear(); if (Background != SKColor.Empty) { Canvas.DrawRect(Info.Rect, new SKPaint { Color = Background }); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/BaseGaugeItem.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/BaseGaugeItem.cs index 1e480aea7..f58a8bdab 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/BaseGaugeItem.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/BaseGaugeItem.cs @@ -27,6 +27,10 @@ namespace LiveChartsCore.SkiaSharpView.Extensions; +/// +/// Defines an item for a gauge series. +/// +/// The type of the series. public class BaseGaugeItem where TSeries : IPieSeries, new() { diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/GaugeGenerator.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/GaugeGenerator.cs index 8a9e486ef..5407587ed 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/GaugeGenerator.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/GaugeGenerator.cs @@ -70,8 +70,8 @@ public static ObservableCollection> BuildAngularGauge private static ObservableCollection> Build( GaugeOptions options, params GaugeItem[] items) { - List seriesRules = new(); - List backgroundRules = new(); + List seriesRules = []; + List backgroundRules = []; foreach (var item in items) { diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/PieChartExtensions.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/PieChartExtensions.cs index bcec47d26..2860fd626 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/PieChartExtensions.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Extensions/PieChartExtensions.cs @@ -132,14 +132,14 @@ internal static TSeries AsSeries( ObservableCollection values; if (gaugeOptions == GaugeOptions.Solid) { - values = new ObservableCollection(); + values = []; while (values.Count < count - 1) values.Add(default!); values.Insert(i, instance); } else { - values = new ObservableCollection { instance }; + values = [instance]; if (gaugeOptions == GaugeOptions.Angular) { series.HoverPushout = 0; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/GaugeBuilder.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/GaugeBuilder.cs index d428b05b7..2b3105bfd 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/GaugeBuilder.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/GaugeBuilder.cs @@ -39,8 +39,8 @@ namespace LiveChartsCore.SkiaSharpView; [Obsolete($"Use {nameof(GaugeGenerator)}.{nameof(GaugeGenerator.BuildSolidGauge)} instead.")] public class GaugeBuilder : IGaugeBuilder { - private readonly Dictionary?, IPaint?>> _keyValuePairs = new(); - private readonly List?, IPaint?>> _tuples = new(); + private readonly Dictionary?, IPaint?>> _keyValuePairs = []; + private readonly List?, IPaint?>> _tuples = []; private List>? _builtSeries; private RadialAlignment? _radialAlign = null; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/HeatSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/HeatSeries.cs index dbdcf8452..9ff68a689 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/HeatSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/HeatSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class HeatSeries : HeatSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class HeatSeries : HeatSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/LineSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/LineSeries.cs index c1e4a6885..e74bba48e 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/LineSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/LineSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class LineSeries : LineSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class LineSeries : LineSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj index e30b2adcf..7b6a43876 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj @@ -2,22 +2,30 @@ enable - 11.0 - - netstandard2.0;netcoreapp2.0;net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst - - $(TargetFrameworks);net6.0-windows10.0.19041;net462 + 12.0 + + + netstandard2.0; + net6.0; + net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst; + + + $(TargetFrameworks); + net462; + net6.0-windows10.0.19041.0; + net8.0-windows10.0.19041.0; - 14.2 - 14.0 - 21.0 - 10.0.17763.0 - 10.0.17763.0 + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 LiveChartsCore.SkiaSharpView LiveChartsCore.SkiaSharpView - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for .Net, this package contains the SkiaSharp backend. MIT @@ -37,8 +45,8 @@ - - + + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsSkiaSharp.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsSkiaSharp.cs index 89192b92f..120cccec7 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsSkiaSharp.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsSkiaSharp.cs @@ -116,23 +116,6 @@ public static LvcColor AsLvcColor(this SKColor color) return new LvcColor(color.Red, color.Green, color.Blue, color.Alpha); } - /// - /// Gets the key. - /// - [Obsolete($"Use {nameof(Paint)}.{nameof(Paint.SKTypeface)} instead.")] - public const string SkiaFontMatchChar = "matchChar"; - - /// - /// Matches - /// - /// - /// - [Obsolete($"Use {nameof(Paint)}.{nameof(Paint.SKTypeface)} instead.")] - public static string MatchChar(char @char) - { - return $"{SkiaFontMatchChar}|{@char}"; - } - /// /// Converts an IEnumerable to an ObservableCollection of pie series. /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/MapFactory.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/MapFactory.cs index 1d959e706..e8400c70d 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/MapFactory.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/MapFactory.cs @@ -37,9 +37,9 @@ namespace LiveChartsCore.SkiaSharpView; /// public class MapFactory : IMapFactory { - private readonly HashSet _usedPathShapes = new(); - private readonly HashSet> _usedPaints = new(); - private readonly HashSet _usedLayers = new(); + private readonly HashSet _usedPathShapes = []; + private readonly HashSet> _usedPaints = []; + private readonly HashSet _usedLayers = []; private IGeoMapView? _mapView; /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/Effects/DashEffect.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/Effects/DashEffect.cs index c6ae2e4c8..973187f7d 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/Effects/DashEffect.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/Effects/DashEffect.cs @@ -29,19 +29,11 @@ namespace LiveChartsCore.SkiaSharpView.Painting.Effects; /// Creates a stroke dash effect. /// /// -public class DashEffect : PathEffect +/// +/// Initializes a new instance of the class. +/// +public class DashEffect(float[] dashArray, float phase = 0) : PathEffect { - private readonly float[] _dashArray; - private readonly float _phase = 0; - - /// - /// Initializes a new instance of the class. - /// - public DashEffect(float[] dashArray, float phase = 0) - { - _dashArray = dashArray; - _phase = phase; - } /// /// Creates a new object that is a copy of the current instance. @@ -52,7 +44,7 @@ public DashEffect(float[] dashArray, float phase = 0) /// public override PathEffect Clone() { - return new DashEffect(_dashArray, _phase); + return new DashEffect(dashArray, phase); } /// @@ -61,6 +53,6 @@ public override PathEffect Clone() /// The drawing context. public override void CreateEffect(SkiaSharpDrawingContext drawingContext) { - SKPathEffect = SKPathEffect.CreateDash(_dashArray, _phase); + SKPathEffect = SKPathEffect.CreateDash(dashArray, phase); } } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/Blur.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/Blur.cs index b53637fbc..e8c59c842 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/Blur.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/Blur.cs @@ -29,27 +29,15 @@ namespace LiveChartsCore.SkiaSharpView.Painting.ImageFilters; /// Creates a blur image filter. /// /// -public class Blur : ImageFilter +/// +/// Initializes a new instance of the class. +/// +/// The sigma x. +/// The sigma y. +/// The input. +/// The crop rect. +public class Blur(float sigmaX, float sigmaY, SKImageFilter? input = null, SKImageFilter.CropRect? cropRect = null) : ImageFilter { - private readonly float _sigmaX; - private readonly float _sigmaY; - private readonly SKImageFilter? _filter = null; - private readonly SKImageFilter.CropRect? _cropRect = null; - - /// - /// Initializes a new instance of the class. - /// - /// The sigma x. - /// The sigma y. - /// The input. - /// The crop rect. - public Blur(float sigmaX, float sigmaY, SKImageFilter? input = null, SKImageFilter.CropRect? cropRect = null) - { - _sigmaX = sigmaX; - _sigmaY = sigmaY; - _filter = input; - _cropRect = cropRect; - } /// /// Clones this instance. @@ -58,7 +46,7 @@ public Blur(float sigmaX, float sigmaY, SKImageFilter? input = null, SKImageFilt /// public override ImageFilter Clone() { - return new Blur(_sigmaX, _sigmaY, _filter, _cropRect); + return new Blur(sigmaX, sigmaY, input, cropRect); } /// @@ -68,6 +56,6 @@ public override ImageFilter Clone() /// public override void CreateFilter(SkiaSharpDrawingContext drawingContext) { - SKImageFilter = SKImageFilter.CreateBlur(_sigmaX, _sigmaY, _filter, _cropRect); + SKImageFilter = SKImageFilter.CreateBlur(sigmaX, sigmaY, input, cropRect); } } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/DropShadow.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/DropShadow.cs index 5ae555eff..5113677a0 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/DropShadow.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/DropShadow.cs @@ -29,36 +29,18 @@ namespace LiveChartsCore.SkiaSharpView.Painting.ImageFilters; /// Creates a drop shadow image filter. /// /// -public class DropShadow : ImageFilter +/// +/// Initializes a new instance of the class. +/// +/// The dx. +/// The dy. +/// The sigma x. +/// The sigma y. +/// The color. +/// The input. +/// The crop rect. +public class DropShadow(float dx, float dy, float sigmaX, float sigmaY, SKColor color, SKImageFilter? input = null, SKImageFilter.CropRect? cropRect = null) : ImageFilter { - private readonly float _dx; - private readonly float _dy; - private readonly float _sigmaX; - private readonly float _sigmaY; - private readonly SKColor _color; - private readonly SKImageFilter? _filter = null; - private readonly SKImageFilter.CropRect? _cropRect = null; - - /// - /// Initializes a new instance of the class. - /// - /// The dx. - /// The dy. - /// The sigma x. - /// The sigma y. - /// The color. - /// The input. - /// The crop rect. - public DropShadow(float dx, float dy, float sigmaX, float sigmaY, SKColor color, SKImageFilter? input = null, SKImageFilter.CropRect? cropRect = null) - { - _dx = dx; - _dy = dy; - _sigmaX = sigmaX; - _sigmaY = sigmaY; - _color = color; - _filter = input; - _cropRect = cropRect; - } /// /// Clones this instance. @@ -67,7 +49,7 @@ public DropShadow(float dx, float dy, float sigmaX, float sigmaY, SKColor color, /// public override ImageFilter Clone() { - return new DropShadow(_dx, _dy, _sigmaX, _sigmaY, _color, _filter, _cropRect); + return new DropShadow(dx, dy, sigmaX, sigmaY, color, input, cropRect); } /// @@ -76,6 +58,6 @@ public override ImageFilter Clone() /// The drawing context. public override void CreateFilter(SkiaSharpDrawingContext drawingContext) { - SKImageFilter = SKImageFilter.CreateDropShadow(_dx, _dy, _sigmaX, _sigmaY, _color, _filter, _cropRect); + SKImageFilter = SKImageFilter.CreateDropShadow(dx, dy, sigmaX, sigmaY, color, input, cropRect); } } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/ImageFiltersMergeOperation.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/ImageFiltersMergeOperation.cs index a6e326021..08d674150 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/ImageFiltersMergeOperation.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/ImageFilters/ImageFiltersMergeOperation.cs @@ -29,21 +29,14 @@ namespace LiveChartsCore.SkiaSharpView.Painting.ImageFilters; /// Merges multiple image filters. /// /// -public class ImageFiltersMergeOperation : ImageFilter +/// +/// Initializes a new instance of the class. +/// +/// The image filters. +/// The crop rect. +public class ImageFiltersMergeOperation(ImageFilter[] imageFilters, SKImageFilter.CropRect? cropRect = null) : ImageFilter { - private readonly ImageFilter[] _filters; - private readonly SKImageFilter.CropRect? _cropRect = null; - - /// - /// Initializes a new instance of the class. - /// - /// The image filters. - /// The crop rect. - public ImageFiltersMergeOperation(ImageFilter[] imageFilters, SKImageFilter.CropRect? cropRect = null) - { - _filters = imageFilters; - _cropRect = cropRect; - } + private readonly ImageFilter[] _filters = imageFilters; /// /// Clones this instance. @@ -52,7 +45,7 @@ public ImageFiltersMergeOperation(ImageFilter[] imageFilters, SKImageFilter.Crop /// public override ImageFilter Clone() { - return new ImageFiltersMergeOperation(_filters, _cropRect); + return new ImageFiltersMergeOperation(_filters, cropRect); } /// @@ -72,7 +65,7 @@ public override void CreateFilter(SkiaSharpDrawingContext drawingContext) imageFilters[i++] = item.SKImageFilter; } - SKImageFilter = SKImageFilter.CreateMerge(imageFilters, _cropRect); + SKImageFilter = SKImageFilter.CreateMerge(imageFilters, cropRect); } /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/LinearGradientPaint.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/LinearGradientPaint.cs index af3f14144..342efc8a8 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/LinearGradientPaint.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/LinearGradientPaint.cs @@ -31,7 +31,30 @@ namespace LiveChartsCore.SkiaSharpView.Painting; /// Defines a set of geometries that will be painted using a linear gradient shader. /// /// -public class LinearGradientPaint : Paint +/// +/// Initializes a new instance of the class. +/// +/// The gradient stops. +/// +/// The start point, both X and Y in the range of 0 to 1, where 0 is the start of the axis and 1 the end. +/// +/// +/// The end point, both X and Y in the range of 0 to 1, where 0 is the start of the axis and 1 the end. +/// +/// +/// An array of integers in the range of 0 to 1. +/// These integers indicate the relative positions of the colors, You can set that argument to null to equally +/// space the colors, default is null. +/// +/// +/// The shader tile mode, default is . +/// +public class LinearGradientPaint( + SKColor[] gradientStops, + SKPoint startPoint, + SKPoint endPoint, + float[]? colorPos = null, + SKShaderTileMode tileMode = SKShaderTileMode.Repeat) : Paint { /// /// Default start point. @@ -42,46 +65,8 @@ public class LinearGradientPaint : Paint /// Default end point. /// protected static readonly SKPoint s_defaultEndPoint = new(1, 0.5f); - - private readonly SKColor[] _gradientStops; - private readonly SKPoint _startPoint; - private readonly SKPoint _endPoint; - private readonly float[]? _colorPos; - private readonly SKShaderTileMode _tileMode; private SkiaSharpDrawingContext? _drawingContext; - /// - /// Initializes a new instance of the class. - /// - /// The gradient stops. - /// - /// The start point, both X and Y in the range of 0 to 1, where 0 is the start of the axis and 1 the end. - /// - /// - /// The end point, both X and Y in the range of 0 to 1, where 0 is the start of the axis and 1 the end. - /// - /// - /// An array of integers in the range of 0 to 1. - /// These integers indicate the relative positions of the colors, You can set that argument to null to equally - /// space the colors, default is null. - /// - /// - /// The shader tile mode, default is . - /// - public LinearGradientPaint( - SKColor[] gradientStops, - SKPoint startPoint, - SKPoint endPoint, - float[]? colorPos = null, - SKShaderTileMode tileMode = SKShaderTileMode.Repeat) - { - _gradientStops = gradientStops; - _startPoint = startPoint; - _endPoint = endPoint; - _colorPos = colorPos; - _tileMode = tileMode; - } - /// /// Initializes a new instance of the class. /// @@ -114,7 +99,7 @@ public LinearGradientPaint(SKColor start, SKColor end) /// public override IPaint CloneTask() { - return new LinearGradientPaint(_gradientStops, _startPoint, _endPoint, _colorPos, _tileMode) + return new LinearGradientPaint(gradientStops, startPoint, endPoint, colorPos, tileMode) { Style = Style, IsStroke = IsStroke, @@ -146,15 +131,15 @@ public override void ApplyOpacityMask(SkiaSharpDrawingContext context, IPaintabl var yf = size.Location.Y; var yt = yf + size.Height; - var start = new SKPoint(xf + (xt - xf) * _startPoint.X, yf + (yt - yf) * _startPoint.Y); - var end = new SKPoint(xf + (xt - xf) * _endPoint.X, yf + (yt - yf) * _endPoint.Y); + var start = new SKPoint(xf + (xt - xf) * startPoint.X, yf + (yt - yf) * startPoint.Y); + var end = new SKPoint(xf + (xt - xf) * endPoint.X, yf + (yt - yf) * endPoint.Y); _skiaPaint.Shader = SKShader.CreateLinearGradient( start, end, - _gradientStops.Select(x => new SKColor(x.Red, x.Green, x.Blue, (byte)(255 * geometry.Opacity))).ToArray(), - _colorPos, - _tileMode); + gradientStops.Select(x => new SKColor(x.Red, x.Green, x.Blue, (byte)(255 * geometry.Opacity))).ToArray(), + colorPos, + tileMode); } /// @@ -170,15 +155,15 @@ public override void RestoreOpacityMask(SkiaSharpDrawingContext context, IPainta var yf = size.Location.Y; var yt = yf + size.Height; - var start = new SKPoint(xf + (xt - xf) * _startPoint.X, yf + (yt - yf) * _startPoint.Y); - var end = new SKPoint(xf + (xt - xf) * _endPoint.X, yf + (yt - yf) * _endPoint.Y); + var start = new SKPoint(xf + (xt - xf) * startPoint.X, yf + (yt - yf) * startPoint.Y); + var end = new SKPoint(xf + (xt - xf) * endPoint.X, yf + (yt - yf) * endPoint.Y); _skiaPaint.Shader = SKShader.CreateLinearGradient( start, end, - _gradientStops, - _colorPos, - _tileMode); + gradientStops, + colorPos, + tileMode); } /// @@ -194,15 +179,15 @@ public override void InitializeTask(SkiaSharpDrawingContext drawingContext) var yf = size.Location.Y; var yt = yf + size.Height; - var start = new SKPoint(xf + (xt - xf) * _startPoint.X, yf + (yt - yf) * _startPoint.Y); - var end = new SKPoint(xf + (xt - xf) * _endPoint.X, yf + (yt - yf) * _endPoint.Y); + var start = new SKPoint(xf + (xt - xf) * startPoint.X, yf + (yt - yf) * startPoint.Y); + var end = new SKPoint(xf + (xt - xf) * endPoint.X, yf + (yt - yf) * endPoint.Y); _skiaPaint.Shader = SKShader.CreateLinearGradient( start, end, - _gradientStops, - _colorPos, - _tileMode); + gradientStops, + colorPos, + tileMode); _skiaPaint.IsAntialias = IsAntialias; _skiaPaint.IsStroke = true; @@ -262,10 +247,6 @@ public override void Dispose() private SKRect GetDrawRectangleSize(SkiaSharpDrawingContext drawingContext) { - var clip = GetClipRectangle(drawingContext.MotionCanvas); - - return clip == LvcRectangle.Empty - ? new SKRect(0, 0, drawingContext.Info.Width, drawingContext.Info.Width) - : new SKRect(clip.X, clip.Y, clip.X + clip.Width, clip.Y + clip.Height); + return new SKRect(0, 0, drawingContext.Info.Width, drawingContext.Info.Width); } } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/Paint.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/Paint.cs index 65f466798..76e21fe7e 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/Paint.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/Paint.cs @@ -36,12 +36,10 @@ namespace LiveChartsCore.SkiaSharpView.Painting; public abstract class Paint : Animatable, IDisposable, IPaint { private readonly FloatMotionProperty _strokeMiterTransition; - private readonly Dictionary, HashSet>> _geometriesByCanvas = new(); - private readonly Dictionary, LvcRectangle> _clipRectangles = new(); - private char? _matchesChar = null; + private readonly Dictionary, HashSet>> _geometriesByCanvas = []; + private readonly Dictionary, LvcRectangle> _clipRectangles = []; internal SKPaint? _skiaPaint; internal FloatMotionProperty _strokeWidthTransition; - private string? _fontFamily; /// /// Initializes a new instance of the class. @@ -82,16 +80,7 @@ protected Paint(SKColor color) : this() public bool IsFill { get; set; } /// - public string? FontFamily - { - get => _fontFamily; - set - { - _fontFamily = value; - if (!(_fontFamily?.Contains(LiveChartsSkiaSharp.SkiaFontMatchChar) ?? false)) return; - _matchesChar = Convert.ToChar(_fontFamily.Split('|')[1]); - } - } + public string? FontFamily { get; set; } /// /// Gets or sets the font style. @@ -205,7 +194,7 @@ public void AddGeometryToPaintTask(MotionCanvas canvas, var g = GetGeometriesByCanvas(canvas); if (g is null) { - g = new HashSet>(); + g = []; _geometriesByCanvas[canvas] = g; } _ = g.Add(geometry); @@ -271,11 +260,8 @@ protected internal SKTypeface GetSKTypeface() // return the defined typeface. if (SKTypeface is not null) return SKTypeface; - // Obsolete method used in older versions of LiveCharts... - if (_matchesChar is not null) return SKFontManager.Default.MatchCharacter(_matchesChar.Value); - // create one from the font family. - if (FontFamily is not null) return SKTypeface.FromFamilyName(_fontFamily, SKFontStyle ?? new SKFontStyle()); + if (FontFamily is not null) return SKTypeface.FromFamilyName(FontFamily, SKFontStyle ?? new SKFontStyle()); // other wise ose the globally defined typeface. return LiveChartsSkiaSharp.DefaultSKTypeface ?? SKTypeface.Default; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/RadialGradientPaint.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/RadialGradientPaint.cs index 0fbebaf43..2822e619c 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/RadialGradientPaint.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Painting/RadialGradientPaint.cs @@ -220,10 +220,6 @@ public override void Dispose() private SKRect GetDrawRectangleSize(SkiaSharpDrawingContext drawingContext) { - var clip = GetClipRectangle(drawingContext.MotionCanvas); - - return clip == LvcRectangle.Empty - ? new SKRect(0, 0, drawingContext.Info.Width, drawingContext.Info.Width) - : new SKRect(clip.X, clip.Y, clip.Width, clip.Height); + return new SKRect(0, 0, drawingContext.Info.Width, drawingContext.Info.Width); } } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/PieSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/PieSeries.cs index 6ed8eb6df..7f0344628 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/PieSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/PieSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -60,7 +60,7 @@ public PieSeries(bool isGauge = false, bool isGaugeFill = false) : base(isGauge, /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -91,7 +91,7 @@ public PieSeries(bool isGauge = false, bool isGaugeFill = false) : base(isGauge, /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/PolarLineSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/PolarLineSeries.cs index 5839681db..72db1c6bc 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/PolarLineSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/PolarLineSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class PolarLineSeries : PolarLineSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class PolarLineSeries : PolarLineSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/RowSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/RowSeries.cs index ecff7d52c..3c7fe24fe 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/RowSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/RowSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// data label of every point. @@ -46,7 +46,7 @@ public class RowSeries : RowSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class RowSeries : RowSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/Helpers/DoubleDict.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/Helpers/DoubleDict.cs index 2e3a740bb..cca9254c9 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/Helpers/DoubleDict.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/Helpers/DoubleDict.cs @@ -29,8 +29,8 @@ internal class DoubleDict where T1 : notnull where T2 : notnull { - private readonly Dictionary _keys = new(); - private readonly Dictionary _values = new(); + private readonly Dictionary _keys = []; + private readonly Dictionary _values = []; public void Add(T1 key, T2 value) { diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/SKGeoMap.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/SKGeoMap.cs index 38ea8da62..5edf991b1 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/SKGeoMap.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/SKGeoMap.cs @@ -44,7 +44,10 @@ public class SKGeoMap : InMemorySkiaSharpChart, IGeoMapView public SKGeoMap() { + LiveCharts.Configure(config => config.UseDefaults()); + _core = new GeoMap(this); + ActiveMap = Maps.GetWorldMap(); } /// @@ -69,7 +72,7 @@ public SKGeoMap(IGeoMapView mapView) : this() public bool DesignerMode { get; set; } = false; /// - public CoreMap ActiveMap { get; set; } = Maps.GetWorldMap(); + public CoreMap ActiveMap { get; set; } float IGeoMapView.Width => Width; diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/ScatterSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/ScatterSeries.cs index 5225e9b10..4ebcf32e8 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/ScatterSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/ScatterSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class ScatterSeries : ScatterSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class ScatterSeries : ScatterSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/StackedAreaSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/StackedAreaSeries.cs index 26539eeb2..b09cacfba 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/StackedAreaSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/StackedAreaSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class StackedAreaSeries : StackedAreaSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class StackedAreaSeries : StackedAreaSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/StackedColumnSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/StackedColumnSeries.cs index d5c32337d..da6cd82e7 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/StackedColumnSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/StackedColumnSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class StackedColumnSeries : StackedColumnSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class StackedColumnSeries : StackedColumnSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/StackedRowSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/StackedRowSeries.cs index 0d6af70bf..5d2e5f417 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/StackedRowSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/StackedRowSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class StackedRowSeries : StackedRowSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class StackedRowSeries : StackedRowSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/StackedStepAreaSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/StackedStepAreaSeries.cs index c232b98e5..8dac0ef75 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/StackedStepAreaSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/StackedStepAreaSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -47,7 +47,7 @@ public class StackedStepAreaSeries /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -65,7 +65,7 @@ public class StackedStepAreaSeries /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/StepLineSeries.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/StepLineSeries.cs index c4b50c87c..09409ccac 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/StepLineSeries.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/StepLineSeries.cs @@ -33,7 +33,7 @@ namespace LiveChartsCore.SkiaSharpView; /// /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -46,7 +46,7 @@ public class StepLineSeries : StepLineSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// @@ -63,7 +63,7 @@ public class StepLineSeries : StepLineSeries /// The type of the points, you can use any type, the library already knows how to handle the most common numeric types, /// to use a custom type, you must register the type globally -/// () +/// () /// or at the series level /// (). /// diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/VisualElements/VariableGeometryVisual.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/VisualElements/VariableGeometryVisual.cs index 4b8ba46e6..85b8ad7e5 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/VisualElements/VariableGeometryVisual.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/VisualElements/VariableGeometryVisual.cs @@ -27,9 +27,6 @@ namespace LiveChartsCore.SkiaSharpView.VisualElements; /// -public class VariableGeometryVisual : VariableGeometryVisual +public class VariableGeometryVisual(ISizedGeometry geometry) : VariableGeometryVisual(geometry) { - public VariableGeometryVisual(ISizedGeometry geometry) - : base(geometry) - { } } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/JsInterop/DomJsInterop.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/JsInterop/DomJsInterop.cs index 1488fbc8c..154a8f358 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/JsInterop/DomJsInterop.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/JsInterop/DomJsInterop.cs @@ -29,23 +29,18 @@ namespace LiveChartsCore.SkiaSharpView.Blazor; /// /// An object that handles the comminication with the DOM. /// -public class DomJsInterop : IAsyncDisposable +/// +/// Initialized a new instance of the class. +/// +/// +public class DomJsInterop(IJSRuntime jsRuntime) : IAsyncDisposable { - private readonly Lazy> _moduleTask; - private static readonly Dictionary>> s_resizeEvent = new(); - - /// - /// Initialized a new instance of the class. - /// - /// - public DomJsInterop(IJSRuntime jsRuntime) - { - _moduleTask = new Lazy>(() => + private readonly Lazy> _moduleTask = new Lazy>(() => jsRuntime.InvokeAsync( "import", "./_content/LiveChartsCore.SkiaSharpView.Blazor/domInterop.js") .AsTask()); - } + private static readonly Dictionary>> s_resizeEvent = []; /// /// Gets the bounding client rectangle of the given element. @@ -86,7 +81,7 @@ public async ValueTask OnResize(ElementReference element, string elementId, Acti { if (!s_resizeEvent.TryGetValue(elementId, out var actions)) { - actions = new List>(); + actions = []; s_resizeEvent.Add(elementId, actions); var module = await _moduleTask.Value; await module.InvokeVoidAsync("DOMInterop.registerResizeListener", element, elementId); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj index 3b19ece68..b1115edd8 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj @@ -1,23 +1,13 @@ - - True - - ES6 - - - - True - - ES6 - - - 11.0 - net6.0 + 12.0 enable + + net6.0;net8.0 + enable - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for Blazor. MIT @@ -30,6 +20,27 @@ True + + + $(NoWarn);BL0007 + + + + True + + ES6 + + + + True + + ES6 + + @@ -39,13 +50,20 @@ - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/MotionCanvas.razor.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/MotionCanvas.razor.cs index 316ca51d9..0d5d74989 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/MotionCanvas.razor.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/MotionCanvas.razor.cs @@ -37,7 +37,7 @@ public partial class MotionCanvas : IDisposable private SKCanvasView? _canvas; private bool _disposing = false; private bool _isDrawingLoopRunning = false; - private List> _paintTasksSchedule = new(); + private List> _paintTasksSchedule = []; /// /// Called when the control is initialized. diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj index 3313ed535..4f04d6215 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj @@ -2,12 +2,12 @@ Library - 11.0 + 12.0 enable netstandard2.0 LiveChartsCore.SkiaSharpView.Eto LiveChartsCore.SkiaSharpView.Eto - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for Eto.Forms. MIT diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/MotionCanvas.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/MotionCanvas.cs index 9e124831d..8e64618c8 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/MotionCanvas.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/MotionCanvas.cs @@ -38,7 +38,7 @@ namespace LiveChartsCore.SkiaSharpView.Eto; public class MotionCanvas : SkiaDrawable { private bool _isDrawingLoopRunning = false; - private List> _paintTasksSchedule = new(); + private List> _paintTasksSchedule = []; /// /// Initializes a new instance of the class. diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PieChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PieChart.cs index 0a1325f85..16c476e8f 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PieChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PieChart.cs @@ -127,7 +127,7 @@ public override IEnumerable> GetVisualsAt protected override void InitializeCore() { core = new PieChart( - this, config => config.UseDefaults(), motionCanvas.CanvasCore, true); + this, config => config.UseDefaults(), motionCanvas.CanvasCore); core.Update(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PolarChart.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PolarChart.cs index 54cdf910a..8c13d9882 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PolarChart.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/PolarChart.cs @@ -176,7 +176,7 @@ public IEnumerable RadiusAxes protected override void InitializeCore() { core = new PolarChart( - this, config => config.UseDefaults(), motionCanvas.CanvasCore, true); + this, config => config.UseDefaults(), motionCanvas.CanvasCore); core.Update(); } diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/CartesianChart.xaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/CartesianChart.xaml.cs index 2d3b5e278..ff9af2d4a 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/CartesianChart.xaml.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/CartesianChart.xaml.cs @@ -60,7 +60,6 @@ public partial class CartesianChart : ContentView, ICartesianChartView> _visualsObserver; private IChartLegend? _legend = new SKDefaultLegend(); private IChartTooltip? _tooltip = new SKDefaultTooltip(); - private bool _isZoomingSectionAttached; #endregion @@ -747,6 +746,15 @@ void IChartView.InvokeOnUIThread(Action action) protected void InitializeCore() { var zoomingSection = new RectangleGeometry(); + var zoomingSectionPaint = new SolidColorPaint + { + IsFill = true, + Color = new SkiaSharp.SKColor(33, 150, 243, 50), + ZIndex = int.MaxValue + }; + zoomingSectionPaint.AddGeometryToPaintTask(canvas!.CanvasCore, zoomingSection); + canvas.CanvasCore.AddDrawableTask(zoomingSectionPaint); + _core = new CartesianChart( this, config => config.UseDefaults(), canvas.CanvasCore, zoomingSection); _core.Update(); @@ -786,20 +794,6 @@ private void OnPressed(object? sender, Behaviours.Events.PressedEventArgs args) // https://github.com/dotnet/maui/issues/16202 //if (Keyboard.Modifiers > 0) return; - if (!_isZoomingSectionAttached) - { - var zoomingSectionPaint = new SolidColorPaint - { - IsFill = true, - Color = new SkiaSharp.SKColor(33, 150, 243, 50), - ZIndex = int.MaxValue - }; - var zoomingSection = ((CartesianChart)CoreChart)._zoomingSection; - zoomingSectionPaint.AddGeometryToPaintTask(canvas.CanvasCore, zoomingSection); - canvas.CanvasCore.AddDrawableTask(zoomingSectionPaint); - _isZoomingSectionAttached = true; - } - var cArgs = new PointerCommandArgs(this, new(args.Location.X, args.Location.Y), args); if (PressedCommand?.CanExecute(cArgs) == true) PressedCommand.Execute(cArgs); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/ChartBehaviour.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/ChartBehaviour.cs index 67b775bb6..ab34ab782 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/ChartBehaviour.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/ChartBehaviour.cs @@ -1,4 +1,5 @@ -// The MIT License(MIT) + +// The MIT License(MIT) // // Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors // @@ -59,7 +60,9 @@ public void On(Microsoft.Maui.Controls.VisualElement element) contentView.UserInteractionEnabled = true; +#if MACCATALYST contentView.AddGestureRecognizer(GetMacCatalystHover(contentView)); +#endif contentView.AddGestureRecognizer(GetMacCatalystLongPress(contentView)); contentView.AddGestureRecognizer(GetMacCatalystPinch(contentView)); contentView.AddGestureRecognizer(GetMacCatalystOnPan(contentView)); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj index 50a90467e..ba42e36ca 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj @@ -1,12 +1,19 @@ - net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 - true - true enable - 11.0 + 12.0 + + true + true + + + net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst; + + + $(TargetFrameworks); + net8.0-windows10.0.19041.0 + 11.0 13.1 @@ -15,7 +22,13 @@ 10.0.17763.0 6.5 - 2.0.0-rc2 + + win-x86;win-x64;win-arm64 + + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for Maui. MIT @@ -26,35 +39,18 @@ True bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - - - + + + + - - + + - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.nuspec b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.nuspec index 0617384bb..e00aae61f 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.nuspec +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.nuspec @@ -2,7 +2,7 @@ LiveChartsCore.SkiaSharpView.Maui - 2.0.0-rc2 + 2.0.0-rc3 LiveChartsCore.SkiaSharpView.Maui BetoRodriguez true @@ -16,24 +16,24 @@ - - + + - - + + - - + + - - + + - - + + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/ChartBehaviour.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/ChartBehaviour.cs index ae0a983d6..49b273d94 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/ChartBehaviour.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/ChartBehaviour.cs @@ -54,7 +54,9 @@ public void On(FrameworkElement element) #elif MACCATALYST || IOS element.UserInteractionEnabled = true; +#if MACCATALYST element.AddGestureRecognizer(GetMacCatalystHover(element)); +#endif element.AddGestureRecognizer(GetMacCatalystLongPress(element)); element.AddGestureRecognizer(GetMacCatalystPinch(element)); element.AddGestureRecognizer(GetMacCatalystOnPan(element)); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/ChartBehaviour.uno.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/ChartBehaviour.uno.cs index 9eadfca40..f22d9aa97 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/ChartBehaviour.uno.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/ChartBehaviour.uno.cs @@ -22,7 +22,7 @@ #if (HAS_UNO || HAS_UNO_WINUI) && !ANDROID && !IOS && !MACCATALYST && !WINDOWS -// Work around for Uno (WASM and SKIA), we use the same code as WinUI, but we +// Workaround for Uno (WASM and SKIA), we use the same code as WinUI, but we // can not call this from the behaviours assembly because it does not have // a reference to the Uno assembly. So we have to copy the code here. diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj index a4bf59762..83dd62699 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj @@ -1,16 +1,33 @@ - - $(TargetFrameworks);net7.0-windows10.0.19041 + enable + 12.0 + + + net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst; - $(TargetFrameworks);net7.0;net7.0-ios;net7.0-maccatalyst;net7.0-android + + $(TargetFrameworks); + net8.0-windows10.0.19041.0 + + + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + win-x86;win-x64;win-arm64 + true - enable - 11.0 - 2.0.0-rc2 + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for Uno.WinUI. MIT @@ -25,19 +42,22 @@ bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + + + Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.8" /> + Include="SkiaSharp.Views.WinUI" Version="2.88.8" /> @@ -63,4 +83,4 @@ - \ No newline at end of file + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/AssemblyInfo.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/AssemblyInfo.cs deleted file mode 100644 index 9f5a39c7a..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System.Runtime.CompilerServices; -#if !DEBUG -using System.Reflection; - -[assembly: AssemblyKeyFile("./../../../LiveCharts.snk")] -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d53791eaa0d98b405ca858f39169be6af36ceb7a1bca3ca76c6905fd22fddf8c5e4ef2778a5d7a77ad12f08da711fecfc44795c7923739a2acac946b3f1719a6dfc238695bc69cf5d959b3fb6bc4d18d57a97ff8ed897e6b22a6b8155401ee368d77431e74178104b4adca73520b058b9be28d4ec129beb54871778167afa5ce")] -#else -[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")] -#endif - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.Android.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.Android.cs deleted file mode 100644 index 30fb379cb..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.Android.cs +++ /dev/null @@ -1,133 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#if ANDROID - -using Android.Views; -using LiveChartsCore.Drawing; - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours; - -/// -/// A class that adds platform-specific events to the chart. -/// -public partial class ChartBehaviour -{ - private bool _isPinching; - private bool _isDown; - private LvcPoint _lastTouch; - private ScaleGestureDetector? _scaleDetector; - private CustomScaleListener _customScaleListener = null!; - private DateTime _previousPress = DateTime.MinValue; - - protected void OnAndroidHover(object? sender, View.HoverEventArgs e) - { - if (e.Event is null) return; - - var p = new LvcPoint(e.Event.GetX() / Density, e.Event.GetY() / Density); - Moved?.Invoke(sender, new(p, e.Event)); - } - - protected void OnAndroidTouched(object? sender, View.TouchEventArgs e) - { - if (e.Event is null) return; - - var p = new LvcPoint(e.Event.GetX() / Density, e.Event.GetY() / Density); - var isRightClick = (DateTime.Now - _previousPress).TotalMilliseconds < 500; - var isPinch = e.Event.PointerCount > 1; - - _scaleDetector ??= new ScaleGestureDetector( - ((View)sender!).Context!, _customScaleListener = new CustomScaleListener(scale => - { - Pinched?.Invoke(sender, new(scale, _lastTouch, _scaleDetector!)); - })); - - _ = _scaleDetector.OnTouchEvent(e.Event); - - switch (e.Event.ActionMasked) - { - case MotionEventActions.ButtonPress: - case MotionEventActions.Pointer1Down: - case MotionEventActions.Pointer2Down: - case MotionEventActions.Pointer3Down: - case MotionEventActions.Down: - _isPinching = isPinch; - _isDown = true; - if (!_isPinching) - Pressed?.Invoke(sender, new(p, isRightClick, e.Event)); - _previousPress = DateTime.Now; - _customScaleListener.Paused = isRightClick && !isPinch; - break; - case MotionEventActions.Move: - case MotionEventActions.HoverMove: - // the Moved event is only raised when the pointer is down, - // it is also fired from the hover handler when the pointer is not down. - if (!_isPinching && _isDown) - Moved?.Invoke(sender, new(p, e.Event)); - break; - case MotionEventActions.ButtonRelease: - case MotionEventActions.Pointer1Up: - case MotionEventActions.Pointer2Up: - case MotionEventActions.Pointer3Up: - case MotionEventActions.Up: - case MotionEventActions.Cancel: - if (!_isPinching && _isDown) - Released?.Invoke(sender, new(p, isRightClick, e.Event)); - else - _isPinching = false; - _isDown = false; - _customScaleListener.Paused = false; - break; - case MotionEventActions.HoverEnter: - case MotionEventActions.HoverExit: - case MotionEventActions.Mask: - case MotionEventActions.Outside: - case MotionEventActions.PointerIdMask: - case MotionEventActions.PointerIdShift: - default: - break; - } - - _lastTouch = p; - } - - private class CustomScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener - { - private readonly Action _onScaled; - - public CustomScaleListener(Action onSacaled) - { - _onScaled = onSacaled; - } - - public bool Paused { get; set; } - - public override bool OnScale(ScaleGestureDetector? detector) - { - if (detector is null || detector.ScaleFactor == 1 || Paused) return false; - _onScaled(detector.ScaleFactor); - return true; - } - } -} - -#endif diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.MacCatalyst.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.MacCatalyst.cs deleted file mode 100644 index 5f0c12a13..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.MacCatalyst.cs +++ /dev/null @@ -1,149 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#if MACCATALYST || IOS - -using System; -using LiveChartsCore.Drawing; -using UIKit; - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours; - -/// -/// A class that adds platform-specific events to the chart. -/// -public partial class ChartBehaviour -{ - private DateTime _previousPress = DateTime.MinValue; - - protected UIHoverGestureRecognizer GetMacCatalystHover(UIView view) - { - return new UIHoverGestureRecognizer((UIHoverGestureRecognizer e) => - { - switch (e.State) - { - case UIGestureRecognizerState.Changed: - var p = e.LocationInView(view); - Moved?.Invoke(view, new(new(p.X, p.Y), e)); - break; - case UIGestureRecognizerState.Cancelled: - case UIGestureRecognizerState.Failed: - case UIGestureRecognizerState.Ended: - Exited?.Invoke(view, new(e)); - break; - case UIGestureRecognizerState.Possible: - case UIGestureRecognizerState.Began: - default: - break; - } - }); - } - - protected UILongPressGestureRecognizer GetMacCatalystLongPress(UIView view) - { - return new UILongPressGestureRecognizer((UILongPressGestureRecognizer e) => - { - var location = e.LocationInView(view); - var p = new LvcPoint((float)location.X, (float)location.Y); - var isRightClick = (DateTime.Now - _previousPress).TotalMilliseconds < 500; - var isPinch = e.NumberOfTouches > 1; - - switch (e.State) - { - case UIGestureRecognizerState.Began: - Pressed?.Invoke(view, new(p, isRightClick, e)); - _previousPress = DateTime.Now; - break; - case UIGestureRecognizerState.Changed: - Moved?.Invoke(view, new(p, e)); - break; - case UIGestureRecognizerState.Cancelled: - case UIGestureRecognizerState.Ended: - Released?.Invoke(view, new(p, isRightClick, e)); - break; - case UIGestureRecognizerState.Possible: - case UIGestureRecognizerState.Failed: - default: - break; - } - }) - { - MinimumPressDuration = 0, - ShouldRecognizeSimultaneously = (g1, g2) => true - }; - } - - private float _previousScale = 1; - protected UIPinchGestureRecognizer GetMacCatalystPinch(UIView view) - { - return new UIPinchGestureRecognizer((UIPinchGestureRecognizer e) => - { - var p = e.LocationInView(view); - - switch (e.State) - { - case UIGestureRecognizerState.Began: - _previousScale = 1; - break; - case UIGestureRecognizerState.Changed: - var s = (float)e.Scale; - var delta = _previousScale - s; - Pinched?.Invoke(view, new(1 - delta, new(p.X, p.Y), e)); - _previousScale = s; - break; - case UIGestureRecognizerState.Ended: - case UIGestureRecognizerState.Cancelled: - break; - case UIGestureRecognizerState.Possible: - case UIGestureRecognizerState.Failed: - default: - break; - } - }) - { - ShouldRecognizeSimultaneously = (g1, g2) => true - }; - } - - private CGPoint? _last; - protected UIPanGestureRecognizer GetMacCatalystOnPan(UIView view) - { - return new UIPanGestureRecognizer((UIPanGestureRecognizer e) => - { - var l = e.LocationInView(view); - _last ??= l; - var delta = _last.Value.Y - l.Y; - var isZoom = e.NumberOfTouches == 0; - var tolerance = 5; // just a fator to avoid multiple calls. - - if (e.State == UIGestureRecognizerState.Ended || !isZoom || Math.Abs(delta) < tolerance) return; - Scrolled?.Invoke(view, new(new(l.X, l.Y), delta, e)); - _last = l; - }) - { - AllowedScrollTypesMask = UIScrollTypeMask.Discrete | UIScrollTypeMask.Continuous, - MinimumNumberOfTouches = 0 - }; - } -} - -#endif diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.Windows.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.Windows.cs deleted file mode 100644 index b90e64e3e..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour.Windows.cs +++ /dev/null @@ -1,77 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#if UAP10_0_18362 - -using Windows.UI.Xaml; -using Windows.UI.Xaml.Input; - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours; - -/// -/// A class that adds platform-specific events to the chart. -/// -public partial class ChartBehaviour -{ - protected void OnWindowsPointerPressed(object sender, PointerRoutedEventArgs e) - { - var p = e.GetCurrentPoint(sender as UIElement); - if (p is null) return; - - Pressed?.Invoke( - sender, - new(new(p.Position.X, p.Position.Y), p.Properties.IsRightButtonPressed, e)); - } - - protected void OnWindowsPointerMoved(object sender, PointerRoutedEventArgs e) - { - var p = e.GetCurrentPoint(sender as UIElement); - if (p is null) return; - - Moved?.Invoke( - sender, - new(new(p.Position.X, p.Position.Y), e)); - } - - protected void OnWindowsPointerReleased(object sender, PointerRoutedEventArgs e) - { - var p = e.GetCurrentPoint(sender as UIElement); - if (p is null) return; - - Released?.Invoke( - sender, - new(new(p.Position.X, p.Position.Y), p.Properties.IsRightButtonPressed, e)); - } - - protected void OnWindowsPointerWheelChanged(object sender, PointerRoutedEventArgs e) - { - var p = e.GetCurrentPoint(sender as UIElement); - Scrolled?.Invoke(sender, new(new(p.Position.X, p.Position.Y), p.Properties.MouseWheelDelta, e)); - } - - protected void OnWindowsPointerExited(object sender, PointerRoutedEventArgs e) - { - Exited?.Invoke(sender, new(e)); - } -} - -#endif diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour._shared.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour._shared.cs deleted file mode 100644 index 21fdb27e8..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/ChartBehaviour._shared.cs +++ /dev/null @@ -1,115 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; -using Windows.UI.Xaml; - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours; - -// ----- -// NOTE (HELP WANTED?) -// this code is repeated, ideally it should be shared between all the projects -// but I am not able to consume the LiveChartsCore.Behaviours project from here -// the thing is that the #IF WINDOWS is not working as expected, already ttried with -// uap10.0.19041 withhour success. -// ----- - -/// -/// A class that adds platform-specific events to the chart. -/// -public partial class ChartBehaviour -{ - /// - /// Gets or sets the screen density. - /// - public double Density { get; set; } - - /// - /// Called when the pointer/tap is pressed. - /// - public event PressedHandler? Pressed; - - /// - /// Called when the pointer/tap is released. - /// - public event PressedHandler? Released; - - /// - /// Called when the pointer/tap moves. - /// - public event ScreenHandler? Moved; - - /// - /// Called when the pointer exits the control. - /// - public event Handler? Exited; - - /// - /// Called when the control is pinched. - /// - public event PinchHandler? Pinched; - - /// - /// Called when the control is scrolled. - /// - public event ScrollHandler? Scrolled; - - /// - /// Attaches the native events on the specified element. - /// - /// The element. - public void On(FrameworkElement element) - { -#if HAS_UNO_WINUI - Density = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi / 96.0f; -#else - Density = element.XamlRoot.RasterizationScale; -#endif - -#if ANDROID - - element.Touch += OnAndroidTouched; - element.Hover += OnAndroidHover; - -#endif - -#if MACCATALYST || IOS - - element.UserInteractionEnabled = true; - element.AddGestureRecognizer(GetMacCatalystHover(element)); - element.AddGestureRecognizer(GetMacCatalystLongPress(element)); - element.AddGestureRecognizer(GetMacCatalystPinch(element)); - element.AddGestureRecognizer(GetMacCatalystOnPan(element)); - -#endif - -#if UAP10_0_18362 - - element.PointerPressed += OnWindowsPointerPressed; - element.PointerMoved += OnWindowsPointerMoved; - element.PointerReleased += OnWindowsPointerReleased; - element.PointerWheelChanged += OnWindowsPointerWheelChanged; - element.PointerExited += OnWindowsPointerExited; - -#endif - } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/EventArgs.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/EventArgs.cs deleted file mode 100644 index 07c6f320b..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/EventArgs.cs +++ /dev/null @@ -1,43 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the screen event args. -/// -public class EventArgs -{ - /// - /// Initializes a new instance of the class. - /// - /// The original event. - public EventArgs(object originalEvent) - { - OriginalEvent = originalEvent; - } - - /// - /// Gets the original event. - /// - public object OriginalEvent { get; } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/Handler.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/Handler.cs deleted file mode 100644 index e13012e70..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/Handler.cs +++ /dev/null @@ -1,30 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the pinch event handler. -/// -/// The sender. -/// The args. -public delegate void Handler(object? sender, EventArgs args); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PinchEventArgs.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PinchEventArgs.cs deleted file mode 100644 index 155343d9c..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PinchEventArgs.cs +++ /dev/null @@ -1,54 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using LiveChartsCore.Drawing; - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the pinch event args. -/// -public class PinchEventArgs : EventArgs -{ - /// - /// Initializes a new instance of the class. - /// - /// The scale. - /// The start. - /// The original event. - public PinchEventArgs(float scale, LvcPoint pinchStart, object originalEvent) - : base(originalEvent) - { - Scale = scale; - PinchStart = pinchStart; - } - - /// - /// Gets the scale. - /// - public float Scale { get; } - - /// - /// Gets the pinch star location. - /// - public LvcPoint PinchStart { get; set; } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PinchHandler.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PinchHandler.cs deleted file mode 100644 index b556a50d4..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PinchHandler.cs +++ /dev/null @@ -1,30 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the pinch event handler. -/// -/// The sender. -/// The args. -public delegate void PinchHandler(object? sender, PinchEventArgs args); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PressedEventArgs.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PressedEventArgs.cs deleted file mode 100644 index a5bd9cb80..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PressedEventArgs.cs +++ /dev/null @@ -1,48 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using LiveChartsCore.Drawing; - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the pointer event args. -/// -public class PressedEventArgs : ScreenEventArgs -{ - /// - /// Initializes a new instance of the class. - /// - /// The pointer location. - /// Indicates whether the action is secondary. - /// The original event. - public PressedEventArgs(LvcPoint location, bool isSecondaryPress, object originalEvent) - : base(location, originalEvent) - { - IsSecondaryPress = isSecondaryPress; - } - - /// - /// Gets a value indicating whether the action is a secondary press. - /// - public bool IsSecondaryPress { get; } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PressedHandler.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PressedHandler.cs deleted file mode 100644 index 639b9653c..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/PressedHandler.cs +++ /dev/null @@ -1,30 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the sreen event handler. -/// -/// The sender. -/// The args. -public delegate void PressedHandler(object? sender, PressedEventArgs args); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScreenEventArgs.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScreenEventArgs.cs deleted file mode 100644 index 7fc312251..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScreenEventArgs.cs +++ /dev/null @@ -1,47 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using LiveChartsCore.Drawing; - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the screen event args. -/// -public class ScreenEventArgs : EventArgs -{ - /// - /// Initializes a new instance of the class. - /// - /// The pointer location. - /// The original event. - public ScreenEventArgs(LvcPoint location, object originalEvent) - : base(originalEvent) - { - Location = location; - } - - /// - /// Gets the pointer location. - /// - public LvcPoint Location { get; } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScreenHandler.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScreenHandler.cs deleted file mode 100644 index 3aedd72a5..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScreenHandler.cs +++ /dev/null @@ -1,30 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the sreen event handler. -/// -/// The sender. -/// The args. -public delegate void ScreenHandler(object? sender, ScreenEventArgs args); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScrollEventArgs.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScrollEventArgs.cs deleted file mode 100644 index 91d741360..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScrollEventArgs.cs +++ /dev/null @@ -1,48 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using LiveChartsCore.Drawing; - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the scroll event args. -/// -public class ScrollEventArgs : ScreenEventArgs -{ - /// - /// Initializes a new instance of the class. - /// - /// The pointer location. - /// Indicates the scroll delta. - /// The original event. - public ScrollEventArgs(LvcPoint location, double scrollDelta, object originalEvent) - : base(location, originalEvent) - { - ScrollDelta = scrollDelta; - } - - /// - /// Gets the scroll delta. - /// - public double ScrollDelta { get; } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScrollHandler.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScrollHandler.cs deleted file mode 100644 index 2852f9967..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Behaviours/Events/ScrollHandler.cs +++ /dev/null @@ -1,30 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -namespace LiveChartsCore.SkiaSharpView.Uno.Behaviours.Events; - -/// -/// Defines the scrroll event handler. -/// -/// The sender. -/// The args. -public delegate void ScrollHandler(object? sender, ScrollEventArgs args); diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/CartesianChart.xaml b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/CartesianChart.xaml deleted file mode 100644 index 4aee1794f..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/CartesianChart.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/CartesianChart.xaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/CartesianChart.xaml.cs deleted file mode 100644 index 22fdd82fa..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/CartesianChart.xaml.cs +++ /dev/null @@ -1,911 +0,0 @@ - -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Linq; -using System.Windows.Input; -using LiveChartsCore.Drawing; -using LiveChartsCore.Kernel; -using LiveChartsCore.Kernel.Events; -using LiveChartsCore.Kernel.Sketches; -using LiveChartsCore.Measure; -using LiveChartsCore.Motion; -using LiveChartsCore.SkiaSharpView.Drawing; -using LiveChartsCore.SkiaSharpView.Painting; -using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.SkiaSharpView.Uno.Helpers; -using LiveChartsCore.VisualElements; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; - -// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 - -namespace LiveChartsCore.SkiaSharpView.Uno; - -/// -public sealed partial class CartesianChart : UserControl, ICartesianChartView -{ - #region fields - - private Chart? _core; - private MotionCanvas? _motionCanvas; - private readonly CollectionDeepObserver _seriesObserver; - private readonly CollectionDeepObserver _xObserver; - private readonly CollectionDeepObserver _yObserver; - private readonly CollectionDeepObserver> _sectionsObserver; - private readonly CollectionDeepObserver> _visualsObserver; - - #endregion - - /// - /// Initializes a new instance of the class. - /// - public CartesianChart() - { - LiveCharts.Configure(config => config.UseDefaults()); - - InitializeComponent(); - - _seriesObserver = new CollectionDeepObserver(OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - _xObserver = new CollectionDeepObserver(OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - _yObserver = new CollectionDeepObserver(OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - _sectionsObserver = new CollectionDeepObserver>( - OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - _visualsObserver = new CollectionDeepObserver>( - OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - - Loaded += OnLoaded; - Unloaded += OnUnloaded; - - SetValue(XAxesProperty, new ObservableCollection() - { - LiveCharts.DefaultSettings.GetProvider().GetDefaultCartesianAxis() - }); - SetValue(YAxesProperty, new ObservableCollection() - { - LiveCharts.DefaultSettings.GetProvider().GetDefaultCartesianAxis() - }); - SetValue(SeriesProperty, new ObservableCollection()); - SetValue(SectionsProperty, new ObservableCollection>()); - SetValue(VisualElementsProperty, new ObservableCollection>()); - SetValue(SyncContextProperty, new object()); - } - - #region dependency properties - - /// - /// The title property - /// - public static readonly DependencyProperty TitleProperty = - DependencyProperty.Register( - nameof(Title), typeof(VisualElement), typeof(CartesianChart), new PropertyMetadata(null)); - - /// - /// The series property - /// - public static readonly DependencyProperty SeriesProperty = - DependencyProperty.Register( - nameof(Series), typeof(IEnumerable), typeof(CartesianChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (CartesianChart)o; - var seriesObserver = chart._seriesObserver; - seriesObserver?.Dispose((IEnumerable)args.OldValue); - seriesObserver?.Initialize((IEnumerable)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The x axes property - /// - public static readonly DependencyProperty XAxesProperty = - DependencyProperty.Register( - nameof(XAxes), typeof(IEnumerable), typeof(CartesianChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (CartesianChart)o; - var observer = chart._xObserver; - observer?.Dispose((IEnumerable)args.OldValue); - observer?.Initialize((IEnumerable)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The y axes property - /// - public static readonly DependencyProperty YAxesProperty = - DependencyProperty.Register( - nameof(YAxes), typeof(IEnumerable), typeof(CartesianChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (CartesianChart)o; - var observer = chart._yObserver; - observer?.Dispose((IEnumerable)args.OldValue); - observer?.Initialize((IEnumerable)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The sections property - /// - public static readonly DependencyProperty SectionsProperty = - DependencyProperty.Register( - nameof(Sections), typeof(IEnumerable>), typeof(CartesianChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (CartesianChart)o; - var observer = chart._sectionsObserver; - observer?.Dispose((IEnumerable>)args.OldValue); - observer?.Initialize((IEnumerable>)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The visual elements property - /// - public static readonly DependencyProperty VisualElementsProperty = - DependencyProperty.Register( - nameof(VisualElements), typeof(IEnumerable>), typeof(CartesianChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (CartesianChart)o; - var observer = chart._visualsObserver; - observer?.Dispose((IEnumerable>)args.OldValue); - observer?.Initialize((IEnumerable>)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The sync context property - /// - public static readonly DependencyProperty SyncContextProperty = - DependencyProperty.Register( - nameof(SyncContext), typeof(object), typeof(CartesianChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (CartesianChart)o; - if (chart._motionCanvas != null) chart.CoreCanvas.Sync = args.NewValue; - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The zoom mode property - /// - public static readonly DependencyProperty DrawMarginFrameProperty = - DependencyProperty.Register( - nameof(DrawMarginFrame), typeof(DrawMarginFrame), typeof(CartesianChart), new PropertyMetadata(null)); - - /// - /// The zoom mode property - /// - public static readonly DependencyProperty ZoomModeProperty = - DependencyProperty.Register( - nameof(ZoomMode), typeof(ZoomAndPanMode), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.ZoomMode)); - - /// - /// The zooming speed property - /// - public static readonly DependencyProperty ZoomingSpeedProperty = - DependencyProperty.Register( - nameof(ZoomingSpeed), typeof(double), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.ZoomSpeed)); - - /// - /// The tool tip finding strategy property - /// - public static readonly DependencyProperty TooltipFindingStrategyProperty = - DependencyProperty.Register( - nameof(TooltipFindingStrategy), typeof(TooltipFindingStrategy), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipFindingStrategy, OnDependencyPropertyChanged)); - - /// - /// The draw margin property - /// - public static readonly DependencyProperty DrawMarginProperty = - DependencyProperty.Register( - nameof(DrawMargin), typeof(Margin), typeof(CartesianChart), new PropertyMetadata(null, OnDependencyPropertyChanged)); - - /// - /// The animations speed property - /// - public static readonly DependencyProperty AnimationsSpeedProperty = - DependencyProperty.Register( - nameof(AnimationsSpeed), typeof(TimeSpan), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.AnimationsSpeed, OnDependencyPropertyChanged)); - - /// - /// The easing function property - /// - public static readonly DependencyProperty EasingFunctionProperty = - DependencyProperty.Register( - nameof(EasingFunction), typeof(Func), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.EasingFunction, OnDependencyPropertyChanged)); - - /// - /// The legend position property - /// - public static readonly DependencyProperty LegendPositionProperty = - DependencyProperty.Register( - nameof(LegendPosition), typeof(LegendPosition), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendPosition, OnDependencyPropertyChanged)); - - /// - /// The legend background paint property - /// - public static readonly DependencyProperty LegendBackgroundPaintProperty = - DependencyProperty.Register( - nameof(LegendBackgroundPaint), typeof(IPaint), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendBackgroundPaint, OnDependencyPropertyChanged)); - - /// - /// The legend text paint property - /// - public static readonly DependencyProperty LegendTextPaintProperty = - DependencyProperty.Register( - nameof(LegendTextPaint), typeof(IPaint), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendTextPaint, OnDependencyPropertyChanged)); - - /// - /// The legend text size property - /// - public static readonly DependencyProperty LegendTextSizeProperty = - DependencyProperty.Register( - nameof(LegendTextSize), typeof(double?), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendTextSize, OnDependencyPropertyChanged)); - - /// - /// The tool tip position property - /// - public static readonly DependencyProperty TooltipPositionProperty = - DependencyProperty.Register( - nameof(TooltipPosition), typeof(TooltipPosition), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipPosition, OnDependencyPropertyChanged)); - - /// - /// The tooltip background paint property - /// - public static readonly DependencyProperty TooltipBackgroundPaintProperty = - DependencyProperty.Register( - nameof(TooltipBackgroundPaint), typeof(IPaint), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipBackgroundPaint, OnDependencyPropertyChanged)); - - /// - /// The tooltip text paint property - /// - public static readonly DependencyProperty TooltipTextPaintProperty = - DependencyProperty.Register( - nameof(TooltipTextPaint), typeof(IPaint), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipTextPaint, OnDependencyPropertyChanged)); - - /// - /// The tooltip text size property - /// - public static readonly DependencyProperty TooltipTextSizeProperty = - DependencyProperty.Register( - nameof(TooltipTextSize), typeof(double?), typeof(CartesianChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipTextSize, OnDependencyPropertyChanged)); - - /// - /// The update started command. - /// - public static readonly DependencyProperty UpdateStartedCommandProperty = - DependencyProperty.Register( - nameof(UpdateStartedCommand), typeof(ICommand), typeof(CartesianChart), - new PropertyMetadata(null)); - - /// - /// The pointer pressed command. - /// - public static readonly DependencyProperty PointerPressedCommandProperty = - DependencyProperty.Register( - nameof(PointerPressedCommand), typeof(ICommand), typeof(CartesianChart), - new PropertyMetadata(null)); - - /// - /// The pointer released command. - /// - public static readonly DependencyProperty PointerReleasedCommandProperty = - DependencyProperty.Register( - nameof(PointerReleasedCommand), typeof(ICommand), typeof(CartesianChart), - new PropertyMetadata(null)); - - /// - /// The pointer move command. - /// - public static readonly DependencyProperty PointerMoveCommandProperty = - DependencyProperty.Register( - nameof(PointerMoveCommand), typeof(ICommand), typeof(CartesianChart), - new PropertyMetadata(null)); - - /// - /// The data pointer down command property - /// - public static readonly DependencyProperty DataPointerDownCommandProperty = - DependencyProperty.Register( - nameof(DataPointerDownCommand), typeof(ICommand), typeof(CartesianChart), new PropertyMetadata(null)); - - /// - /// The chart point pointer down command property - /// - public static readonly DependencyProperty ChartPointPointerDownCommandProperty = - DependencyProperty.Register( - nameof(ChartPointPointerDownCommand), typeof(ICommand), typeof(CartesianChart), new PropertyMetadata(null)); - - /// - /// The chart point pointer down command property - /// - public static readonly DependencyProperty VisualElementsPointerDownCommandProperty = - DependencyProperty.Register( - nameof(VisualElementsPointerDownCommand), typeof(ICommand), typeof(CartesianChart), new PropertyMetadata(null)); - - #endregion - - #region events - - /// - public event ChartEventHandler? Measuring; - - /// - public event ChartEventHandler? UpdateStarted; - - /// - public event ChartEventHandler? UpdateFinished; - - /// - public event ChartPointsHandler? DataPointerDown; - - /// - public event ChartPointHandler? ChartPointPointerDown; - - /// - public event VisualElementsHandler? VisualElementsPointerDown; - - #endregion - - #region properties - - /// - bool IChartView.DesignerMode => Windows.ApplicationModel.DesignMode.DesignModeEnabled; - - /// - public IChart CoreChart => _core ?? throw new Exception("Core not set yet."); - - /// - public object SyncContext - { - get => GetValue(SyncContextProperty); - set => SetValue(SyncContextProperty, value); - } - - LvcColor IChartView.BackColor - { - get => Background is not SolidColorBrush b - ? new LvcColor() - : LvcColor.FromArgb(b.Color.A, b.Color.R, b.Color.G, b.Color.B); - set => SetValue(BackgroundProperty, new SolidColorBrush(Windows.UI.Color.FromArgb(value.A, value.R, value.G, value.B))); - } - - /// - public Margin DrawMargin - { - get => (Margin)GetValue(DrawMarginProperty); - set => SetValue(DrawMarginProperty, value); - } - - Margin? IChartView.DrawMargin - { - get => DrawMargin; - set => SetValue(DrawMarginProperty, value); - } - - LvcSize IChartView.ControlSize => _motionCanvas == null - ? throw new Exception("Canvas not found") - : new LvcSize { Width = (float)_motionCanvas.ActualWidth, Height = (float)_motionCanvas.ActualHeight }; - - /// - public MotionCanvas CoreCanvas => _motionCanvas == null ? throw new Exception("Canvas not found") : _motionCanvas.CanvasCore; - - CartesianChart ICartesianChartView.Core => - _core == null ? throw new Exception("core not found") : (CartesianChart)_core; - - /// - public VisualElement? Title - { - get => (VisualElement?)GetValue(TitleProperty); - set => SetValue(TitleProperty, value); - } - - /// - public IEnumerable Series - { - get => (IEnumerable)GetValue(SeriesProperty); - set => SetValue(SeriesProperty, value); - } - - /// - public IEnumerable XAxes - { - get => (IEnumerable)GetValue(XAxesProperty); - set => SetValue(XAxesProperty, value); - } - - /// - public IEnumerable YAxes - { - get => (IEnumerable)GetValue(YAxesProperty); - set => SetValue(YAxesProperty, value); - } - - /// - public IEnumerable> Sections - { - get => (IEnumerable>)GetValue(SectionsProperty); - set => SetValue(SectionsProperty, value); - } - - /// - public IEnumerable> VisualElements - { - get => (IEnumerable>)GetValue(VisualElementsProperty); - set => SetValue(VisualElementsProperty, value); - } - - /// - public DrawMarginFrame? DrawMarginFrame - { - get => (DrawMarginFrame)GetValue(DrawMarginFrameProperty); - set => SetValue(DrawMarginFrameProperty, value); - } - - /// - public ZoomAndPanMode ZoomMode - { - get => (ZoomAndPanMode)GetValue(ZoomModeProperty); - set => SetValue(ZoomModeProperty, value); - } - - ZoomAndPanMode ICartesianChartView.ZoomMode - { - get => ZoomMode; - set => SetValue(ZoomModeProperty, value); - } - - /// - public double ZoomingSpeed - { - get => (double)GetValue(ZoomingSpeedProperty); - set => SetValue(ZoomingSpeedProperty, value); - } - - double ICartesianChartView.ZoomingSpeed - { - get => ZoomingSpeed; - set => SetValue(ZoomingSpeedProperty, value); - } - - /// - public TooltipFindingStrategy TooltipFindingStrategy - { - get => (TooltipFindingStrategy)GetValue(TooltipFindingStrategyProperty); - set => SetValue(TooltipFindingStrategyProperty, value); - } - - /// - public TimeSpan AnimationsSpeed - { - get => (TimeSpan)GetValue(AnimationsSpeedProperty); - set => SetValue(AnimationsSpeedProperty, value); - } - - TimeSpan IChartView.AnimationsSpeed - { - get => AnimationsSpeed; - set => SetValue(AnimationsSpeedProperty, value); - } - - /// - public Func EasingFunction - { - get => (Func)GetValue(EasingFunctionProperty); - set => SetValue(EasingFunctionProperty, value); - } - - Func? IChartView.EasingFunction - { - get => EasingFunction; - set => SetValue(EasingFunctionProperty, value); - } - - /// - public LegendPosition LegendPosition - { - get => (LegendPosition)GetValue(LegendPositionProperty); - set => SetValue(LegendPositionProperty, value); - } - - /// - public TooltipPosition TooltipPosition - { - get => (TooltipPosition)GetValue(TooltipPositionProperty); - set => SetValue(TooltipPositionProperty, value); - } - - /// - public IPaint? TooltipBackgroundPaint - { - get => (IPaint?)GetValue(TooltipBackgroundPaintProperty); - set => SetValue(TooltipBackgroundPaintProperty, value); - } - - /// - public IPaint? TooltipTextPaint - { - get => (IPaint?)GetValue(TooltipTextPaintProperty); - set => SetValue(TooltipTextPaintProperty, value); - } - - /// - public double? TooltipTextSize - { - get => (double?)GetValue(TooltipTextSizeProperty); - set => SetValue(TooltipTextSizeProperty, value); - } - - /// - public IChartTooltip? Tooltip { get; set; } = new SKDefaultTooltip(); - - /// - public IPaint? LegendBackgroundPaint - { - get => (IPaint?)GetValue(LegendBackgroundPaintProperty); - set => SetValue(LegendBackgroundPaintProperty, value); - } - - /// - public IPaint? LegendTextPaint - { - get => (IPaint?)GetValue(LegendTextPaintProperty); - set => SetValue(LegendTextPaintProperty, value); - } - - /// - public double? LegendTextSize - { - get => (double?)GetValue(LegendTextSizeProperty); - set => SetValue(LegendTextSizeProperty, value); - } - - /// - public IChartLegend? Legend { get; set; } = new SKDefaultLegend(); - - /// - public bool AutoUpdateEnabled { get; set; } = true; - - /// - public TimeSpan UpdaterThrottler { get; set; } = LiveCharts.DefaultSettings.UpdateThrottlingTimeout; - - /// - /// Gets or sets a command to execute when the chart update started. - /// - public ICommand? UpdateStartedCommand - { - get => (ICommand?)GetValue(UpdateStartedCommandProperty); - set => SetValue(UpdateStartedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer is pressed on the chart. - /// - public ICommand? PointerPressedCommand - { - get => (ICommand?)GetValue(PointerPressedCommandProperty); - set => SetValue(PointerPressedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer is released on the chart. - /// - public ICommand? PointerReleasedCommand - { - get => (ICommand?)GetValue(PointerReleasedCommandProperty); - set => SetValue(PointerReleasedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer moves over the chart. - /// - public ICommand? PointerMoveCommand - { - get => (ICommand?)GetValue(PointerMoveCommandProperty); - set => SetValue(PointerMoveCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a data or data points. - /// - public ICommand DataPointerDownCommand - { - get => (ICommand)GetValue(DataPointerDownCommandProperty); - set => SetValue(DataPointerDownCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a chart point. - /// - public ICommand ChartPointPointerDownCommand - { - get => (ICommand)GetValue(ChartPointPointerDownCommandProperty); - set => SetValue(ChartPointPointerDownCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a chart point. - /// - public ICommand? VisualElementsPointerDownCommand - { - get => (ICommand?)GetValue(VisualElementsPointerDownCommandProperty); - set => SetValue(VisualElementsPointerDownCommandProperty, value); - } - - #endregion - - /// - [Obsolete("Use the ScalePixelsToData method instead.")] - public double[] ScaleUIPoint(LvcPoint point, int xAxisIndex = 0, int yAxisIndex = 0) - { - if (_core == null) throw new Exception("core not found"); - var cartesianCore = (CartesianChart)_core; - return cartesianCore.ScaleUIPoint(point, xAxisIndex, yAxisIndex); - } - - /// - public LvcPointD ScalePixelsToData(LvcPointD point, int xAxisIndex = 0, int yAxisIndex = 0) - { - if (_core is not CartesianChart cc) throw new Exception("core not found"); - var xScaler = new Scaler(cc.DrawMarginLocation, cc.DrawMarginSize, cc.XAxes[xAxisIndex]); - var yScaler = new Scaler(cc.DrawMarginLocation, cc.DrawMarginSize, cc.YAxes[yAxisIndex]); - - return new LvcPointD { X = xScaler.ToChartValues(point.X), Y = yScaler.ToChartValues(point.Y) }; - } - - /// - public LvcPointD ScaleDataToPixels(LvcPointD point, int xAxisIndex = 0, int yAxisIndex = 0) - { - if (_core is not CartesianChart cc) throw new Exception("core not found"); - - var xScaler = new Scaler(cc.DrawMarginLocation, cc.DrawMarginSize, cc.XAxes[xAxisIndex]); - var yScaler = new Scaler(cc.DrawMarginLocation, cc.DrawMarginSize, cc.YAxes[yAxisIndex]); - - return new LvcPointD { X = xScaler.ToPixels(point.X), Y = yScaler.ToPixels(point.Y) }; - } - - /// - public IEnumerable GetPointsAt(LvcPoint point, TooltipFindingStrategy strategy = TooltipFindingStrategy.Automatic) - { - if (_core is not CartesianChart cc) throw new Exception("core not found"); - - if (strategy == TooltipFindingStrategy.Automatic) - strategy = cc.Series.GetTooltipFindingStrategy(); - - return cc.Series.SelectMany(series => series.FindHitPoints(cc, point, strategy)); - } - - /// - public IEnumerable> GetVisualsAt(LvcPoint point) - { - return _core is not CartesianChart cc - ? throw new Exception("core not found") - : cc.VisualElements.SelectMany(visual => ((VisualElement)visual).IsHitBy(_core, point)); - } - - void IChartView.InvokeOnUIThread(Action action) - { - UnoPlatformHelpers.InvokeOnUIThread(action); - } - - private void OnLoaded(object sender, RoutedEventArgs e) - { - var canvas = (MotionCanvas)FindName("motionCanvas"); - - _motionCanvas = canvas; - - if (_core is null) - { - var zoomingSection = new Drawing.Geometries.RectangleGeometry(); - var zoomingSectionPaint = new SolidColorPaint - { - IsFill = true, - Color = new SkiaSharp.SKColor(33, 150, 243, 50), - ZIndex = int.MaxValue - }; - zoomingSectionPaint.AddGeometryToPaintTask(canvas.CanvasCore, zoomingSection); - canvas.CanvasCore.AddDrawableTask(zoomingSectionPaint); - - _core = new CartesianChart( - this, config => config.UseDefaults(), canvas.CanvasCore, zoomingSection); - - if (SyncContext != null) - _motionCanvas.CanvasCore.Sync = SyncContext; - - if (_core == null) throw new Exception("Core not found!"); - _core.Measuring += OnCoreMeasuring; - _core.UpdateStarted += OnCoreUpdateStarted; - _core.UpdateFinished += OnCoreUpdateFinished; - - SizeChanged += OnSizeChanged; - - var chartBehaviour = new Behaviours.ChartBehaviour(); - - chartBehaviour.Pressed += OnPressed; - chartBehaviour.Moved += OnMoved; - chartBehaviour.Released += OnReleased; - chartBehaviour.Scrolled += OnScrolled; - chartBehaviour.Pinched += OnPinched; - chartBehaviour.Exited += OnExited; - - chartBehaviour.On(this); - } - - _core.Load(); - _core.Update(); - } - - private void OnDeepCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) - { - _core?.Update(); - } - - private void OnDeepCollectionPropertyChanged(object? sender, PropertyChangedEventArgs e) - { - _core?.Update(); - } - - private void OnSizeChanged(object? sender, SizeChangedEventArgs e) - { - if (_core == null) throw new Exception("Core not found!"); - _core.Update(); - } - - private void OnPressed(object? sender, Behaviours.Events.PressedEventArgs args) - { - // is this working on all platforms? - //if (args.KeyModifiers > 0) return; - - var cArgs = new PointerCommandArgs(this, new(args.Location.X, args.Location.Y), args); - if (PointerPressedCommand?.CanExecute(cArgs) == true) PointerPressedCommand.Execute(cArgs); - - _core?.InvokePointerDown(args.Location, args.IsSecondaryPress); - } - - private void OnMoved(object? sender, Behaviours.Events.ScreenEventArgs args) - { - var location = args.Location; - - var cArgs = new PointerCommandArgs(this, new(location.X, location.Y), args.OriginalEvent); - if (PointerMoveCommand?.CanExecute(cArgs) == true) PointerMoveCommand.Execute(cArgs); - - _core?.InvokePointerMove(location); - } - - private void OnReleased(object? sender, Behaviours.Events.PressedEventArgs args) - { - var cArgs = new PointerCommandArgs(this, new(args.Location.X, args.Location.Y), args); - if (PointerReleasedCommand?.CanExecute(cArgs) == true) PointerReleasedCommand.Execute(cArgs); - - _core?.InvokePointerUp(args.Location, args.IsSecondaryPress); - } - - private void OnScrolled(object? sender, Behaviours.Events.ScrollEventArgs args) - { - if (_core is null) throw new Exception("core not found"); - var c = (CartesianChart)_core; - c.Zoom(args.Location, args.ScrollDelta > 0 ? ZoomDirection.ZoomIn : ZoomDirection.ZoomOut); - } - - private void OnPinched(object? sender, Behaviours.Events.PinchEventArgs args) - { - if (_core is null) return; - - var c = (CartesianChart)_core; - var p = args.PinchStart; - var s = c.ControlSize; - var pivot = new LvcPoint((float)(p.X * s.Width), (float)(p.Y * s.Height)); - c.Zoom(pivot, ZoomDirection.DefinedByScaleFactor, args.Scale, true); - } - - private void OnExited(object? sender, Behaviours.Events.EventArgs args) - { - _core?.InvokePointerLeft(); - } - - private void OnCoreUpdateFinished(IChartView chart) - { - UpdateFinished?.Invoke(this); - } - - private void OnCoreUpdateStarted(IChartView chart) - { - if (UpdateStartedCommand is not null) - { - var args = new ChartCommandArgs(this); - if (UpdateStartedCommand.CanExecute(args)) UpdateStartedCommand.Execute(args); - } - - UpdateStarted?.Invoke(this); - } - - private void OnCoreMeasuring(IChartView chart) - { - Measuring?.Invoke(this); - } - - private void OnUnloaded(object? sender, RoutedEventArgs e) - { - _core?.Unload(); - } - - private static void OnDependencyPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs args) - { - var chart = (CartesianChart)o; - if (chart._core == null) return; - - chart._core.Update(); - } - - void IChartView.OnDataPointerDown(IEnumerable points, LvcPoint pointer) - { - DataPointerDown?.Invoke(this, points); - if (DataPointerDownCommand is not null && DataPointerDownCommand.CanExecute(points)) DataPointerDownCommand.Execute(points); - - var closest = points.FindClosestTo(pointer); - ChartPointPointerDown?.Invoke(this, closest); - if (ChartPointPointerDownCommand is not null && ChartPointPointerDownCommand.CanExecute(closest)) ChartPointPointerDownCommand.Execute(closest); - } - - void IChartView.OnVisualElementPointerDown( - IEnumerable> visualElements, LvcPoint pointer) - { - var args = new VisualElementsEventArgs(CoreChart, visualElements, pointer); - - VisualElementsPointerDown?.Invoke(this, args); - if (VisualElementsPointerDownCommand is not null && VisualElementsPointerDownCommand.CanExecute(args)) - VisualElementsPointerDownCommand.Execute(args); - } - - void IChartView.Invalidate() - { - CoreCanvas.Invalidate(); - } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/GeoMap.xaml b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/GeoMap.xaml deleted file mode 100644 index ab54524fe..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/GeoMap.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/GeoMap.xaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/GeoMap.xaml.cs deleted file mode 100644 index 86ccd459f..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/GeoMap.xaml.cs +++ /dev/null @@ -1,279 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Linq; -using LiveChartsCore.Drawing; -using LiveChartsCore.Geo; -using LiveChartsCore.Kernel; -using LiveChartsCore.Measure; -using LiveChartsCore.Motion; -using LiveChartsCore.SkiaSharpView.Drawing; -using LiveChartsCore.SkiaSharpView.Painting; -using LiveChartsCore.SkiaSharpView.Uno.Helpers; -using SkiaSharp; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; - -namespace LiveChartsCore.SkiaSharpView.Uno; - -/// -/// Defines a geographic map. -/// -public sealed partial class GeoMap : UserControl, IGeoMapView -{ - private CollectionDeepObserver _seriesObserver; - private readonly GeoMap _core; - - /// - /// Initializes a new instance of the class. - /// - public GeoMap() - { - InitializeComponent(); - LiveCharts.Configure(config => config.UseDefaults()); - _core = new GeoMap(this); - - PointerPressed += OnPointerPressed; - PointerMoved += OnPointerMoved; - PointerReleased += OnPointerReleased; - PointerWheelChanged += OnWheelChanged; - PointerExited += OnPointerExited; - - SizeChanged += GeoMap_SizeChanged; - - _seriesObserver = new CollectionDeepObserver( - (object sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), - (object sender, PropertyChangedEventArgs e) => _core.Update(), - true); - - SetValue(SeriesProperty, Enumerable.Empty()); - SetValue(ActiveMapProperty, Maps.GetWorldMap()); - SetValue(SyncContextProperty, new object()); - - Unloaded += GeoMap_Unloaded; - } - - #region dependency props - - /// - /// The active map property - /// - public static readonly DependencyProperty ActiveMapProperty = - DependencyProperty.Register(nameof(ActiveMap), typeof(CoreMap), typeof(GeoMap), - new PropertyMetadata(null, OnDependencyPropertyChanged)); - - /// - /// The sync context property. - /// - public static readonly DependencyProperty SyncContextProperty = - DependencyProperty.Register( - nameof(SyncContext), typeof(object), typeof(GeoMap), new PropertyMetadata(null, OnDependencyPropertyChanged)); - - /// - /// The view command property. - /// - public static readonly DependencyProperty ViewCommandProperty = - DependencyProperty.Register( - nameof(ViewCommand), typeof(object), typeof(GeoMap), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (GeoMap)o; - chart._core.ViewTo(args.NewValue); - })); - - /// - /// The map projection property - /// - public static readonly DependencyProperty MapProjectionProperty = - DependencyProperty.Register(nameof(MapProjection), typeof(MapProjection), typeof(GeoMap), - new PropertyMetadata(MapProjection.Default, OnDependencyPropertyChanged)); - - /// - /// The series property - /// - public static readonly DependencyProperty SeriesProperty = - DependencyProperty.Register(nameof(Series), typeof(IEnumerable), - typeof(GeoMap), new PropertyMetadata(null, (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (GeoMap)o; - var seriesObserver = chart._seriesObserver; - seriesObserver?.Dispose((IEnumerable)args.OldValue); - seriesObserver?.Initialize((IEnumerable)args.NewValue); - chart._core.Update(); - })); - - /// - /// The stroke property - /// - public static readonly DependencyProperty StrokeProperty = - DependencyProperty.Register( - nameof(Stroke), typeof(IPaint), typeof(GeoMap), - new PropertyMetadata(new SolidColorPaint(new SKColor(255, 255, 255, 255)) { IsStroke = true }, OnDependencyPropertyChanged)); - - /// - /// The fill property - /// - public static readonly DependencyProperty FillProperty = - DependencyProperty.Register( - nameof(Fill), typeof(IPaint), typeof(GeoMap), - new PropertyMetadata(new SolidColorPaint(new SKColor(240, 240, 240, 255)) { IsFill = true }, OnDependencyPropertyChanged)); - - #endregion - - #region properties - - /// - public bool AutoUpdateEnabled { get; set; } = true; - - /// - bool IGeoMapView.DesignerMode => Windows.ApplicationModel.DesignMode.DesignModeEnabled; - - /// - public object SyncContext - { - get => GetValue(SyncContextProperty); - set => SetValue(SyncContextProperty, value); - } - - /// - public object? ViewCommand - { - get => GetValue(ViewCommandProperty); - set => SetValue(ViewCommandProperty, value); - } - - /// - public MotionCanvas Canvas => canvas.CanvasCore; - - /// - public CoreMap ActiveMap - { - get => (CoreMap)GetValue(ActiveMapProperty); - set => SetValue(ActiveMapProperty, value); - } - - /// - float IGeoMapView.Width => (float)ActualWidth; - - /// - float IGeoMapView.Height => (float)ActualHeight; - - /// - public MapProjection MapProjection - { - get => (MapProjection)GetValue(MapProjectionProperty); - set => SetValue(MapProjectionProperty, value); - } - - /// - public IPaint? Stroke - { - get => (IPaint)GetValue(StrokeProperty); - set - { - if (value is not null) value.IsStroke = true; - SetValue(StrokeProperty, value); - } - } - - /// - public IPaint? Fill - { - get => (IPaint)GetValue(FillProperty); - set - { - if (value is not null) value.IsFill = true; - SetValue(FillProperty, value); - } - } - - /// - public IEnumerable Series - { - get => (IEnumerable)GetValue(SeriesProperty); - set => SetValue(SeriesProperty, value); - } - - #endregion - - void IGeoMapView.InvokeOnUIThread(Action action) - { - UnoPlatformHelpers.InvokeOnUIThread(action); - } - - private void GeoMap_SizeChanged(object sender, SizeChangedEventArgs e) - { - _core.Update(); - } - - private void GeoMap_Unloaded(object sender, RoutedEventArgs e) - { - _core.Unload(); - } - - private void OnPointerPressed(object sender, PointerRoutedEventArgs e) - { - _ = CapturePointer(e.Pointer); - var p = e.GetCurrentPoint(this); - _core?.InvokePointerDown(new LvcPoint((float)p.Position.X, (float)p.Position.Y)); - } - - private void OnPointerMoved(object sender, PointerRoutedEventArgs e) - { - var p = e.GetCurrentPoint(this); - _core?.InvokePointerMove(new LvcPoint((float)p.Position.X, (float)p.Position.Y)); - } - - private void OnPointerReleased(object sender, PointerRoutedEventArgs e) - { - var p = e.GetCurrentPoint(this); - _core?.InvokePointerUp(new LvcPoint((float)p.Position.X, (float)p.Position.Y)); - ReleasePointerCapture(e.Pointer); - } - - private void OnPointerExited(object sender, PointerRoutedEventArgs e) - { - _core?.InvokePointerLeft(); - } - - private void OnWheelChanged(object sender, PointerRoutedEventArgs e) - { - if (_core == null) throw new Exception("core not found"); - var p = e.GetCurrentPoint(this); - - _core.ViewTo( - new ZoomOnPointerView( - new LvcPoint((float)p.Position.X, (float)p.Position.Y), - p.Properties.MouseWheelDelta > 0 ? ZoomDirection.ZoomIn : ZoomDirection.ZoomOut)); - } - - private static void OnDependencyPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs args) - { - var chart = (GeoMap)o; - chart._core.Update(); - } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Helpers/UnoPlatformHelpers.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Helpers/UnoPlatformHelpers.cs deleted file mode 100644 index 6937a5b23..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Helpers/UnoPlatformHelpers.cs +++ /dev/null @@ -1,57 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System; -using System.Runtime.InteropServices; -using Windows.ApplicationModel.Core; -using Windows.UI.Core; - -namespace LiveChartsCore.SkiaSharpView.Uno.Helpers; - -// based on https://youtu.be/RInO5Jqru4s?t=4083 - -/// -/// Defines Uno platform helpers. -/// -public static class UnoPlatformHelpers -{ - /// - /// Determines whether the assembly is running in web assembly. - /// - public static bool IsWebAssembly { get; } = RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")); - - /// - /// Invokes a given acction in the UI thread. - /// - /// The action. - public static void InvokeOnUIThread(Action action) - { - if (IsWebAssembly) - { - action(); - return; - } - - _ = CoreApplication.MainView.CoreWindow.Dispatcher - .RunAsync(CoreDispatcherPriority.High, () => action()); - } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/LiveChartsCore.SkiaSharpView.Uno.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/LiveChartsCore.SkiaSharpView.Uno.csproj deleted file mode 100644 index a59c51f93..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/LiveChartsCore.SkiaSharpView.Uno.csproj +++ /dev/null @@ -1,69 +0,0 @@ - - - - uap10.0.18362;netstandard2.0;net6.0-ios;net6.0-macos;net6.0-maccatalyst;net6.0-android - - 14.2 - 14.0 - 21.0 - 10.0.18362.0 - 10.0.18362.0 - - - true - - enable - 11.0 - 2.0.0-rc2 - icon.png - Simple, flexible, interactive and powerful data visualization for Uno. - MIT - BetoRodriguez - true - snupkg - https://github.com/beto-rodriguez/LiveCharts2 - Properties - LiveChartsCore.SkiaSharpView.Uno - LiveChartsCore.SkiaSharpView.Uno - en-US - bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - - - - - - 2.88.6 - - - - - - - - - - - - - - - - %(Filename) - - - - - - - - - - - - - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/MotionCanvas.xaml b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/MotionCanvas.xaml deleted file mode 100644 index 264024e58..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/MotionCanvas.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/MotionCanvas.xaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/MotionCanvas.xaml.cs deleted file mode 100644 index 18965e7c2..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/MotionCanvas.xaml.cs +++ /dev/null @@ -1,150 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using LiveChartsCore.Drawing; -using LiveChartsCore.Kernel; -using LiveChartsCore.Motion; -using LiveChartsCore.SkiaSharpView.Drawing; -using SkiaSharp.Views.UWP; -using Windows.Graphics.Display; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; - -namespace LiveChartsCore.SkiaSharpView.Uno; - -/// -public sealed partial class MotionCanvas : UserControl -{ - private readonly SKXamlCanvas _skiaElement; - private bool _isDrawingLoopRunning; - - /// - /// Initializes a new instance of the class. - /// - public MotionCanvas() - { - InitializeComponent(); - Loaded += OnLoaded; - Unloaded += OnUnloaded; - - var canvas = (SKXamlCanvas)FindName("canvas"); - _skiaElement = canvas; - _skiaElement.PaintSurface += OnPaintSurface; - } - - #region properties - - /// - /// The paint tasks property - /// - public static readonly DependencyProperty PaintTasksProperty = - DependencyProperty.Register( - nameof(PaintTasks), typeof(List>), typeof(MotionCanvas), - new PropertyMetadata(new List>(), new PropertyChangedCallback(OnPaintTaskChanged))); - - /// - /// Gets or sets the paint tasks. - /// - /// - /// The paint tasks. - /// - public List> PaintTasks - { - get => (List>)GetValue(PaintTasksProperty); - set => SetValue(PaintTasksProperty, value); - } - - /// - /// Gets or sets the frames per second. - /// - /// - /// The frames per second. - /// - public double MaxFps { get; set; } = 60; - - /// - /// Gets the canvas core. - /// - /// - /// The canvas core. - /// - public MotionCanvas CanvasCore { get; } = new(); - - #endregion - - private void OnLoaded(object sender, RoutedEventArgs e) - { - CanvasCore.Invalidated += OnCanvasCoreInvalidated; - } - - private void OnPaintSurface(object? sender, SKPaintSurfaceEventArgs args) - { - var scale = DisplayInformation.GetForCurrentView().LogicalDpi / 96.0f; - args.Surface.Canvas.Scale((float)scale, (float)scale); - CanvasCore.DrawFrame(new SkiaSharpDrawingContext(CanvasCore, args.Info, args.Surface, args.Surface.Canvas)); - } - - private async void RunDrawingLoop() - { - if (_isDrawingLoopRunning || _skiaElement == null) return; - _isDrawingLoopRunning = true; - - var ts = TimeSpan.FromSeconds(1 / MaxFps); - while (!CanvasCore.IsValid) - { - _skiaElement.Invalidate(); - await Task.Delay(ts); - } - - _isDrawingLoopRunning = false; - } - - private void OnCanvasCoreInvalidated(MotionCanvas sender) - { - RunDrawingLoop(); - } - - private static void OnPaintTaskChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) - { - var motionCanvas = (MotionCanvas)sender; - - var tasks = new HashSet>(); - - foreach (var item in motionCanvas.PaintTasks ?? Enumerable.Empty>()) - { - item.PaintTask.SetGeometries(motionCanvas.CanvasCore, item.Geometries); - _ = tasks.Add(item.PaintTask); - } - - motionCanvas.CanvasCore.SetPaintTasks(tasks); - } - - private void OnUnloaded(object sender, RoutedEventArgs e) - { - CanvasCore.Invalidated -= OnCanvasCoreInvalidated; - CanvasCore.Dispose(); - } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PieChart.xaml b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PieChart.xaml deleted file mode 100644 index ba406b29a..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PieChart.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PieChart.xaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PieChart.xaml.cs deleted file mode 100644 index c75e965b8..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PieChart.xaml.cs +++ /dev/null @@ -1,770 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Linq; -using System.Windows.Input; -using LiveChartsCore.Drawing; -using LiveChartsCore.Kernel; -using LiveChartsCore.Kernel.Events; -using LiveChartsCore.Kernel.Sketches; -using LiveChartsCore.Measure; -using LiveChartsCore.Motion; -using LiveChartsCore.SkiaSharpView.Drawing; -using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.SkiaSharpView.Uno.Helpers; -using LiveChartsCore.VisualElements; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; - -namespace LiveChartsCore.SkiaSharpView.Uno; - -/// -public sealed partial class PieChart : UserControl, IPieChartView -{ - private Chart? _core; - private MotionCanvas? _canvas; - private readonly CollectionDeepObserver _seriesObserver; - private readonly CollectionDeepObserver> _visualsObserver; - - /// - /// Initializes a new instance of the class. - /// - public PieChart() - { - LiveCharts.Configure(config => config.UseDefaults()); - - InitializeComponent(); - - _seriesObserver = new CollectionDeepObserver( - (object? sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), - (object? sender, PropertyChangedEventArgs e) => _core?.Update()); - _visualsObserver = new CollectionDeepObserver>( - (object? sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), - (object? sender, PropertyChangedEventArgs e) => _core?.Update()); - - SetValue(SeriesProperty, new ObservableCollection()); - SetValue(VisualElementsProperty, new ObservableCollection>()); - SetValue(SyncContextProperty, new object()); - - Loaded += OnLoaded; - Unloaded += OnUnloaded; - } - - #region dependency properties - - /// - /// The title property - /// - public static readonly DependencyProperty TitleProperty = - DependencyProperty.Register( - nameof(Title), typeof(VisualElement), typeof(PieChart), new PropertyMetadata(null)); - - /// - /// The series property - /// - public static readonly DependencyProperty SeriesProperty = - DependencyProperty.Register( - nameof(Series), typeof(IEnumerable), typeof(PieChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (PieChart)o; - var seriesObserver = chart._seriesObserver; - seriesObserver?.Dispose((IEnumerable)args.OldValue); - seriesObserver?.Initialize((IEnumerable)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The visual elements property - /// - public static readonly DependencyProperty VisualElementsProperty = - DependencyProperty.Register( - nameof(VisualElements), typeof(IEnumerable>), typeof(PieChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (PieChart)o; - var observer = chart._visualsObserver; - observer?.Dispose((IEnumerable>)args.OldValue); - observer?.Initialize((IEnumerable>)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The sync context property - /// - public static readonly DependencyProperty SyncContextProperty = - DependencyProperty.Register( - nameof(SyncContext), typeof(object), typeof(PieChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (PieChart)o; - if (chart._canvas != null) chart.CoreCanvas.Sync = args.NewValue; - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The IsClockwise property - /// - public static readonly DependencyProperty IsClockwiseProperty = - DependencyProperty.Register( - nameof(IsClockwise), typeof(bool), typeof(PieChart), new PropertyMetadata(true, OnDependencyPropertyChanged)); - - /// - /// The initial rotation property - /// - public static readonly DependencyProperty InitialRotationProperty = - DependencyProperty.Register( - nameof(InitialRotation), typeof(double), typeof(PieChart), new PropertyMetadata(0d, OnDependencyPropertyChanged)); - - /// - /// The maximum angle property - /// - public static readonly DependencyProperty MaxAngleProperty = - DependencyProperty.Register( - nameof(MaxAngle), typeof(double), typeof(PieChart), new PropertyMetadata(360d, OnDependencyPropertyChanged)); - - /// - /// The total property - /// - public static readonly DependencyProperty MaxValueProperty = - DependencyProperty.Register( - nameof(MaxValue), typeof(double?), typeof(PieChart), new PropertyMetadata(null, OnDependencyPropertyChanged)); - - /// - /// The start property - /// - public static readonly DependencyProperty MinValueProperty = - DependencyProperty.Register( - nameof(MinValue), typeof(double), typeof(PieChart), new PropertyMetadata(0d, OnDependencyPropertyChanged)); - - /// - /// The draw margin property - /// - public static readonly DependencyProperty DrawMarginProperty = - DependencyProperty.Register( - nameof(DrawMargin), typeof(Margin), typeof(PieChart), new PropertyMetadata(null, OnDependencyPropertyChanged)); - - /// - /// The animations speed property - /// - public static readonly DependencyProperty AnimationsSpeedProperty = - DependencyProperty.Register( - nameof(AnimationsSpeed), typeof(TimeSpan), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.AnimationsSpeed, OnDependencyPropertyChanged)); - - /// - /// The easing function property - /// - public static readonly DependencyProperty EasingFunctionProperty = - DependencyProperty.Register( - nameof(EasingFunction), typeof(Func), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.EasingFunction, OnDependencyPropertyChanged)); - - /// - /// The legend position property - /// - public static readonly DependencyProperty LegendPositionProperty = - DependencyProperty.Register( - nameof(LegendPosition), typeof(LegendPosition), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendPosition, OnDependencyPropertyChanged)); - - /// - /// The legend background paint property - /// - public static readonly DependencyProperty LegendBackgroundPaintProperty = - DependencyProperty.Register( - nameof(LegendBackgroundPaint), typeof(IPaint), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendBackgroundPaint, OnDependencyPropertyChanged)); - - /// - /// The legend text paint property - /// - public static readonly DependencyProperty LegendTextPaintProperty = - DependencyProperty.Register( - nameof(LegendTextPaint), typeof(IPaint), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendTextPaint, OnDependencyPropertyChanged)); - - /// - /// The legend text size property - /// - public static readonly DependencyProperty LegendTextSizeProperty = - DependencyProperty.Register( - nameof(LegendTextSize), typeof(double?), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendTextSize, OnDependencyPropertyChanged)); - - /// - /// The tool tip position property - /// - public static readonly DependencyProperty TooltipPositionProperty = - DependencyProperty.Register( - nameof(TooltipPosition), typeof(TooltipPosition), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipPosition, OnDependencyPropertyChanged)); - - /// - /// The tooltip background paint property - /// - public static readonly DependencyProperty TooltipBackgroundPaintProperty = - DependencyProperty.Register( - nameof(TooltipBackgroundPaint), typeof(IPaint), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipBackgroundPaint, OnDependencyPropertyChanged)); - - /// - /// The tooltip text paint property - /// - public static readonly DependencyProperty TooltipTextPaintProperty = - DependencyProperty.Register( - nameof(TooltipTextPaint), typeof(IPaint), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipTextPaint, OnDependencyPropertyChanged)); - - /// - /// The tooltip text size property - /// - public static readonly DependencyProperty TooltipTextSizeProperty = - DependencyProperty.Register( - nameof(TooltipTextSize), typeof(double?), typeof(PieChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipTextSize, OnDependencyPropertyChanged)); - - /// - /// The update started command. - /// - public static readonly DependencyProperty UpdateStartedCommandProperty = - DependencyProperty.Register( - nameof(UpdateStartedCommand), typeof(ICommand), typeof(PieChart), - new PropertyMetadata(null)); - - /// - /// The pointer pressed command. - /// - public static readonly DependencyProperty PointerPressedCommandProperty = - DependencyProperty.Register( - nameof(PointerPressedCommand), typeof(ICommand), typeof(PieChart), - new PropertyMetadata(null)); - - /// - /// The pointer released command. - /// - public static readonly DependencyProperty PointerReleasedCommandProperty = - DependencyProperty.Register( - nameof(PointerReleasedCommand), typeof(ICommand), typeof(PieChart), - new PropertyMetadata(null)); - - /// - /// The pointer move command. - /// - public static readonly DependencyProperty PointerMoveCommandProperty = - DependencyProperty.Register( - nameof(PointerMoveCommand), typeof(ICommand), typeof(PieChart), - new PropertyMetadata(null)); - - /// - /// The data pointer down command property - /// - public static readonly DependencyProperty DataPointerDownCommandProperty = - DependencyProperty.Register( - nameof(DataPointerDownCommand), typeof(ICommand), typeof(PieChart), new PropertyMetadata(null)); - - /// - /// The data pointer down command property - /// - public static readonly DependencyProperty ChartPointPointerDownCommandProperty = - DependencyProperty.Register( - nameof(ChartPointPointerDownCommand), typeof(ICommand), typeof(PieChart), new PropertyMetadata(null)); - - /// - /// The chart point pointer down command property - /// - public static readonly DependencyProperty VisualElementsPointerDownCommandProperty = - DependencyProperty.Register( - nameof(VisualElementsPointerDownCommand), typeof(ICommand), typeof(PieChart), new PropertyMetadata(null)); - - #endregion - - #region events - - /// - public event ChartEventHandler? Measuring; - - /// - public event ChartEventHandler? UpdateStarted; - - /// - public event ChartEventHandler? UpdateFinished; - - /// - public event ChartPointsHandler? DataPointerDown; - - /// - public event ChartPointHandler? ChartPointPointerDown; - - /// - public event VisualElementsHandler? VisualElementsPointerDown; - - #endregion - - #region properties - - /// - bool IChartView.DesignerMode => Windows.ApplicationModel.DesignMode.DesignModeEnabled; - - /// - public IChart CoreChart => _core ?? throw new Exception("Core not set yet."); - - PieChart IPieChartView.Core - => _core == null ? throw new Exception("core not found") : (PieChart)_core; - - LvcColor IChartView.BackColor - { - get => Background is not SolidColorBrush b - ? new LvcColor() - : LvcColor.FromArgb(b.Color.A, b.Color.R, b.Color.G, b.Color.B); - set => SetValue(BackgroundProperty, new SolidColorBrush(Windows.UI.Color.FromArgb(value.A, value.R, value.G, value.B))); - } - - /// - public object SyncContext - { - get => GetValue(SyncContextProperty); - set => SetValue(SyncContextProperty, value); - } - - /// - public VisualElement? Title - { - get => (VisualElement?)GetValue(TitleProperty); - set => SetValue(TitleProperty, value); - } - - /// - public IEnumerable Series - { - get => (IEnumerable)GetValue(SeriesProperty); - set => SetValue(SeriesProperty, value); - } - - /// - public IEnumerable> VisualElements - { - get => (IEnumerable>)GetValue(VisualElementsProperty); - set => SetValue(VisualElementsProperty, value); - } - - /// - public bool IsClockwise - { - get => (bool)GetValue(IsClockwiseProperty); - set => SetValue(IsClockwiseProperty, value); - } - - /// - public double InitialRotation - { - get => (double)GetValue(InitialRotationProperty); - set => SetValue(InitialRotationProperty, value); - } - - /// - public double MaxAngle - { - get => (double)GetValue(MaxAngleProperty); - set => SetValue(MaxAngleProperty, value); - } - - /// - [Obsolete($"Use {nameof(MaxValue)} instead.")] - public double? Total - { - get => (double?)GetValue(MaxValueProperty); - set => SetValue(MaxValueProperty, value); - } - - /// - public double? MaxValue - { - get => (double?)GetValue(MaxValueProperty); - set => SetValue(MaxValueProperty, value); - } - - /// - public double MinValue - { - get => (double)GetValue(MinValueProperty); - set => SetValue(MinValueProperty, value); - } - - /// - public Margin DrawMargin - { - get => (Margin)GetValue(DrawMarginProperty); - set => SetValue(DrawMarginProperty, value); - } - - Margin? IChartView.DrawMargin - { - get => DrawMargin; - set => SetValue(DrawMarginProperty, value); - } - - LvcSize IChartView.ControlSize => _canvas == null - ? throw new Exception("Canvas not found") - : new LvcSize { Width = (float)_canvas.ActualWidth, Height = (float)_canvas.ActualHeight }; - - /// - public MotionCanvas CoreCanvas => _canvas == null ? throw new Exception("Canvas not found") : _canvas.CanvasCore; - - /// - public TimeSpan AnimationsSpeed - { - get => (TimeSpan)GetValue(AnimationsSpeedProperty); - set => SetValue(AnimationsSpeedProperty, value); - } - - TimeSpan IChartView.AnimationsSpeed - { - get => AnimationsSpeed; - set => SetValue(AnimationsSpeedProperty, value); - } - - /// - public Func EasingFunction - { - get => (Func)GetValue(EasingFunctionProperty); - set => SetValue(EasingFunctionProperty, value); - } - - Func? IChartView.EasingFunction - { - get => EasingFunction; - set => SetValue(EasingFunctionProperty, value); - } - - /// - public LegendPosition LegendPosition - { - get => (LegendPosition)GetValue(LegendPositionProperty); - set => SetValue(LegendPositionProperty, value); - } - - /// - public TooltipPosition TooltipPosition - { - get => (TooltipPosition)GetValue(TooltipPositionProperty); - set => SetValue(TooltipPositionProperty, value); - } - - /// - public IPaint? TooltipBackgroundPaint - { - get => (IPaint?)GetValue(TooltipBackgroundPaintProperty); - set => SetValue(TooltipBackgroundPaintProperty, value); - } - - /// - public IPaint? TooltipTextPaint - { - get => (IPaint?)GetValue(TooltipTextPaintProperty); - set => SetValue(TooltipTextPaintProperty, value); - } - - /// - public double? TooltipTextSize - { - get => (double?)GetValue(TooltipTextSizeProperty); - set => SetValue(TooltipTextSizeProperty, value); - } - - /// - public IChartTooltip? Tooltip { get; set; } = new SKDefaultTooltip(); - - /// - public IPaint? LegendBackgroundPaint - { - get => (IPaint?)GetValue(LegendBackgroundPaintProperty); - set => SetValue(LegendBackgroundPaintProperty, value); - } - - /// - public IPaint? LegendTextPaint - { - get => (IPaint?)GetValue(LegendTextPaintProperty); - set => SetValue(LegendTextPaintProperty, value); - } - - /// - public double? LegendTextSize - { - get => (double?)GetValue(LegendTextSizeProperty); - set => SetValue(LegendTextSizeProperty, value); - } - - /// - public IChartLegend? Legend { get; set; } = new SKDefaultLegend(); - - /// - public bool AutoUpdateEnabled { get; set; } = true; - - /// - public TimeSpan UpdaterThrottler { get; set; } = LiveCharts.DefaultSettings.UpdateThrottlingTimeout; - - /// - /// Gets or sets a command to execute when the chart update started. - /// - public ICommand? UpdateStartedCommand - { - get => (ICommand?)GetValue(UpdateStartedCommandProperty); - set => SetValue(UpdateStartedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer is pressed on the chart. - /// - public ICommand? PointerPressedCommand - { - get => (ICommand?)GetValue(PointerPressedCommandProperty); - set => SetValue(PointerPressedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer is released on the chart. - /// - public ICommand? PointerReleasedCommand - { - get => (ICommand?)GetValue(PointerReleasedCommandProperty); - set => SetValue(PointerReleasedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer moves over the chart. - /// - public ICommand? PointerMoveCommand - { - get => (ICommand?)GetValue(PointerMoveCommandProperty); - set => SetValue(PointerMoveCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a data or data points. - /// - public ICommand DataPointerDownCommand - { - get => (ICommand)GetValue(DataPointerDownCommandProperty); - set => SetValue(DataPointerDownCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a chart point. - /// - public ICommand ChartPointPointerDownCommand - { - get => (ICommand)GetValue(ChartPointPointerDownCommandProperty); - set => SetValue(ChartPointPointerDownCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a chart point. - /// - public ICommand? VisualElementsPointerDownCommand - { - get => (ICommand?)GetValue(VisualElementsPointerDownCommandProperty); - set => SetValue(VisualElementsPointerDownCommandProperty, value); - } - - #endregion - - /// - public IEnumerable GetPointsAt(LvcPoint point, TooltipFindingStrategy strategy = TooltipFindingStrategy.Automatic) - { - if (_core is not PieChart cc) throw new Exception("core not found"); - - if (strategy == TooltipFindingStrategy.Automatic) - strategy = cc.Series.GetTooltipFindingStrategy(); - - return cc.Series.SelectMany(series => series.FindHitPoints(cc, point, strategy)); - } - - /// - public IEnumerable> GetVisualsAt(LvcPoint point) - { - return _core is not PieChart cc - ? throw new Exception("core not found") - : cc.VisualElements.SelectMany(visual => ((VisualElement)visual).IsHitBy(_core, point)); - } - - void IChartView.InvokeOnUIThread(Action action) - { - UnoPlatformHelpers.InvokeOnUIThread(action); - } - - private void OnLoaded(object sender, RoutedEventArgs e) - { - var canvas = (MotionCanvas)FindName("motionCanvas"); - _canvas = canvas; - - if (_core is null) - { - _core = new PieChart(this, config => config.UseDefaults(), canvas.CanvasCore); - - if (SyncContext != null) - _canvas.CanvasCore.Sync = SyncContext; - - if (_core == null) throw new Exception("Core not found!"); - _core.Update(); - - _core.Measuring += OnCoreMeasuring; - _core.UpdateStarted += OnCoreUpdateStarted; - _core.UpdateFinished += OnCoreUpdateFinished; - - SizeChanged += OnSizeChanged; - - var chartBehaviour = new Behaviours.ChartBehaviour(); - - chartBehaviour.Pressed += OnPressed; - chartBehaviour.Moved += OnMoved; - chartBehaviour.Released += OnReleased; - chartBehaviour.Pinched += OnPinched; - chartBehaviour.Exited += OnExited; - - chartBehaviour.On(this); - } - - _core.Load(); - _core.Update(); - } - - private void OnSizeChanged(object sender, SizeChangedEventArgs e) - { - if (_core == null) throw new Exception("Core not found!"); - _core.Update(); - } - - private void OnPressed(object? sender, Behaviours.Events.PressedEventArgs args) - { - // is this working on all platforms? - //if (args.KeyModifiers > 0) return; - - var cArgs = new PointerCommandArgs(this, new(args.Location.X, args.Location.Y), args); - if (PointerPressedCommand?.CanExecute(cArgs) == true) PointerPressedCommand.Execute(cArgs); - - _core?.InvokePointerDown(args.Location, args.IsSecondaryPress); - } - - private void OnMoved(object? sender, Behaviours.Events.ScreenEventArgs args) - { - var location = args.Location; - - var cArgs = new PointerCommandArgs(this, new(location.X, location.Y), args.OriginalEvent); - if (PointerMoveCommand?.CanExecute(cArgs) == true) PointerMoveCommand.Execute(cArgs); - - _core?.InvokePointerMove(location); - } - - private void OnReleased(object? sender, Behaviours.Events.PressedEventArgs args) - { - var cArgs = new PointerCommandArgs(this, new(args.Location.X, args.Location.Y), args); - if (PointerReleasedCommand?.CanExecute(cArgs) == true) PointerReleasedCommand.Execute(cArgs); - - _core?.InvokePointerUp(args.Location, args.IsSecondaryPress); - } - - private void OnPinched(object? sender, Behaviours.Events.PinchEventArgs args) - { - if (_core is null) return; - - var c = (CartesianChart)_core; - var p = args.PinchStart; - var s = c.ControlSize; - var pivot = new LvcPoint((float)(p.X * s.Width), (float)(p.Y * s.Height)); - c.Zoom(pivot, ZoomDirection.DefinedByScaleFactor, args.Scale, true); - } - - private void OnExited(object? sender, Behaviours.Events.EventArgs args) - { - _core?.InvokePointerLeft(); - } - - private void OnCoreUpdateFinished(IChartView chart) - { - UpdateFinished?.Invoke(this); - } - - private void OnCoreUpdateStarted(IChartView chart) - { - if (UpdateStartedCommand is not null) - { - var args = new ChartCommandArgs(this); - if (UpdateStartedCommand.CanExecute(args)) UpdateStartedCommand.Execute(args); - } - - UpdateStarted?.Invoke(this); - } - - private void OnCoreMeasuring(IChartView chart) - { - Measuring?.Invoke(this); - } - - private void OnUnloaded(object sender, RoutedEventArgs e) - { - _core?.Unload(); - } - - private static void OnDependencyPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs args) - { - var chart = (PieChart)o; - if (chart._core == null) return; - - chart._core.Update(); - } - - void IChartView.OnDataPointerDown(IEnumerable points, LvcPoint pointer) - { - DataPointerDown?.Invoke(this, points); - if (DataPointerDownCommand is not null && DataPointerDownCommand.CanExecute(points)) DataPointerDownCommand.Execute(points); - - var closest = points.FindClosestTo(pointer); - ChartPointPointerDown?.Invoke(this, closest); - if (ChartPointPointerDownCommand is not null && ChartPointPointerDownCommand.CanExecute(closest)) ChartPointPointerDownCommand.Execute(closest); - } - - void IChartView.OnVisualElementPointerDown( - IEnumerable> visualElements, LvcPoint pointer) - { - var args = new VisualElementsEventArgs(CoreChart, visualElements, pointer); - - VisualElementsPointerDown?.Invoke(this, args); - if (VisualElementsPointerDownCommand is not null && VisualElementsPointerDownCommand.CanExecute(args)) - VisualElementsPointerDownCommand.Execute(args); - } - - void IChartView.Invalidate() - { - CoreCanvas.Invalidate(); - } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PolarChart.xaml b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PolarChart.xaml deleted file mode 100644 index e7453ad95..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PolarChart.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PolarChart.xaml.cs b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PolarChart.xaml.cs deleted file mode 100644 index df50a3621..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/PolarChart.xaml.cs +++ /dev/null @@ -1,845 +0,0 @@ -// The MIT License(MIT) -// -// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Linq; -using System.Windows.Input; -using LiveChartsCore.Drawing; -using LiveChartsCore.Kernel; -using LiveChartsCore.Kernel.Events; -using LiveChartsCore.Kernel.Sketches; -using LiveChartsCore.Measure; -using LiveChartsCore.Motion; -using LiveChartsCore.SkiaSharpView.Drawing; -using LiveChartsCore.SkiaSharpView.SKCharts; -using LiveChartsCore.SkiaSharpView.Uno.Helpers; -using LiveChartsCore.VisualElements; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; - -// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 - -namespace LiveChartsCore.SkiaSharpView.Uno; - -/// -public sealed partial class PolarChart : UserControl, IPolarChartView -{ - #region fields - - private Chart? _core; - private MotionCanvas? _canvas; - private readonly CollectionDeepObserver _seriesObserver; - private readonly CollectionDeepObserver _angleObserver; - private readonly CollectionDeepObserver _radiusObserver; - private readonly CollectionDeepObserver> _visualsObserver; - - #endregion - - /// - /// Initializes a new instance of the class. - /// - public PolarChart() - { - LiveCharts.Configure(config => config.UseDefaults()); - - InitializeComponent(); - - _seriesObserver = new CollectionDeepObserver(OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - _angleObserver = new CollectionDeepObserver(OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - _radiusObserver = new CollectionDeepObserver(OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - _visualsObserver = new CollectionDeepObserver>( - OnDeepCollectionChanged, OnDeepCollectionPropertyChanged, true); - - Loaded += OnLoaded; - Unloaded += OnUnloaded; - - SetValue(AngleAxesProperty, new ObservableCollection() - { - LiveCharts.DefaultSettings.GetProvider().GetDefaultPolarAxis() - }); - SetValue(RadiusAxesProperty, new ObservableCollection() - { - LiveCharts.DefaultSettings.GetProvider().GetDefaultPolarAxis() - }); - SetValue(SeriesProperty, new ObservableCollection()); - SetValue(VisualElementsProperty, new ObservableCollection>()); - SetValue(SyncContextProperty, new object()); - } - - #region dependency properties - - /// - /// The fit to bounds property. - /// - public static readonly DependencyProperty FitToBoundsProperty = - DependencyProperty.Register( - nameof(FitToBounds), typeof(bool), typeof(PolarChart), new PropertyMetadata(false, OnDependencyPropertyChanged)); - - /// - /// The inner radius property. - /// - public static readonly DependencyProperty TotalAngleProperty = - DependencyProperty.Register( - nameof(TotalAngle), typeof(double), typeof(PolarChart), new PropertyMetadata(360d, OnDependencyPropertyChanged)); - - /// - /// The inner radius property. - /// - public static readonly DependencyProperty InnerRadiusProperty = - DependencyProperty.Register( - nameof(InnerRadius), typeof(double), typeof(PolarChart), new PropertyMetadata(0d, OnDependencyPropertyChanged)); - - /// - /// The initial rotation property. - /// - public static readonly DependencyProperty InitialRotationProperty = - DependencyProperty.Register( - nameof(InitialRotation), typeof(double), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.PolarInitialRotation, OnDependencyPropertyChanged)); - - /// - /// The title property - /// - public static readonly DependencyProperty TitleProperty = - DependencyProperty.Register( - nameof(Title), typeof(VisualElement), typeof(PolarChart), new PropertyMetadata(null)); - - /// - /// The series property. - /// - public static readonly DependencyProperty SeriesProperty = - DependencyProperty.Register( - nameof(Series), typeof(IEnumerable), typeof(PolarChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (PolarChart)o; - var seriesObserver = chart._seriesObserver; - seriesObserver?.Dispose((IEnumerable)args.OldValue); - seriesObserver?.Initialize((IEnumerable)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The x axes property. - /// - public static readonly DependencyProperty AngleAxesProperty = - DependencyProperty.Register( - nameof(AngleAxes), typeof(IEnumerable), typeof(PolarChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (PolarChart)o; - var observer = chart._angleObserver; - observer?.Dispose((IEnumerable)args.OldValue); - observer?.Initialize((IEnumerable)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The y axes property. - /// - public static readonly DependencyProperty RadiusAxesProperty = - DependencyProperty.Register( - nameof(RadiusAxes), typeof(IEnumerable), typeof(PolarChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (PolarChart)o; - var observer = chart._radiusObserver; - observer?.Dispose((IEnumerable)args.OldValue); - observer?.Initialize((IEnumerable)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The visual elements property - /// - public static readonly DependencyProperty VisualElementsProperty = - DependencyProperty.Register( - nameof(VisualElements), typeof(IEnumerable>), typeof(PolarChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (PolarChart)o; - var observer = chart._visualsObserver; - observer?.Dispose((IEnumerable>)args.OldValue); - observer?.Initialize((IEnumerable>)args.NewValue); - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The sync context property. - /// - public static readonly DependencyProperty SyncContextProperty = - DependencyProperty.Register( - nameof(SyncContext), typeof(object), typeof(PolarChart), new PropertyMetadata(null, - (DependencyObject o, DependencyPropertyChangedEventArgs args) => - { - var chart = (PolarChart)o; - if (chart._canvas != null) chart.CoreCanvas.Sync = args.NewValue; - if (chart._core == null) return; - chart._core.Update(); - })); - - /// - /// The tool tip finding strategy property. - /// - public static readonly DependencyProperty TooltipFindingStrategyProperty = - DependencyProperty.Register( - nameof(TooltipFindingStrategy), typeof(TooltipFindingStrategy), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipFindingStrategy, OnDependencyPropertyChanged)); - - /// - /// The animations speed property. - /// - public static readonly DependencyProperty AnimationsSpeedProperty = - DependencyProperty.Register( - nameof(AnimationsSpeed), typeof(TimeSpan), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.AnimationsSpeed, OnDependencyPropertyChanged)); - - /// - /// The easing function property. - /// - public static readonly DependencyProperty EasingFunctionProperty = - DependencyProperty.Register( - nameof(EasingFunction), typeof(Func), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.EasingFunction, OnDependencyPropertyChanged)); - - /// - /// The legend position property. - /// - public static readonly DependencyProperty LegendPositionProperty = - DependencyProperty.Register( - nameof(LegendPosition), typeof(LegendPosition), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendPosition, OnDependencyPropertyChanged)); - - /// - /// The legend background paint property - /// - public static readonly DependencyProperty LegendBackgroundPaintProperty = - DependencyProperty.Register( - nameof(LegendBackgroundPaint), typeof(IPaint), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendBackgroundPaint, OnDependencyPropertyChanged)); - - /// - /// The legend text paint property - /// - public static readonly DependencyProperty LegendTextPaintProperty = - DependencyProperty.Register( - nameof(LegendTextPaint), typeof(IPaint), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendTextPaint, OnDependencyPropertyChanged)); - - /// - /// The legend text size property - /// - public static readonly DependencyProperty LegendTextSizeProperty = - DependencyProperty.Register( - nameof(LegendTextSize), typeof(double?), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.LegendTextSize, OnDependencyPropertyChanged)); - - /// - /// The tool tip position property. - /// - public static readonly DependencyProperty TooltipPositionProperty = - DependencyProperty.Register( - nameof(TooltipPosition), typeof(TooltipPosition), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipPosition, OnDependencyPropertyChanged)); - - /// - /// The tooltip background paint property - /// - public static readonly DependencyProperty TooltipBackgroundPaintProperty = - DependencyProperty.Register( - nameof(TooltipBackgroundPaint), typeof(IPaint), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipBackgroundPaint, OnDependencyPropertyChanged)); - - /// - /// The tooltip text paint property - /// - public static readonly DependencyProperty TooltipTextPaintProperty = - DependencyProperty.Register( - nameof(TooltipTextPaint), typeof(IPaint), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipTextPaint, OnDependencyPropertyChanged)); - - /// - /// The tooltip text size property - /// - public static readonly DependencyProperty TooltipTextSizeProperty = - DependencyProperty.Register( - nameof(TooltipTextSize), typeof(double?), typeof(PolarChart), - new PropertyMetadata(LiveCharts.DefaultSettings.TooltipTextSize, OnDependencyPropertyChanged)); - - /// - /// The update started command. - /// - public static readonly DependencyProperty UpdateStartedCommandProperty = - DependencyProperty.Register( - nameof(UpdateStartedCommand), typeof(ICommand), typeof(PolarChart), - new PropertyMetadata(null)); - - /// - /// The pointer pressed command. - /// - public static readonly DependencyProperty PointerPressedCommandProperty = - DependencyProperty.Register( - nameof(PointerPressedCommand), typeof(ICommand), typeof(PolarChart), - new PropertyMetadata(null)); - - /// - /// The pointer released command. - /// - public static readonly DependencyProperty PointerReleasedCommandProperty = - DependencyProperty.Register( - nameof(PointerReleasedCommand), typeof(ICommand), typeof(PolarChart), - new PropertyMetadata(null)); - - /// - /// The pointer move command. - /// - public static readonly DependencyProperty PointerMoveCommandProperty = - DependencyProperty.Register( - nameof(PointerMoveCommand), typeof(ICommand), typeof(PolarChart), - new PropertyMetadata(null)); - - /// - /// The data pointer down command property - /// - public static readonly DependencyProperty DataPointerDownCommandProperty = - DependencyProperty.Register( - nameof(DataPointerDownCommand), typeof(ICommand), typeof(PolarChart), new PropertyMetadata(null)); - - /// - /// The chart point pointer down command property - /// - public static readonly DependencyProperty ChartPointPointerDownCommandProperty = - DependencyProperty.Register( - nameof(ChartPointPointerDownCommand), typeof(ICommand), typeof(PolarChart), new PropertyMetadata(null)); - - /// - /// The chart point pointer down command property - /// - public static readonly DependencyProperty VisualElementsPointerDownCommandProperty = - DependencyProperty.Register( - nameof(VisualElementsPointerDownCommand), typeof(ICommand), typeof(PolarChart), new PropertyMetadata(null)); - - #endregion - - #region events - - /// - public event ChartEventHandler? Measuring; - - /// - public event ChartEventHandler? UpdateStarted; - - /// - public event ChartEventHandler? UpdateFinished; - - /// - public event ChartPointsHandler? DataPointerDown; - - /// - public event ChartPointHandler? ChartPointPointerDown; - - /// - public event VisualElementsHandler? VisualElementsPointerDown; - - #endregion - - #region properties - - /// - bool IChartView.DesignerMode => Windows.ApplicationModel.DesignMode.DesignModeEnabled; - - /// - public IChart CoreChart => _core ?? throw new Exception("Core not set yet."); - - /// - public object SyncContext - { - get => GetValue(SyncContextProperty); - set => SetValue(SyncContextProperty, value); - } - - LvcColor IChartView.BackColor - { - get => Background is not SolidColorBrush b - ? new LvcColor() - : LvcColor.FromArgb(b.Color.A, b.Color.R, b.Color.G, b.Color.B); - set => SetValue(BackgroundProperty, new SolidColorBrush(Windows.UI.Color.FromArgb(value.A, value.R, value.G, value.B))); - } - - /// - public Margin? DrawMargin - { - get => null; - set => throw new NotImplementedException(); - } - - Margin? IChartView.DrawMargin - { - get => DrawMargin; - set => throw new NotImplementedException(); - } - - LvcSize IChartView.ControlSize => _canvas == null - ? throw new Exception("Canvas not found") - : new LvcSize { Width = (float)_canvas.ActualWidth, Height = (float)_canvas.ActualHeight }; - - /// - public MotionCanvas CoreCanvas => _canvas == null ? throw new Exception("Canvas not found") : _canvas.CanvasCore; - - PolarChart IPolarChartView.Core => - _core == null ? throw new Exception("core not found") : (PolarChart)_core; - - /// - public bool FitToBounds - { - get => (bool)GetValue(FitToBoundsProperty); - set => SetValue(FitToBoundsProperty, value); - } - - /// - public double TotalAngle - { - get => (double)GetValue(TotalAngleProperty); - set => SetValue(TotalAngleProperty, value); - } - - /// - public double InnerRadius - { - get => (double)GetValue(InnerRadiusProperty); - set => SetValue(InnerRadiusProperty, value); - } - - /// - public double InitialRotation - { - get => (double)GetValue(InitialRotationProperty); - set => SetValue(InitialRotationProperty, value); - } - - /// - public VisualElement? Title - { - get => (VisualElement?)GetValue(TitleProperty); - set => SetValue(TitleProperty, value); - } - - /// - public IEnumerable Series - { - get => (IEnumerable)GetValue(SeriesProperty); - set => SetValue(SeriesProperty, value); - } - - /// - public IEnumerable AngleAxes - { - get => (IEnumerable)GetValue(AngleAxesProperty); - set => SetValue(AngleAxesProperty, value); - } - - /// - public IEnumerable RadiusAxes - { - get => (IEnumerable)GetValue(RadiusAxesProperty); - set => SetValue(RadiusAxesProperty, value); - } - - /// - public IEnumerable> VisualElements - { - get => (IEnumerable>)GetValue(VisualElementsProperty); - set => SetValue(VisualElementsProperty, value); - } - - /// - public TimeSpan AnimationsSpeed - { - get => (TimeSpan)GetValue(AnimationsSpeedProperty); - set => SetValue(AnimationsSpeedProperty, value); - } - - TimeSpan IChartView.AnimationsSpeed - { - get => AnimationsSpeed; - set => SetValue(AnimationsSpeedProperty, value); - } - - /// - public Func EasingFunction - { - get => (Func)GetValue(EasingFunctionProperty); - set => SetValue(EasingFunctionProperty, value); - } - - Func? IChartView.EasingFunction - { - get => EasingFunction; - set => SetValue(EasingFunctionProperty, value); - } - - /// - public LegendPosition LegendPosition - { - get => (LegendPosition)GetValue(LegendPositionProperty); - set => SetValue(LegendPositionProperty, value); - } - - /// - public TooltipPosition TooltipPosition - { - get => (TooltipPosition)GetValue(TooltipPositionProperty); - set => SetValue(TooltipPositionProperty, value); - } - - /// - public IPaint? TooltipBackgroundPaint - { - get => (IPaint?)GetValue(TooltipBackgroundPaintProperty); - set => SetValue(TooltipBackgroundPaintProperty, value); - } - - /// - public IPaint? TooltipTextPaint - { - get => (IPaint?)GetValue(TooltipTextPaintProperty); - set => SetValue(TooltipTextPaintProperty, value); - } - - /// - public double? TooltipTextSize - { - get => (double?)GetValue(TooltipTextSizeProperty); - set => SetValue(TooltipTextSizeProperty, value); - } - - /// - public IChartTooltip? Tooltip { get; set; } = new SKDefaultTooltip(); - - /// - public IPaint? LegendBackgroundPaint - { - get => (IPaint?)GetValue(LegendBackgroundPaintProperty); - set => SetValue(LegendBackgroundPaintProperty, value); - } - - /// - public IPaint? LegendTextPaint - { - get => (IPaint?)GetValue(LegendTextPaintProperty); - set => SetValue(LegendTextPaintProperty, value); - } - - /// - public double? LegendTextSize - { - get => (double?)GetValue(LegendTextSizeProperty); - set => SetValue(LegendTextSizeProperty, value); - } - - /// - public IChartLegend? Legend { get; set; } = new SKDefaultLegend(); - - /// - public bool AutoUpdateEnabled { get; set; } = true; - - /// - public TimeSpan UpdaterThrottler { get; set; } = LiveCharts.DefaultSettings.UpdateThrottlingTimeout; - - /// - /// Gets or sets a command to execute when the chart update started. - /// - public ICommand? UpdateStartedCommand - { - get => (ICommand?)GetValue(UpdateStartedCommandProperty); - set => SetValue(UpdateStartedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer is pressed on the chart. - /// - public ICommand? PointerPressedCommand - { - get => (ICommand?)GetValue(PointerPressedCommandProperty); - set => SetValue(PointerPressedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer is released on the chart. - /// - public ICommand? PointerReleasedCommand - { - get => (ICommand?)GetValue(PointerReleasedCommandProperty); - set => SetValue(PointerReleasedCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer moves over the chart. - /// - public ICommand? PointerMoveCommand - { - get => (ICommand?)GetValue(PointerMoveCommandProperty); - set => SetValue(PointerMoveCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a data or data points. - /// - public ICommand DataPointerDownCommand - { - get => (ICommand)GetValue(DataPointerDownCommandProperty); - set => SetValue(DataPointerDownCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a data or data points. - /// - public ICommand ChartPointPointerDownCommand - { - get => (ICommand)GetValue(ChartPointPointerDownCommandProperty); - set => SetValue(ChartPointPointerDownCommandProperty, value); - } - - /// - /// Gets or sets a command to execute when the pointer goes down on a chart point. - /// - public ICommand? VisualElementsPointerDownCommand - { - get => (ICommand?)GetValue(VisualElementsPointerDownCommandProperty); - set => SetValue(VisualElementsPointerDownCommandProperty, value); - } - - #endregion - - /// - public LvcPointD ScalePixelsToData(LvcPointD point, int angleAxisIndex = 0, int radiusAxisIndex = 0) - { - if (_core is not PolarChart cc) throw new Exception("core not found"); - - var scaler = new PolarScaler( - cc.DrawMarginLocation, cc.DrawMarginSize, cc.AngleAxes[angleAxisIndex], cc.RadiusAxes[radiusAxisIndex], - cc.InnerRadius, cc.InitialRotation, cc.TotalAnge); - - return scaler.ToChartValues(point.X, point.Y); - } - - /// - public LvcPointD ScaleDataToPixels(LvcPointD point, int angleAxisIndex = 0, int radiusAxisIndex = 0) - { - if (_core is not PolarChart cc) throw new Exception("core not found"); - - var scaler = new PolarScaler( - cc.DrawMarginLocation, cc.DrawMarginSize, cc.AngleAxes[angleAxisIndex], cc.RadiusAxes[radiusAxisIndex], - cc.InnerRadius, cc.InitialRotation, cc.TotalAnge); - - var r = scaler.ToPixels(point.X, point.Y); - - return new LvcPointD { X = (float)r.X, Y = (float)r.Y }; - } - - /// - public IEnumerable GetPointsAt(LvcPoint point, TooltipFindingStrategy strategy = TooltipFindingStrategy.Automatic) - { - if (_core is not PolarChart cc) throw new Exception("core not found"); - - if (strategy == TooltipFindingStrategy.Automatic) - strategy = cc.Series.GetTooltipFindingStrategy(); - - return cc.Series.SelectMany(series => series.FindHitPoints(cc, point, strategy)); - } - - /// - public IEnumerable> GetVisualsAt(LvcPoint point) - { - return _core is not PolarChart cc - ? throw new Exception("core not found") - : cc.VisualElements.SelectMany(visual => ((VisualElement)visual).IsHitBy(_core, point)); - } - - void IChartView.InvokeOnUIThread(Action action) - { - UnoPlatformHelpers.InvokeOnUIThread(action); - } - - private void OnLoaded(object sender, RoutedEventArgs e) - { - var canvas = (MotionCanvas)FindName("motionCanvas"); - _canvas = canvas; - - if (_core is null) - { - _core = new PolarChart(this, config => config.UseDefaults(), canvas.CanvasCore); - - if (SyncContext != null) - _canvas.CanvasCore.Sync = SyncContext; - - if (_core == null) throw new Exception("Core not found!"); - _core.Measuring += OnCoreMeasuring; - _core.UpdateStarted += OnCoreUpdateStarted; - _core.UpdateFinished += OnCoreUpdateFinished; - - SizeChanged += OnSizeChanged; - - var chartBehaviour = new Behaviours.ChartBehaviour(); - - chartBehaviour.Pressed += OnPressed; - chartBehaviour.Moved += OnMoved; - chartBehaviour.Released += OnReleased; - chartBehaviour.Pinched += OnPinched; - chartBehaviour.Exited += OnExited; - - chartBehaviour.On(this); - } - - _core.Load(); - _core.Update(); - } - - private void OnDeepCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) - { - _core?.Update(); - } - - private void OnDeepCollectionPropertyChanged(object? sender, PropertyChangedEventArgs e) - { - _core?.Update(); - } - - private void OnSizeChanged(object? sender, SizeChangedEventArgs e) - { - if (_core == null) throw new Exception("Core not found!"); - _core.Update(); - } - - private void OnPressed(object? sender, Behaviours.Events.PressedEventArgs args) - { - // is this working on all platforms? - //if (args.KeyModifiers > 0) return; - - var cArgs = new PointerCommandArgs(this, new(args.Location.X, args.Location.Y), args); - if (PointerPressedCommand?.CanExecute(cArgs) == true) PointerPressedCommand.Execute(cArgs); - - _core?.InvokePointerDown(args.Location, args.IsSecondaryPress); - } - - private void OnMoved(object? sender, Behaviours.Events.ScreenEventArgs args) - { - var location = args.Location; - - var cArgs = new PointerCommandArgs(this, new(location.X, location.Y), args.OriginalEvent); - if (PointerMoveCommand?.CanExecute(cArgs) == true) PointerMoveCommand.Execute(cArgs); - - _core?.InvokePointerMove(location); - } - - private void OnReleased(object? sender, Behaviours.Events.PressedEventArgs args) - { - var cArgs = new PointerCommandArgs(this, new(args.Location.X, args.Location.Y), args); - if (PointerReleasedCommand?.CanExecute(cArgs) == true) PointerReleasedCommand.Execute(cArgs); - - _core?.InvokePointerUp(args.Location, args.IsSecondaryPress); - } - - private void OnPinched(object? sender, Behaviours.Events.PinchEventArgs args) - { - if (_core is null) return; - - var c = (CartesianChart)_core; - var p = args.PinchStart; - var s = c.ControlSize; - var pivot = new LvcPoint((float)(p.X * s.Width), (float)(p.Y * s.Height)); - c.Zoom(pivot, ZoomDirection.DefinedByScaleFactor, args.Scale, true); - } - - private void OnExited(object? sender, Behaviours.Events.EventArgs args) - { - _core?.InvokePointerLeft(); - } - - private void OnCoreUpdateFinished(IChartView chart) - { - UpdateFinished?.Invoke(this); - } - - private void OnCoreUpdateStarted(IChartView chart) - { - if (UpdateStartedCommand is not null) - { - var args = new ChartCommandArgs(this); - if (UpdateStartedCommand.CanExecute(args)) UpdateStartedCommand.Execute(args); - } - - UpdateStarted?.Invoke(this); - } - - private void OnCoreMeasuring(IChartView chart) - { - Measuring?.Invoke(this); - } - - private void OnUnloaded(object sender, RoutedEventArgs e) - { - _core?.Unload(); - } - - private static void OnDependencyPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs args) - { - var chart = (PolarChart)o; - if (chart._core == null) return; - - chart._core.Update(); - } - - void IChartView.OnDataPointerDown(IEnumerable points, LvcPoint pointer) - { - DataPointerDown?.Invoke(this, points); - if (DataPointerDownCommand is not null && DataPointerDownCommand.CanExecute(points)) DataPointerDownCommand.Execute(points); - - var closest = points.FindClosestTo(pointer); - ChartPointPointerDown?.Invoke(this, closest); - if (ChartPointPointerDownCommand is not null && ChartPointPointerDownCommand.CanExecute(closest)) ChartPointPointerDownCommand.Execute(closest); - } - - void IChartView.OnVisualElementPointerDown( - IEnumerable> visualElements, LvcPoint pointer) - { - var args = new VisualElementsEventArgs(CoreChart, visualElements, pointer); - - VisualElementsPointerDown?.Invoke(this, args); - if (VisualElementsPointerDownCommand is not null && VisualElementsPointerDownCommand.CanExecute(args)) - VisualElementsPointerDownCommand.Execute(args); - } - - void IChartView.Invalidate() - { - CoreCanvas.Invalidate(); - } -} diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Properties/LiveChartsCore.SkiaSharpView.UWP.rd.xml b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Properties/LiveChartsCore.SkiaSharpView.UWP.rd.xml deleted file mode 100644 index 6f2d3278d..000000000 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/Properties/LiveChartsCore.SkiaSharpView.UWP.rd.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/images/icon.png b/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/images/icon.png deleted file mode 100644 index d0c1c5660..000000000 Binary files a/src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/images/icon.png and /dev/null differ diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj b/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj index 3500ed13d..06d221f65 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj @@ -1,15 +1,26 @@ - 11.0 + 12.0 enable - net6.0-windows10.0.19041;net7.0-windows10.0.19041 + + net6.0-windows10.0.19041.0; + net8.0-windows10.0.19041.0 + + 10.0.17763.0 - LiveChartsCore.SkiaSharpView.WinUI - win10-x86;win10-x64;win10-arm64 - true - 2.0.0-rc2 + + win-x86;win-x64;win-arm64 + win10-x86;win10-x64;win10-arm64 + + true + + LiveChartsCore.SkiaSharpView.WinUI + 2.0.0-rc3 icon.png Simple, flexible, interactive and powerful data visualization for WindowsAppSDK. MIT @@ -25,6 +36,11 @@ + + + $(NoWarn);NETSDK1206 + + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml True @@ -33,7 +49,7 @@ - + diff --git a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.nuspec b/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.nuspec index 8dc1ad510..b91dddaf2 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.nuspec +++ b/src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.nuspec @@ -2,7 +2,7 @@ LiveChartsCore.SkiaSharpView.WinUI - 2.0.0-rc2 + 2.0.0-rc3.1 LiveChartsCore.SkiaSharpView.WinUI BetoRodriguez true @@ -17,14 +17,16 @@ - - - + + + + - - - + + + + diff --git a/tests/LiveChartsCore.UnitTesting/ChartTests/ChartTests.cs b/tests/LiveChartsCore.UnitTesting/ChartTests/ChartTests.cs new file mode 100644 index 000000000..d7e7795a6 --- /dev/null +++ b/tests/LiveChartsCore.UnitTesting/ChartTests/ChartTests.cs @@ -0,0 +1,112 @@ +// The MIT License(MIT) +// +// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using LiveChartsCore.SkiaSharpView.SKCharts; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace LiveChartsCore.UnitTesting.ChartTests; + +[TestClass] +public class ChartTests +{ + // based on https://github.com/beto-rodriguez/LiveCharts2/issues/1422 + + // in theory LiveCharts properties should never be null, but we can't control the user input + // specially on this case where DataContext could be null + + [TestMethod] + public void CartesianShouldHandleNullParams() + { + // we are testing the properties defined on LiveChartsCore/Kernel/Sketches/ICartesianChartView.cs + + var chart = new SKCartesianChart + { + Width = 1000, + Height = 1000, + XAxes = null, + YAxes = null, + Sections = null, + Series = null, + DrawMarginFrame = null, + VisualElements = null + }; + + var image = chart.GetImage(); + + Assert.IsTrue(image is not null); + } + + [TestMethod] + public void PieShouldHandleNullParams() + { + // we are testing the properties defined on LiveChartsCore/Kernel/Sketches/IPieChartView.cs + + var chart = new SKPieChart + { + Width = 1000, + Height = 1000, + Series = null, + VisualElements = null + }; + + var image = chart.GetImage(); + + Assert.IsTrue(image is not null); + } + + [TestMethod] + public void PolarShouldHandleNullParams() + { + // we are testing the properties defined on LiveChartsCore/Kernel/Sketches/IPolarChartView.cs + + var chart = new SKPolarChart + { + Width = 1000, + Height = 1000, + Series = null, + AngleAxes = null, + RadiusAxes = null, + VisualElements = null + }; + + var image = chart.GetImage(); + + Assert.IsTrue(image is not null); + } + + [TestMethod] + public void MapShouldHandleNullParams() + { + // we are testing the properties defined on LiveChartsCore/Kernel/Sketches/IGeoMapView.cs + + var chart = new SKGeoMap + { + Width = 1000, + Height = 1000, + Series = null, + }; + + var image = chart.GetImage(); + + Assert.IsTrue(image is not null); + } +} diff --git a/tests/LiveChartsCore.UnitTesting/LiveChartsCore.UnitTesting.csproj b/tests/LiveChartsCore.UnitTesting/LiveChartsCore.UnitTesting.csproj index f1e37abae..7254c728c 100644 --- a/tests/LiveChartsCore.UnitTesting/LiveChartsCore.UnitTesting.csproj +++ b/tests/LiveChartsCore.UnitTesting/LiveChartsCore.UnitTesting.csproj @@ -1,8 +1,8 @@ - 11.0 - net462;net6.0;net7.0 + 12.0 + net462;net6.0;net7.0;net8.0 false diff --git a/tests/LiveChartsCore.UnitTesting/OtherTests/DataProviderTest.cs b/tests/LiveChartsCore.UnitTesting/OtherTests/DataProviderTest.cs index 03651e4a2..bd31d06ba 100644 --- a/tests/LiveChartsCore.UnitTesting/OtherTests/DataProviderTest.cs +++ b/tests/LiveChartsCore.UnitTesting/OtherTests/DataProviderTest.cs @@ -307,13 +307,8 @@ public void FetchNull() Assert.IsTrue(emptyCount == 2); } - public class City + public class City(double? population) { - public City(double? population) - { - Population = population; - } - - public double? Population { get; set; } + public double? Population { get; set; } = population; } }