Create Legend in SKCartesianChart #123
-
I'm creating a function to dynamically create a cartesian chart that and serve it as an image. I'm using SKCartesianChart for that, and it works pretty nicely. What I have not been able to figure out is how to create a legend for this chart. Since the application I write is headless, I don't have UI components to tie into. I checked the examples, but as far as I could see they all seem to assume there is a UI. How do I create a legend in only code? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
But for now all the legends and tooltips are user controls on each platform, this allows the user to pass a custom template to render their own tooltips and legends using the syntax in their current platform (Xamarin, Avalonia, WPF, WinUI ...) sadly there is no a standard between all these platforms. An alternative is to create your own |
Beta Was this translation helpful? Give feedback.
SKCartesianChart
,SKPieChart
andSKGeoMap
classes do not require a UI.But for now all the legends and tooltips are user controls on each platform, this allows the user to pass a custom template to render their own tooltips and legends using the syntax in their current platform (Xamarin, Avalonia, WPF, WinUI ...) sadly there is no a standard between all these platforms.
An alternative is to create your own
IChartLegend<T>
and use the SkiaSharp API to draw the legend, this way we could share the legend across all platforms (and "in-memory charts" also such as theSKCharts
classes). Actually I was going for this approach for the library, but then it would have been harder for the user to cu…