So, I have a xamDataChart that displays a stacked column series, along with a legend showing each column fragment. I have tied into the LegendItemMouseLeftButtonUp event and set the correct column fragment series' Opacity to 0, in order to "hide" that series without removing it from the legend. Then if I click the legend again I set the Opacity back to 1 to "show" the series. The problem I am having is that after the series is "hidden" the remaining "shown" series have gaps between them and some even look like they are floating. How would I go about refreshing the chart so that the remaining "shown" series are neatly stacked one on top of the other? I attached an image of the floating bars.
Hello Joe,
The only way to remove those gaps is to remove the StackedFragmentSeries from the collection. The issue with doing this though, is that it also removes the item from the legend so you wouldn't be able to bring the series back by clicking on it. To get around this you can create a dummy chart that sits behind your main one. Inside this dummy chart you would have an exact copy of your StackedColumnSeries and your Legend would be tied to this. In your main chart, you would remove the Legend. This would allow you to detect which legend item was clicked on so you could add/remove the series accordingly without altering the legend. I've attached a sample that demonstrates how you can do this.
Let me know if you have any questions on it.
Rob,
Thank you for the example, I will take this and use it to modify my application. If I run into anything I don't understand I will ask. Again thank you.
Hi Joe,
You're welcome. If you have any further questions we'll be here to help.