Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
XamDataChart legend
posted

Hi,

I am designing a wizard which allows a user to style a chart, so it's similar to the sample (XamDataChart > Display > Gallery - Category Series) they can choose the type of line series they want, it all works fine but the issue I'm having is that the legend data seems to be shared across all of the charts.

So I have 10 or so charts which are using the same legend (same as the sample) and I'm toggling visibility of the charts which I would expect the legend data to be changed based on that.

<ig:Legend x:Name="Legend" />

However I'm not binding the data like in the sample it's getting the data from the chart

How can I get around this so that the legend only shows data for that chart?

Thanks, Grant

Parents
No Data
Reply
  • 34510
    Verified Answer
    Offline posted

    Hi Grant,

    In the Gallery - Category Series sample there is a function in the code-behind file called ChangeChartsVisibility().  In this function it is not only setting the XamDataChart's Visibility but it is also looping through the chart's Series collection and setting the visibility on each series as well.  This is what causes the series to become hidden from the Legend.  Just setting the XamDataChart's Visibility will not hide the data from the legend.

    I have attached a simple sample application that switches between a Line Series and Column Series.  You will see that the legend data is changed as well.

    DataChartLegend.zip
Children