We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

LegendItemCreated event of Xamarin SfChart control doesn't fire

Thread ID:

Created:

Updated:

Platform:

Replies:

149590 Dec 2,2019 02:02 PM UTC Dec 9,2019 06:32 AM UTC Xamarin.Android 3
loading
Tags: SfChart
khasan
Asked On December 2, 2019 02:02 PM UTC

Hi,

I am using Syncfusion SfChart in my Xamarin Android project. I noticed that the LegendItemCreated event never fires. The Syncfusion.SfChart.Android.dll version is 17.3451.0.26. Please let me know on which version it works

Regards
Khasan

Hemalatha Marikumar [Syncfusion]
Replied On December 3, 2019 11:43 AM UTC

i khasan, 
  
Greetings from Syncfusion. 
  
Query: LegendItemCreated event never fires. 
  
We have validated your query and we were unable to reproduce the reported issue even with 17.3451.0.26 and latest version 17.3451.0.29 also. We suspect that the reported issue may occur while not enabling the Legend visibility for SfChart. Please enable the Legend visibility as per the below code snippet. 
  
Code Snippet [C#]: 
  
chart.Legend.Visibility = Visibility.Visible; 
chart.LegendItemCreated += Chart_LegendItemCreated; 
  
  
And we have prepared a sample based on your requirement and you can download the sample from the below link. 
  
  
For more details please refer the UG link below. 
  
Please let us know if you have any further assistance on this. 
  
Regards, 
Hemalatha M. 


khasan
Replied On December 8, 2019 07:18 PM UTC

Hi Hemalatha, thanks to this example, I understood why the event doesn't fire. if I subscribe after series being adding the event doesn't work but if I subscribe before adding series it works for example:

In the below example Chart_LegendItemCreated handler will not be called:
chart.Series.Add(series);
chart.LegendItemCreated += Chart_LegendItemCreated;

In the below example Chart_LegendItemCreated handler will be called:
chart.LegendItemCreated += Chart_LegendItemCreated;
chart.Series.Add(series);


Regards
Khasan

Hemalatha Marikumar [Syncfusion]
Replied On December 9, 2019 06:32 AM UTC

Hi Khasan, 
 
Thanks for your update. 
 
We glad to hear that you have found the solution. 
 
We would like to let you know that currently we have maintained the flow of execution only invoke the LegendItemCreated before adding the series collection with having visibility of Legend as per in below 
 
chart.Legend.Visibility = Visibility.Visible; 
….. 
chart.LegendItemCreated += Chart_LegendItemCreated; 
chart.Series.Add(series); 
 
 
Please let us know if you have any other concern. 
 
Regards, 
Hemalatha M. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon