Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to display check boxes for legend items to control the visibility of series in the unbound mode

$
0
0

This example demonstrates how you can provide each legend item with a check box, which controls the visibility of the corresponding series in the unbound mode.
Note that starting with the DXperience version 13.2.1, the chart control supports a built-in check box in the Legend feature. For more details, see the Legend Check Box topic.  

Implementation details for the DXperience v2012 vol 2.5

To accomplish this, it is necessary to assign the Legend.Template property to custom template and then bind the ItemsSource property of the ItemsControl object to SeriesNonVisualWrappersCollection.

This custom collection is synchronized with the diagram's series collection when the SeriesCollection.CollectionChanged event fires.

In addition, the fake series is created to avoid hiding the legend when the Series.Visible property is set to false for all series.

See also:
- How to display custom information in the legend;
- How to customize chart titles;
- How to display check boxes for legend items, to control the visibility of series in the bound mode.

Question Comments

Added By: Zeljko Ilic at: 11/17/2014 6:57:42 AM    

This is working great - there is just one thing: there is no color on clickable chart legend.
Since each check item corresponds to one curve, ideally they should be having the same color.
Can this be added?

Added By: Alex (DevExpress Support) at: 11/17/2014 11:55:22 PM    Hi Zeljko,

In the latest version (v14.1), this functionality is supported out of the box (see the Legend Check Box article). Please upgrade your application to a more recent version and let me know if you need any clarification.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>