Page 1 of 1

drawing annotation tool to show on stacked graph ...?

Posted: Tue Aug 15, 2006 1:58 pm
by 6925851
Private Sub Form_Load()
TeeCommander1.Chart = TChart1
With TChart1
.Aspect.View3D = False
.AddSeries scBar
.AddSeries scBar
.AddSeries scBar
For i = 0 To .SeriesCount - 1
For j = 1 To 15
.Series(i).AddXY j, Rnd * 100, "", clTeeColor
.Tools.Add tcAnnotate
Next j
.Series(i).Marks.Visible = False
.Series(0).asBar.MultiBar = mbStacked

Next i
.Environment.InternalRepaint
End With
End Sub

Private Sub TChart1_OnAfterDraw()
With TChart1
For i = 0 To .SeriesCount - 1
For j = 1 To 15
With .Tools.Items((i * 15) + (j - 1)).asAnnotation
.Shape.Color = RGB(255, 255, 230)
.Shape.ShadowSize = 0
.Shape.CustomPosition = True
.Shape.Left = TChart1.Series(i).CalcXPos(j - 1)
.Shape.Top = TChart1.Series(i).CalcYPos(j - 1) - 35
.Text = Round(TChart1.Series(i).YValues.Value(j - 1), 2)
End With
.Tools.Items((i * 15) + (j - 1)).Active = True
.Canvas.Pen.Color = vbWhite
.Canvas.MoveTo TChart1.Series(i).CalcXPos(j - 1) +
..Series(i).asBar.BarWidth / 2, TChart1.Series(i).CalcYPos(j - 1)
.Canvas.LineTo TChart1.Series(i).CalcXPos(j - 1) +
..Series(i).asBar.BarWidth / 2, TChart1.Series(i).CalcYPos(j - 1) - 18

Next j
Next i
End With
End Sub

the above code is given by your people which can show values before the bar in the stacked graph but this one works only for the first page when i move to next page my annotation tools points some where , not on the bar


...?

how can we do this ..?

Posted: Wed Aug 16, 2006 10:07 am
by Pep
Hi Aravind,

one way around this would be to remove and create again the annoations for the displayed bars in the OnPageChange event.