AnnotationTool doesn't redraw correctly when device rotation occurs.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
TLC
Newbie
Newbie
Posts: 73
Joined: Mon Apr 08, 2019 12:00 am

AnnotationTool doesn't redraw correctly when device rotation occurs.

Post by TLC » Tue Dec 17, 2019 9:46 pm

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.

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

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

Post by Pep » Fri Dec 20, 2019 11:14 am

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.

Post Reply