Using a listbox or custom component to control which chartseries get displayed?

Hello,
I've seen this post and the answer is fine for me.
But I have a complementary question :
Is it possible to change the ChartPrimaryYAxis unit ?
To be more precise, I want to show my electrical consumption in kWh or in € depending of a listbox or a button.
So I want to show Y Axis in kWh unit (0 to 2 000 kWh) or in € unit (0 to 700€).

Thanks for your help.
Best regards.

PS : Sorry for my english?


1 Reply

DG Durga Gopalakrishnan Syncfusion Team April 17, 2025 12:45 PM UTC

Hi Christian,


Greetings from Syncfusion.


You can achieve your requirement by dynamically updating the Y-axis label format based on the selected item from the ListBox. For your reference, we’ve attached a sample demonstrating this functionality.


private void change(ListBoxChangeEventArgs<string[], UnitData> args)

{

    var selectedId = args.Value.FirstOrDefault();

     var selectedItem = args.Items.FirstOrDefault(item => item.Id == selectedId);

     var selectedText = selectedItem?.Text;

     labelFormat = "{value} "+selectedText;

}




Sample : https://blazorplayground.syncfusion.com/rZLSjTMmgOxHwVOS


UG : https://blazor.syncfusion.com/documentation/chart/numeric-axis#custom-label-format


Please let us know if you have any concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon