I’m using a chart as a way to visualise a series of time-based tasks on a “timeline”, not unlike a Gantt chart (is there anything SciChart can’t be used for?!). I do this using annotations that the user can move and resize, actually custom “box” annotations that can only be dragged and resized horizontally. Image attached if interested.
When a user starts moving or resizing an annotation, I bring it to the front to ensure that it remains visible even if it ends up overlapping another annotation, using:
Panel.SetZIndex(annotation, Int.MaxValue);
For every other annotation
Panel.SetZIndex(annotation, 0);
Finding this approach was a bit of a happy accident so I’m wary of continuing to use this technique in case it breaks in a future version. I’m assuming this code works because annotations reside in a parent container that inherits from Panel? Do you see any issues using the above or is there a “better” way to change an annotation’s Z-Index?
- Andrew Stephens asked 2 years ago
- You must login to post comments
Hello Andrew,
Thanks for your question.
Your approach is perfectly valid. Our Annotations are WPF UI elements placed on a Canvas, so this is the right way of doing that.
Best Regards,
Yuriy
- Yuriy Zadereckiy answered 2 years ago
- You must login to post comments
Hi there
The z-Index of annotations in SciChart WPF is also the order they are in the SciChartSurface.Annotations
collection.
Just re-order the annotations and the z-order will change.
Hope this helps
Best regards
Andrew
- Andrew Burnett-Thompson answered 3 months ago
- You must login to post comments
Please login first to submit.