Pre loader

how to cancel annotation creation in OnAnnotationCreatedListener()

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



I’d like to learn how to cancel creating annotation in the OnAnnotationCreatedListener(). Thanks.

annotationCreationModifier.setAnnotationCreationListener(new OnAnnotationCreatedListener() {
        public void onAnnotationCreated(IAnnotation iAnnotation) {
            if (outofbound) {
                 // remove current annotation
  • You must to post comments

Hi Gang Xu,

You can cancel creation of annotation, because it already created in listener and passed as parameter. The only thing which you can do is to remove annotation from chart so it won’t be shown.

public void onAnnotationCreated(@NonNull IAnnotation annotation) {
    // get chart where annotation is placed
    final ISciChartSurface parentSurface = ((AnnotationBase) annotation).getParentSurface();

    // try remove annotation from chart
    if(parentSurface != null)

Hope this will help you!

Best regards,

  • Gang Xu
    Thanks. It works like a charm.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.