SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Closed
0
0

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.

  1. The SciChart RenderableSeries dependency property of my chart surface is a property in my view model named “Measurements”, I.e. ObservableCollection of IRenderableSeries.
  2. An ObservableCollection of another class named “ExampleList” is also in my view model.
  3. 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.
  4. 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()”

Version
6.1.0.13075
  • Oleksandr Shvets
    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
  • Chris Kirkman
    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.
  • Chris Kirkman
    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 to post comments
Showing 0 results