If you became a customer of the Syncfusion Reporting Platform or the Report Viewer, Report Designer, or Report Writer components before October 2019 and have questions related to those products, you can request support through our forum system. However, please note that this support system is only for existing customers who are still using the Syncfusion Reporting Platform or its components and not for new customers looking for reporting products from Syncfusion.
For new customers or those with general reporting questions, we recommend contacting our support team at https://support.boldreports.com/, which is a separate brand created by Syncfusion for its reporting solutions. Our team will be happy to assist you with any questions you may have.
Thank you for choosing Syncfusion for your reporting needs.
We are trying to have a legend that makes sense with a chart displaying a collection of PieSeries. Something like the picture "expected.png" in the attach file. There is also an example of the code we use to build our Pie chart.
SSSuresh S Syncfusion Team July 18, 2014 11:06 AM UTC
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
In our solution we have to build a collection of PieSeries that can change over time, with an buildChart button. More like the example of code in attach file. I guess the only way to have a legend that make sense is to add code in code behind for the XAML file ? Also is there any Event like OnChartDataChanged where we can add the code of the legend ?
SSSuresh S Syncfusion Team July 21, 2014 11:16 AM UTC
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.
In the sample code you modified, when the BuildPieCommand is called, the Chart is updated with the new data, but there is no call to Chart_OnLoaded. Is there an event called when there is a change apply to the data of the chart ? I want to add the code of the legend here, but the only event I found is SizeChanged. So I have to resize the windows to rebuild the legend of the chart.
SSSuresh S Syncfusion Team July 22, 2014 12:56 PM UTC
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.
MGMathieu GuérinJuly 22, 2014 09:24 PM UTC
I have modified the sample (see attach file). Now when you press the BuildChart button, the legend is updated like you say, but what I want is a legend that will be modified in the code behind each time the DataSource of the chart change (every time you press the BuildChart button). In the sample, if you try to resize the window the event SizeChanged will be invoked and the code behind will update the legend. This is the only way I find to have a legend that make sense (related to colors in the pie chart), but I have to resize the window to apply the change on the legend.
Is there any event invoked when the DataSource of the chart is modified, so i can update the legend in the same time ?
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
Also, we have modified the
sample based on your requirement. Please download it from the given below
I know this is a solution to add the code of legend in ViewModel part of our solution, but we don't want to have any references to Syncfusion in our ViewModel class. Right now, only the UI part our solution knows about Syncfusion and that's why I'm searching a way to update the legend of the pie chart in the code behind (MainWindow class in the sample). If you confirm that it is impossible, we will have to implement a structure for legend in our solution and link it to Syncfusion legend in the UI part of our solution.
SSSuresh S Syncfusion Team July 25, 2014 01:33 PM UTC
In the sample, we are already having Syncfusion reference in ViewModel for adding Series to the chart, so that we have given the solution to add legend in viewmodel. In order to achieve your requirement (without using Syncfusion reference in ViewModel) we can create a separate helper class for generating Series and Legends.
Hence we can use those helper methods in button click event. We have modified the sample, please download it from the given below location.
In the sample, we have included a helper class, which is used for generating legends alone.
Please let us know if you require further assistance on this.