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.
Best regards,
Kamil
- Kamil Macura asked 4 weeks ago
- last edited 4 weeks ago
- You must login to post comments
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
- David Burleigh answered 3 weeks ago
- You must login to post comments
Please login first to submit.