beto-rodriguez / LiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.
https://livecharts.dev
MIT License
4.31k stars 567 forks source link

Apply themes to chart properties #1039

Open mark-monteiro opened 1 year ago

mark-monteiro commented 1 year ago

Describe the bug Defining a theme style for the draw margin using HasRuleForDrawMargin has no effect.

To Reproduce Steps to reproduce the behavior:

  1. Register and use a theme that makes use of the HasRuleForDrawMargin method
  2. See that charts do not apply the rules to the draw margin from the theme

Expected behavior The theme should be applied to the DrawMargin

Screenshots N/A

Desktop (please complete the following information):

Additional context Other aspects of the theme I have defined are being applied correctly (series, axis, etc), it is just the DrawMargin properties that appear to be ignored.

beto-rodriguez commented 1 year ago

The referenced commit partially fixes this. this will apply themes to existing draw margins, but it cannot create new ones... the problem is actually a little bit bigger; we cannot set any chart property at theme level for now.

You could actually set a draw margin using themes, but you must use WPF themes, the LiveCharts API only sets themes for the drawn objects, this is nice because the same code works for all the supported frameworks.

Maybe we need an API to apply themes to the framework elements of each supported platform? 🤔