SyncfusionToolkit VS SyncfusionCore - Example "How to change the color of axis elements in .NET MAUI Chart (SfCartesianChart)" not working on SyncfusionToolkit #203
-
I tried to create a simple chart (Date, Temperature) with SyncfusionToolkit. It did not work. So I tested "How to change the color of axis elements in .NET MAUI Chart (SfCartesianChart)" and it works. When I change it to ".ConfigureSyncfusionToolkit()", the chart it self if shown, but the lines inside are not shown. Chart works:
Chart does not work:
Looking at Syncfusion® Toolkit for .NET MAUI it says it should support "Cartesian Charts | Versatile data representation using line, bar, and area charts.". What I am doing wrong? XAML:
C# - CoPilot generate example code
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @rokmeglic71 Based on your description, it seems the chart is rendering but the LineSeries is not visible, which usually indicates a data binding issue. To resolve this, please ensure the BindingContext is correctly set to your Chart in XAML. Here’s how you can define it:
Reference: Regards, |
Beta Was this translation helpful? Give feedback.
-
Hi @rokmeglic71, Thank you for the update! Since your MainViewModel has a constructor with parameters, it can't be instantiated directly in XAML. Instead, you can set the chart’s BindingContext in the code-behind. To do this, first assign a name to your chart in XAML:
Then, set the BindingContext in the code-behind:
This approach allows you to pass the required parameters to your view model while ensuring the chart remains properly data-bound. Regards, |
Beta Was this translation helpful? Give feedback.
Hi @rokmeglic71
Based on your description, it seems the chart is rendering but the LineSeries is not visible, which usually indicates a data binding issue. To resolve this, please ensure the BindingContext is correctly set to your Chart in XAML.
Here’s how you can define it: