SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Answered
0
0

When Im trying to remove an annotation, I’m receiving an error:

java.lang.NullPointerException: Attempt to invoke interface method
‘void
com.scichart.charting.visuals.annotations.IAnnotationPlacementStrategy.drawAdorner(android.graphics.Canvas)’
on a null object reference
at
com.scichart.charting.visuals.annotations.AnnotationBase.onDrawAdorner(SourceFile:889)
at
com.scichart.charting.visuals.annotations.AdornerLayer.onDraw(SourceFile:144)
at android.view.View.draw(View.java:17071)
at android.view.View.updateDisplayListIfDirty(View.java:16053)

I’ve tried many ways, like:

UpdateSuspender.using(priceChart, new Runnable() {
    @Override
    public void run() {
        priceChart.getAnnotations().clear();
    }
});

and

UpdateSuspender.using(priceChart, new Runnable() {
    @Override
    public void run() {
        priceChart.getAnnotations().remove(myAnnotation);
    }
});
Version
2.0.0.1884
  • You must to post comments
Best Answer
1
0

Hi Marcos,

I want to notify you that I’ve investigated and fixed this issue. It was caused by a small bug in our code – when you remove annotation from chart it doesn’t remove adorner for annotation if it is selected. The fix will be available in our next nightly build and for now you can workaround this issue by unselecting annotation before removing from collection:

UpdateSuspender.using(priceChart, new Runnable() {
    @Override
    public void run() {
        myAnnotation.setSelected(false);
        priceChart.getAnnotations().remove(myAnnotation);
    }
});

Hope this will help you!

Best regards,
Yura

  • You must to post comments
0
0

Thank you!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.