Hi,
I’d like to learn how to cancel creating annotation in the OnAnnotationCreatedListener(). Thanks.
annotationCreationModifier.setAnnotationCreationListener(new OnAnnotationCreatedListener() {
@Override
public void onAnnotationCreated(IAnnotation iAnnotation) {
if (outofbound) {
// remove current annotation
}
}
- Gang Xu asked 3 years ago
- You must login 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.
@Override
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)
parentSurface.getAnnotations().remove(annotation);
}
Hope this will help you!
Best regards,
Yura
- Yura Khariton answered 3 years ago
-
Thanks. It works like a charm.
- You must login to post comments
Please login first to submit.