Hi Mathieu,
Thanks for using Syncfusion products.
We have analyzed the reported query, currently we don’t have
support for connector line for legends. However, we have used Annotations to
achieve your requirement. Also, we have prepared sample based on your query. Please
download it from the given below location.
Please let us know if you require further assistance on
this.
Regards,
Suresh S
Hi Matheiu,
Thanks for your response. We have added chart legend in code
behind as shown in the below code snippet. Also, we have modified the sample
based on your query. Please download it from the given below location.
Code Snippet [C#]:
private void Chart_OnLoaded(object sender, RoutedEventArgs e)
{
var legend = new ChartLegend
{
Header = "Series",
DockPosition = ChartDock.Top,
};
chart.Legend = legend;
}
Note:
Adding connector line for legends as per your previous
requirement is not possible while adding series dynamically.
Regards,
Suresh S
Hi Matheiu,
Thanks for your response.
‘Chart_OnLoaded’ will be called(invoked), when the chart
getting loaded in view. There we have added the code for adding legends to the
chart. So whenever the series is added dynamically to the chart or adding
itemssource to the series, legends will be updated automatically. So you can
use this event for adding legend in code behind.
Also if this is not your exact requirement, please provide
us more information regarding your scenario which requires the event to be
invoked or called after series or datasource has been updated. Otherwise if you
are facing any refreshing problem in legends, when adding series or datasource
dynamically, please revert us by modifying the sample based on your application
with replication procedure.
This would be helpful for us to serve you. Please let us
know, if you need any further assistance.
Regards,
Suresh S
Thanks for your response.
We have used ‘series_Loaded’ event to achieve your requirement. Whenever the series is added dynamically to
the chart or the itemssource is changed ‘series_Loaded’ event is invoked. So
you can use this event for adding legend in code behind as shown in the below
codesnippet [C#].
Also, we have modified the
sample based on your requirement. Please download it from the given below
location.
Code Snippet[C#]:
void series_Loaded(object
sender, RoutedEventArgs e)
{
Changed(sender);
}
Regards,
Suresh S