Hi!
Can you help me? I didn't find in MAUI how to do it.
In Xamarin.Forms
But in Maui?
Hi Davi,
We have validated your query and have already logged it as a feature request. Please find the link below:
However, we have achieved the modified axis label with the help of the label created event in the axis. The code snippet is attached below:
private void NumericalAxis_LabelCreated(object sender, Syncfusion.Maui.Charts.ChartAxisLabelEventArgs e) { double start = e.Position; var position = start; if(position == 0) { e.Label ="Low"; } else if(position ==50) { e.Label = "High"; } } |
If you need any further assistance, feel free to ask.
Regards,
Nitheeshkumar
Hi Nitheeshkumar!
How do I access the ItemsSource in this method? I need to work with Axis data.
In Xamarin I used this:
// Get the series ItemsSource.
var itemsSource = (chart as SfChart).Series[0].ItemsSource;
Tks.
Hi Davi,
Based on your query, achieving this ItemsSource can be done quite simply. The code snippet is provided below
Are you expecting any other way to accomplish this ItemsSource?
<chart:ColumnSeries x:Name="series" ItemsSource="{Binding Data}" XBindingPath="Name" YBindingPath="Height"></chart:ColumnSeries> |
private void NumericalAxis_LabelCreated(object sender, Syncfusion.Maui.Charts.ChartAxisLabelEventArgs e) { Var ItemsSource = series.ItemsSource; double start = e.Position; var position = start; if(position == 0) { e.Label ="Low"; } else if(position ==50) { e.Label = "High"; } }
|
Please let us know your exact use case or any concept art related to this, we will check possibility and provide you the runnable application.
Regards,
Nitheeshkumar.
Hi Nitheeshkumar!
I did as you asked but it does not recognize!
Can you help me?
Thanks!
Hi Davi,
Based on the provided snapshot, there are no issues at the control level; the issue may exists at the application level. First and foremost, you need to delete the 'bin' and 'obj' folders from your application files. Please follow the suggestions below
We hope it helps. If you need any further assistance, feel free to ask.
Regards,
Nitheeshkumar
Hi!
I created an example with the problem!
Can you help me?
Tks.
40
Hi Davi,
Based on the sample you provided, the series is located within the Data template, which is why we cannot extract the series name in the LabelCreated event. As an alternative solution, we ability to retrieve the itemsSource from the sender of the LabelCreated event . The corresponding code snippet is provided below. We hope it helps you.
private void secondaryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { var axis = sender as ChartAxis; var source = axis.BindingContext; var itemsSource = source as ChartCollectionModel; var xValues = itemsSource.Description; var yValues = itemsSource.Valor; } |
Regards,
Nitheeshkumar.