Repository navigation
Conversation
Microcharts.Core uses no MAUI API, but UseMaui gave its assemblies MAUI's XAML namespace attributes, whose types are in Microsoft.Maui.Controls. Mono decodes them when it loads the assembly, so an Android app without MAUI, such as one with the native Microcharts.Droid view or with Slint, aborts at startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slint apps show a chart in an Image: ChartRenderer draws it with SkiaSharp at the element's size in physical pixels, and hands the premultiplied pixels to Slint. SlintTimer steps the animations on the Slint thread. chart-view.slint has a ChartView that reports its size. Microcharts.Samples.Slint shows the quickstart charts on the desktop, Android, and iOS. Both reference Slint for .NET 1.19.0-preview.10, or a Slint checkout with -p:SlintRepository=<path>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Thanks for the PR @yurkinh, but we will not be accepting new front-end or UI frameworks for Microcharts. You are free to work on it and maintain it as you see fit to support Slint. I wish you all the best with your new UI framework built on top of .NET. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Microcharts.Slint, a chart view for Slint
Slint is a native UI toolkit with .NET 10 bindings, Slint for .NET, for macOS, Linux, Windows, Android, and iOS.
This adds
Microcharts.Slint, so that Slint apps can show Microcharts' charts, like the MAUI, iOS, and Android views do.I'm the author of the .NET bindings for Slint, and I'll maintain this view.
What's in It
Microcharts.Corebuilds without MAUI.UseMauigave the core's assemblies MAUI's XAML namespace attributes, whose types live inMicrosoft.Maui.Controls.Mono decodes them when it loads the assembly, so an Android app without MAUI aborts at startup:
mono_assembly_load_friends: Could not load file or assembly 'Microsoft.Maui.Controls'.The assemblies of the published 3.0.0-preview.4 carry the same attributes, so it likely affects other Android apps without MAUI too.
The core uses no MAUI API, so the change is two lines in its project;
Microcharts.Mauiand the Android sample still build.Sources/Microcharts.Slint, under 200 lines with comments, fornet10.0,net10.0-android, andnet10.0-ios:ChartRendererdraws a chart withChart.Drawinto anSKBitmapat the size of a SlintImage, in physical pixels,and hands the pixels to Slint without converting them.
It draws again when the chart invalidates or the size changes, and follows the chart through
ObserveInvalidate.The chart's sizes, such as
LabelTextSize, are in logical pixels, scaled by the window's scale factor, like Slint's lengths.SlintTimeris anITimeron Slint's timers, so that animations step on the Slint thread, where the UI may change.SlintTimer.Install()setsMicrocharts.Timer.Create, likeUseMicrocharts()on MAUI.chart-view.slinthas aChartView, anImagethat reports its size.Sources/Microcharts.Samples.Slint: the charts ofData.CreateQuickstart, in a desktop, an Android, and an iOS project that share the UI.Usage
Testing
On iOS, SkiaSharp's framework and Slint's sit side by side in the app.
Microcharts.MauiandMicrocharts.Samples.Androidbuild with the changed core.Not in It Yet
The projects aren't in
Microcharts.slnxor the publish workflow yet.They need Slint for .NET 1.19.0-preview.10, which adds the premultiplied pixel API, and I'd add them once it's on nuget.org, or in this PR if it's there first.
Until then, build them against a Slint checkout with
-p:SlintRepository=<path>.