Pre loader

Deselect annotations from multiple charts

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hello SciChart Team,

Problem description:
I have a main stock chart and I can add various indicators to it, some of which appear below it as new charts. Additionally, I can draw different types of lines on both the indicators and the chart. If I draw a line on each of them, I can select each one in turn and end up with all three lines selected, but I need to have only one selected and its ID saved (to open the editor and be able to edit its parameters). Is there any way to connect the charts so that the lines “see each other” and deselect when another is selected? Unfortunately, selectedChanged.subscribe doesn’t work because I don’t receive false from other charts.

Lines
https://ibb.co/wJwXZNf

Best regards,
Kamil

Version
3.4.652
Images
  • You must to post comments
0
0

The reference to the currently selected annotation on a surface is held on sciChartSurface.adornerLayer and you can also get and set the selectedAnnotation there. The deselectAnnotation method checks if the annotation being passed in is the selected one, and deselects it if it is. None of this is really documented because it was only intended for internal use and it does not automatically sync with the selected property on a given annotation. Eg setting selectedAnnotation to undefined does not set isSelected to false on the currently selected annotation – you have to do this yourself. We do have plans to improve all this – to support multiple selected annotations and have a clean api for managing selection programmatically.

However, it should be possible to do what you need. In the subscription for selectedChanged on an annotation, when one becomes selected you would need to look at the sciChartSurface.adornerLayer.selectedAnnotation on the other surfaces and if it exists, set isSelected false on it, then set it to undefined.

Regards
David

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.