Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,36 @@ jobs:
with:
fetch-depth: 0

# Pinned to match pull-request.yml. The workload set decides $(MauiVersion), which
# becomes the Microsoft.Maui.Controls floor of the published Microcharts.Maui package.
- name: Install .NET SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
10.0.x
10.0.401

- name: "Install .NET workloads"
run: |
dotnet workload install android
dotnet workload install ios
dotnet workload install maccatalyst
dotnet workload install maui
dotnet workload install android ios maccatalyst maui --version 10.0.401
dotnet workload list

- name: "Restore and build solution"
run: dotnet build Sources/Microcharts.slnx --configuration Release -p:VersionPrelease=.${{ github.run_number }}
run: dotnet build Sources/Microcharts.slnx --configuration Release -p:VersionPrelease=-preview.${{ github.run_number }}

- name: "Pack Microcharts Core"
run: dotnet pack Sources/Microcharts/Microcharts.csproj --configuration Release --no-build -p:VersionPrelease=.${{ github.run_number }}
run: dotnet pack Sources/Microcharts/Microcharts.csproj --configuration Release --no-build -p:VersionPrelease=-preview.${{ github.run_number }}

- name: "Pack Microcharts Droid"
run: dotnet pack Sources/Microcharts.Droid/Microcharts.Droid.csproj --configuration Release --no-build -p:VersionPrelease=.${{ github.run_number }}
run: dotnet pack Sources/Microcharts.Droid/Microcharts.Droid.csproj --configuration Release --no-build -p:VersionPrelease=-preview.${{ github.run_number }}

- name: "Pack Microcharts iOS"
run: dotnet pack Sources/Microcharts.iOS/Microcharts.iOS.csproj --configuration Release --no-build -p:VersionPrelease=.${{ github.run_number }}
run: dotnet pack Sources/Microcharts.iOS/Microcharts.iOS.csproj --configuration Release --no-build -p:VersionPrelease=-preview.${{ github.run_number }}

- name: "Pack Microcharts MAUI"
run: dotnet pack Sources/Microcharts.Maui/Microcharts.Maui.csproj --configuration Release --no-build -p:VersionPrelease=.${{ github.run_number }}
run: dotnet pack Sources/Microcharts.Maui/Microcharts.Maui.csproj --configuration Release --no-build -p:VersionPrelease=-preview.${{ github.run_number }}

- name: "Pack Microcharts Meta-package"
run: dotnet pack Sources/Microcharts.Metapackage/Microcharts.Metapackage.csproj --configuration Release -p:VersionPrelease=.${{ github.run_number }}
run: dotnet pack Sources/Microcharts.Metapackage/Microcharts.Metapackage.csproj --configuration Release -p:VersionPrelease=-preview.${{ github.run_number }}

# Always publish the build to GitHub Packages (prerelease/CI feed).
- name: Publish packages to GitHub Packages
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,26 @@ jobs:
with:
fetch-depth: 0

# The SDK, workload set and Xcode are pinned as a set (iOS 26.5 + MAUI 10.0.20 on
# Xcode 26.6). Newer workload sets ship the iOS 27 workload, which needs Xcode 27
# (not on macos-26), and raise $(MauiVersion), the Microsoft.Maui.Controls floor
# of the published Microcharts.Maui package. Keep publish.yml in sync.
- name: Install .NET SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
10.0.x
10.0.401

- name: "Install .NET workloads"
run: |
dotnet workload install android
dotnet workload install ios
dotnet workload install maccatalyst
dotnet workload install maui
dotnet workload install android ios maccatalyst maui --version 10.0.401
dotnet workload list

- name: Select Xcode
if: matrix.os == 'macos-26'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '26.6'

- name: "Build solution"
run: dotnet build Sources/Microcharts.slnx --configuration Release
Expand Down
6 changes: 4 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ There are no test projects in this repository.

## Architecture

Microcharts is a cross-platform charting library built on **SkiaSharp 3.x** targeting **.NET 10**. All chart rendering is platform-agnostic SkiaSharp drawing; platform projects provide thin `ChartView` wrappers.
Microcharts is a cross-platform charting library built on **SkiaSharp 4.x** targeting **.NET 10**. All chart rendering is platform-agnostic SkiaSharp drawing; platform projects provide thin `ChartView` wrappers.

### Project Dependency Graph

Expand Down Expand Up @@ -74,5 +74,7 @@ Version is managed centrally in `Sources/Directory.Build.props` (`VersionMain` p

## CI/CD

- **pull-request.yml** - Runs on pull requests (and manual dispatch); builds on `windows-latest` and `macos-26` (with Xcode `latest-stable` via `maxim-lobanov/setup-xcode@v1`)
- **pull-request.yml** - Runs on pull requests (and manual dispatch); builds on `windows-latest` and `macos-26` (with Xcode `26.6` via `maxim-lobanov/setup-xcode@v1`)
- **publish.yml** - Manual trigger (`workflow_dispatch`); always publishes packages to GitHub Packages (`microcharts-dotnet` org), and additionally to nuget.org when the `publish_to_nuget` input is set (OIDC trusted publishing)

Both workflows pin .NET SDK `10.0.401` and workload set `10.0.401` (iOS 26.5, MAUI 10.0.20). Newer workload sets bring the iOS 27 workload, which needs Xcode 27, and raise `$(MauiVersion)` — the `Microsoft.Maui.Controls` floor of the published `Microcharts.Maui` package. Bump the SDK, workload set and Xcode together.
9 changes: 7 additions & 2 deletions Sources/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@

<PropertyGroup>
<!-- Change these two values to control the version -->
<VersionMain>2.0.0</VersionMain>
<VersionPrelease></VersionPrelease>
<VersionMain>3.0.0</VersionMain>
<VersionPrelease>-preview</VersionPrelease>
</PropertyGroup>

<PropertyGroup>
<!-- Single source of truth for the SkiaSharp package family version -->
<SkiaSharpVersion>4.153.1</SkiaSharpVersion>
Comment thread
follesoe marked this conversation as resolved.
Resolved
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Microcharts.Droid/Microcharts.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageTags>maui anroid chart skia</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp.Views" Version="3.119.4" />
<PackageReference Include="SkiaSharp.Views" Version="$(SkiaSharpVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microcharts/Microcharts.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Sources/Microcharts.Maui/Microcharts.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/microcharts-dotnet/Microcharts.git</PackageProjectUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="3.119.4" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="$(SkiaSharpVersion)" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<NuspecFile>Microcharts.Metapackage.nuspec</NuspecFile>
<!-- Feed $version$ in the nuspec (package version + Microcharts.* deps) from the
computed PackageVersion so the meta-package tracks the platform packages,
both for CI builds (2.0.0.<run>) and clean releases (2.0.0). -->
<NuspecProperties>version=$(PackageVersion)</NuspecProperties>
both for CI builds (3.0.0-preview.<run>) and clean releases (3.0.0).
$skiasharpversion$ keeps the SkiaSharp deps in lockstep with the projects. -->
<NuspecProperties>version=$(PackageVersion);skiasharpversion=$(SkiaSharpVersion)</NuspecProperties>
</PropertyGroup>
</Project>
24 changes: 12 additions & 12 deletions Sources/Microcharts.Metapackage/Microcharts.Metapackage.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@
<dependencies>
<group targetFramework="net10.0">
<dependency id="Microcharts.Core" version="$version$" />
<dependency id="SkiaSharp" version="3.119.4" />
<dependency id="SkiaSharp" version="$skiasharpversion$" />
</group>
<group targetFramework="net10.0-android36.0">
<dependency id="Microcharts.Core" version="$version$" />
<dependency id="Microcharts.Maui" version="$version$" />
<dependency id="SkiaSharp" version="3.119.4" />
<dependency id="SkiaSharp.Views" version="3.119.4" />
<dependency id="SkiaSharp.Views.Maui.Controls" version="3.119.4" />
<dependency id="SkiaSharp" version="$skiasharpversion$" />
<dependency id="SkiaSharp.Views" version="$skiasharpversion$" />
<dependency id="SkiaSharp.Views.Maui.Controls" version="$skiasharpversion$" />
</group>
<group targetFramework="net10.0-ios19.0">
<dependency id="Microcharts.Core" version="$version$" />
<dependency id="Microcharts.Maui" version="$version$" />
<dependency id="SkiaSharp" version="3.119.4" />
<dependency id="SkiaSharp.Views" version="3.119.4" />
<dependency id="SkiaSharp.Views.Maui.Controls" version="3.119.4" />
<dependency id="SkiaSharp" version="$skiasharpversion$" />
<dependency id="SkiaSharp.Views" version="$skiasharpversion$" />
<dependency id="SkiaSharp.Views.Maui.Controls" version="$skiasharpversion$" />
</group>
<group targetFramework="net10.0-maccatalyst19.0">
<dependency id="Microcharts.Core" version="$version$" />
<dependency id="Microcharts.Maui" version="$version$" />
<dependency id="SkiaSharp" version="3.119.4" />
<dependency id="SkiaSharp.Views" version="3.119.4" />
<dependency id="SkiaSharp.Views.Maui.Controls" version="3.119.4" />
<dependency id="SkiaSharp" version="$skiasharpversion$" />
<dependency id="SkiaSharp.Views" version="$skiasharpversion$" />
<dependency id="SkiaSharp.Views.Maui.Controls" version="$skiasharpversion$" />
</group>
<group targetFramework="net10.0-windows10.0.19041.0">
<dependency id="Microcharts.Core" version="$version$" />
<dependency id="Microcharts.Maui" version="$version$" />
<dependency id="SkiaSharp" version="3.119.4" />
<dependency id="SkiaSharp.Views.Maui.Controls" version="3.119.4" />
<dependency id="SkiaSharp" version="$skiasharpversion$" />
<dependency id="SkiaSharp.Views.Maui.Controls" version="$skiasharpversion$" />
</group>
</dependencies>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<TrimMode>full</TrimMode>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp.Views" Version="3.119.4" />
<PackageReference Include="SkiaSharp.Views" Version="$(SkiaSharpVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microcharts.Droid/Microcharts.Droid.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="3.119.4" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="$(SkiaSharpVersion)" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp.Views" Version="3.119.4" />
<PackageReference Include="SkiaSharp.Views" Version="$(SkiaSharpVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microcharts.iOS/Microcharts.iOS.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Sources/Microcharts.iOS/Microcharts.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageTags>maui ios chart skia</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp.Views" Version="3.119.4" />
<PackageReference Include="SkiaSharp.Views" Version="$(SkiaSharpVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microcharts/Microcharts.csproj" />
Expand Down
18 changes: 12 additions & 6 deletions Sources/Microcharts/Charts/HalfRadialGaugeChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ public void DrawGaugeArea(SKCanvas canvas, ChartEntry entry, float radius, int c
IsAntialias = true,
})
{
using (SKPath path = new SKPath())
using (var builder = new SKPathBuilder())
{
path.AddArc(SKRect.Create(cx - radius * 2, cy - radius * 2, 4 * radius, 4 * radius), 180, 180);
canvas.DrawPath(path, paint);
builder.AddArc(SKRect.Create(cx - radius * 2, cy - radius * 2, 4 * radius, 4 * radius), 180, 180);
using (var path = builder.Detach())
{
canvas.DrawPath(path, paint);
}
}
}
}
Expand All @@ -75,11 +78,14 @@ public void DrawGauge(SKCanvas canvas, SKColor color, float value, float radius,
IsAntialias = true,
})
{
using (SKPath path = new SKPath())
using (var builder = new SKPathBuilder())
{
var sweepAngle = AnimationProgress * 180 * (Math.Abs(value) - AbsoluteMinimum) / ValueRange;
path.AddArc(SKRect.Create(cx - radius * 2, cy - radius * 2, 4 * radius, 4 * radius), 180, sweepAngle);
canvas.DrawPath(path, paint);
builder.AddArc(SKRect.Create(cx - radius * 2, cy - radius * 2, 4 * radius, 4 * radius), 180, sweepAngle);
using (var path = builder.Detach())
{
canvas.DrawPath(path, paint);
}
}
}
}
Expand Down
21 changes: 0 additions & 21 deletions Sources/Microcharts/Charts/Legacy/LegacyPointChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,32 +329,11 @@ protected SKRect[] MeasureLabels(string[] labels)
return MeasureHelper.MeasureTexts(labels, font);
}

/// <summary>
/// Measures the value labels with the text size of the given paint.
/// </summary>
/// <returns>The value labels.</returns>
protected SKRect[] MeasureLabels(string[] labels, SKPaint paint)
{
if (paint == null)
{
return MeasureLabels(labels);
}

using var font = new SKFont(SKTypeface.Default, paint.TextSize);
return MeasureHelper.MeasureTexts(labels, font);
}

/// <summary>
/// Measures the value label.
/// </summary>
/// <returns>The value label.</returns>
protected SKRect MeasureLabel(string label) => MeasureLabels(new[] { label }).First();

/// <summary>
/// Measures the value label with the text size of the given paint.
/// </summary>
/// <returns>The value label.</returns>
protected SKRect MeasureLabel(string label, SKPaint paint) => MeasureLabels(new[] { label }, paint).First();
#endregion
}
}
15 changes: 10 additions & 5 deletions Sources/Microcharts/Charts/LineChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ private void DrawSeriesLine(SKCanvas canvas, SKSize itemSize)
using (var shader = CreateXGradient(points, s.Entries, s.Color))
paint.Shader = shader;

var path = new SKPath();
//path.MoveTo(points.First());
using var path = new SKPathBuilder();

var isFirst = true;
var entries = s.Entries;
Expand Down Expand Up @@ -229,7 +228,10 @@ private void DrawSeriesLine(SKCanvas canvas, SKSize itemSize)
}
}

canvas.DrawPath(path, paint);
using (var linePath = path.Detach())
{
canvas.DrawPath(linePath, paint);
}
}
}
}
Expand All @@ -251,7 +253,7 @@ private void DrawLineArea(SKCanvas canvas, ChartSerie serie, SKPoint[] points, S
{
paint.Shader = EnableYFadeOutGradient ? SKShader.CreateCompose(shaderY, shaderX, SKBlendMode.SrcOut) : shaderX;

var path = new SKPath();
using var path = new SKPathBuilder();

var isFirst = true;
var entries = serie.Entries;
Expand Down Expand Up @@ -303,7 +305,10 @@ private void DrawLineArea(SKCanvas canvas, ChartSerie serie, SKPoint[] points, S

path.LineTo(lastPoint.X, origin);
path.Close();
canvas.DrawPath(path, paint);
using (var areaPath = path.Detach())
{
canvas.DrawPath(areaPath, paint);
}
Comment thread
follesoe marked this conversation as resolved.
Resolved
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions Sources/Microcharts/Charts/RadarChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ public override void DrawContent(SKCanvas canvas, int width, int height)

DrawBorder(canvas, center, radius);

using (var clip = new SKPath())
using var clipBuilder = new SKPathBuilder();
clipBuilder.AddCircle(center.X, center.Y, radius, SKPathDirection.Clockwise);

using (var clip = clipBuilder.Detach())
{
clip.AddCircle(center.X, center.Y, radius);


for (int i = 0; i < total; i++)
Expand Down
9 changes: 6 additions & 3 deletions Sources/Microcharts/Charts/RadialGaugeChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@ public void DrawGauge(SKCanvas canvas, SKColor color, float value, float radius,
IsAntialias = true,
})
{
using (SKPath path = new SKPath())
using (var builder = new SKPathBuilder())
{
var sweepAngle = AnimationProgress * 360 * (Math.Abs(value) - AbsoluteMinimum) / ValueRange;
path.AddArc(SKRect.Create(cx - radius, cy - radius, 2 * radius, 2 * radius), StartAngle, sweepAngle);
canvas.DrawPath(path, paint);
builder.AddArc(SKRect.Create(cx - radius, cy - radius, 2 * radius, 2 * radius), StartAngle, sweepAngle);
using (var path = builder.Detach())
{
canvas.DrawPath(path, paint);
}
}
}
}
Expand Down
Loading
Loading