Page 1 of 1

AnnotationTool doesn't redraw correctly when device rotation occurs.

Posted: Tue Dec 17, 2019 9:46 pm
by 18286055
AnnotationTool doesn't redraw correctly when device rotation occurs; it points to seemingly random other point in the general direction of the original selected point compared to the annotation tool popup location prior to the device rotation. It's only after the user presses anywhere on the screen that the tool picks up the correct positioning again. Occurs on both iOS and Android.

Shouldn't the annotation window(s) either:
1) disappear.
2) redraw to account for the change in position.

If I'm missing something, please let me know. I've tried the following to try to hide it but it doesn't work.

Code: Select all

AnnotationTool.Active = false; 
AnnotationTool.Invalidate();
Note: using NearestPointTool to get the closest point's index to the pressed point.

Re: AnnotationTool doesn't redraw correctly when device rotation occurs.

Posted: Fri Dec 20, 2019 11:14 am
by Pep
Hello,
most likely the problem is that you forgot to calculate the correct annotation position inside the Chart. In order to positionate the Annotation or any object we need to draw inside the Chart canvas, the CalcXPosValue and CalcYPosValue methods have to be used.

Code: Select all

            var xpos = area1.CalcXPosValue((int)colorLine1.Value);
            var ypos = area1.CalcYPosValue(area1.YValues.Value[(int)colorLine1.Value]);
I'd suggest you take a look this example which uses these methods to calculate the correct annotation coordinates.