Using Annotation in place of Mark object
Posted: 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);
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);