Using Annotation in place of Mark object

TeeChart for ActiveX, COM and ASP
Post Reply
Ssnsam
Newbie
Newbie
Posts: 6
Joined: Mon Mar 03, 2008 12:00 am
Contact:

Using Annotation in place of Mark object

Post by Ssnsam » Mon Oct 06, 2008 6:41 am

Hello,

I have a Bar chart. I am trying to show text in Annotation tool in the same position as the Mark object. But the position of the Annotation is not in the center of the bar.The following code I am using to set the position of the annotation.

oMarks = oChart.Series(0).GetMarks();
oMarks.SetVisible(TRUE);

oChart.GetEnvironment().InternalRepaint();

long lIndex = oChart.GetTools().Add(tcAnnotate);

oAnnotationTool = oChart.GetTools().GetItems(lIndex).GetAsAnnotation();
oAnnotationTool.SetPositionUnits(ewuPixels);
oAnnotationTool.SetText(sTitle);

oShape = oAnnotationTool.GetShape();

oMarkPositions = oMarks.GetPositions();
oMarkPosition = oMarkPositions.GetPosition(lSeriesIndex);
oPoint = oMarkPosition.GetLeftTop();
long lLeftX = (long)oPoint.GetX();
long lTopY = (long)oPoint.GetY();
long lWidth = oMarkPosition.GetWidth();
long lHeight = oMarkPosition.GetHeight();

oShape.SetCustomPosition(TRUE);
oShape.SetLeft(lLeftX);
oShape.SetTop(lTopY);
oShape.SetShadowSize(0);

oMarks.SetVisible(FALSE);

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Oct 06, 2008 7:38 am

Hi Ssnsam,

You could try doing as in the examples I posted on this thread.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply