Page 1 of 1
CAnnotationTool Custom Position
Posted: Wed Mar 18, 2009 9:27 pm
by 9532498
I'm trying to set various properties of CAnnotationTool via my code.
1) What property do I use to set the Custom Position on/off and also the Left and Top values of the Custom Position?
I'm using TChart V7 and Visual C++ 9.0
Thanks.
Posted: Thu Mar 19, 2009 8:59 am
by yeray
Hi nbp,
To place your annotation in one of the predefined positions of your chart, you could use one of the following sentences:
Code: Select all
TChart1.Tools.Items(0).asAnnotation.Position = ppCenter
TChart1.Tools.Items(0).asAnnotation.Position = ppLeftBottom
TChart1.Tools.Items(0).asAnnotation.Position = ppLeftTop
TChart1.Tools.Items(0).asAnnotation.Position = ppRightBottom
TChart1.Tools.Items(0).asAnnotation.Position = ppRightTop
And to place it in a custom position, for example:
Code: Select all
TChart1.Tools.Items(0).asAnnotation.PositionUnits = puPixels
TChart1.Tools.Items(0).asAnnotation.Left = 200
TChart1.Tools.Items(0).asAnnotation.Top = 300
Posted: Wed Mar 25, 2009 6:32 pm
by 9532498
How do I know if the Annotation position is Custom or not? Is there a boolean flag associated with CAnnotationTool? I'm using TChart v7.
Posted: Wed Mar 25, 2009 6:37 pm
by 9532498
In V7, I don't have access to Left and Top properties in CAnnotationTool
Posted: Thu Mar 26, 2009 8:29 am
by yeray
Hi nbp,
The boolean you are looking for:
Code: Select all
TChart1.Tools.Items(0).asAnnotation.Shape.CustomPosition = True
Are you sure that you have the latest v7 available? Here with TeeChart v7.0.1.4 I can use:
Code: Select all
TChart1.Tools.Items(0).asAnnotation.Left = 20
TChart1.Tools.Items(0).asAnnotation.Top = 50
or also:
Code: Select all
TChart1.Tools.Items(0).asAnnotation.Shape.Left = 20
TChart1.Tools.Items(0).asAnnotation.Shape.Top = 50