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


I’m updating some code that was written against SciChart iOS v2. We have one graph in that code that relied on removeFromLegend in a renderable series, to prevent the legend from getting ridiculous long.

As an example, suppose we have Western Earth, Western Wind, Western Fire, Eastern Earth, Eastern Wind, and Eastern Fire. Each element is styled the same, no matter where it’s located. In the legend, we only want to see Earth, Wind, and Fire. Our actual list of series is much longer…4 “elements”, up to 8 locations, making 32 legend entries, with 28 duplicates.

What’s the replacement for removeFromLegend? How do I prevent these duplications?

transitioning to v3 now, v4 soon.
  • You must to post comments

Hi, there.

SCILegendModifier has property called sourceMode.
What you can do is to set ‘sourceMode’ to .selectedSeries and then select your renderableSeries, like this:

let legendModifier = SCILegendModifier()
legendModifier.sourceMode = .selectedSeries

let line4 = SCIFastLineRenderableSeries()
line4.isSelected = true

Another option is to create your custom legend, which is a collectionView under the hood, with custom dataSource. Here you can find a link to the documentation

Hope, that helped.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.