I looked at this thread but it doesn’t help me.
https://www.scichart.com/questions/wpf/dynamically-clearing-legends-from-the-legendmodifier
I have problem where an item is still shown in the legend even though no series is currently displayed on the chart.
For example.
- The SciChart RenderableSeries dependency property of my chart surface is a property in my view model named “Measurements”, I.e. ObservableCollection of IRenderableSeries.
- An ObservableCollection of another class named “ExampleList” is also in my view model.
- In a data grid elsewhere in the application a user selects 3 rows. The “ExampleList” collection now has 3 items in it. Part of the setter for that property is to call “Measurements.Clear()” and then follow that with a “Measurement.Add(newseries)” 3 times.
- When a user selects an individual item in the data grid that contains no points that could be displayed on the chart I only call “Measurements.Clear()” and I don’t subsequently called “Measurements.Add()”
My issue is that the legend never clears and shows the last series that was selected before selecting this new item which shouldn’t even be in the chart. It’s behaving as if the chart were not cleared; although I have verified that I definitely am calling “Measurements.Clear()”
- Chris Kirkman asked 4 years ago
-
Hi Chris, Thanks for your inquiry. Could you please send us a small sample project reproducing this issue for investigation? Thanks in advance. With best regards, Oleksandr
-
I’ll try. I’m using MVVM as part of an enormous product. I have a UserControl upon which the SciChart is a part of. I use dependency properties and a model to bind what is/isn’t displayed, etc. It’s going to take a bit of time to mockup something up. I’ll get back to you.
-
I finally figured it out. After banging my head forever trying to understand why the sample I was going to send you seemed to work just fine…I finally figured out what was happening. I’m using a custom ViewPortManager which was evidently leaving the last series on the chart even though I had cleared it. It was interesting because the series was not actually drawn on the chart, but the legend item for that series was still displayed. ;) I’ll put some work into trying to understand what I did wrong but at least I finally tracked it down. This is on me and not SciChart.
- You must login to post comments