drawing on canvas
Posted: Wed Nov 24, 2004 2:13 pm
Hi
Is there an easy way to draw lines and arcs on the graph area only?
I have a problem because custom drawings on the canvas and series do not share the same area, the canvas is bigger.
Suppose this situation
Private Sub Form_Load()
X = Array(1, 2, 3, 4, 5)
Y = Array(2, 3, 1, 5, 8)
With TChart1
.ClearChart
.AddSeries scLine
.Aspect.View3d = False
.Series(0).AddArray 5, Y, X
.Axis.Left.Automatic = False
.Axis.Bottom.Automatic = False
.Axis.Bottom.Minimum = 0
.Axis.Bottom.Maximum = 10
.Axis.Left.Minimum = 0
.Axis.Left.Maximum = 10
End With
end sub
Private Sub TChart1_OnBeforeDrawAxes()
With TChart1
posx = .Axis.Bottom.CalcXPosValue(-2)
posy = .Axis.Left.CalcYPosValue(-2)
.Canvas.MoveTo posx, posy
posx = .Axis.Bottom.CalcXPosValue(2)
posy = .Axis.Left.CalcYPosValue(2)
.Canvas.LineTo posx, posy
End With
End Sub
the line is partly drawn outside the axis' region, and partly within the axis region together with the series.
Is there an easy way to display drawings only in the series region and not outside axises?
Any help would be very much appreciated, it would avoid me a great deal of work.
Thanks in advance
Ivan
Is there an easy way to draw lines and arcs on the graph area only?
I have a problem because custom drawings on the canvas and series do not share the same area, the canvas is bigger.
Suppose this situation
Private Sub Form_Load()
X = Array(1, 2, 3, 4, 5)
Y = Array(2, 3, 1, 5, 8)
With TChart1
.ClearChart
.AddSeries scLine
.Aspect.View3d = False
.Series(0).AddArray 5, Y, X
.Axis.Left.Automatic = False
.Axis.Bottom.Automatic = False
.Axis.Bottom.Minimum = 0
.Axis.Bottom.Maximum = 10
.Axis.Left.Minimum = 0
.Axis.Left.Maximum = 10
End With
end sub
Private Sub TChart1_OnBeforeDrawAxes()
With TChart1
posx = .Axis.Bottom.CalcXPosValue(-2)
posy = .Axis.Left.CalcYPosValue(-2)
.Canvas.MoveTo posx, posy
posx = .Axis.Bottom.CalcXPosValue(2)
posy = .Axis.Left.CalcYPosValue(2)
.Canvas.LineTo posx, posy
End With
End Sub
the line is partly drawn outside the axis' region, and partly within the axis region together with the series.
Is there an easy way to display drawings only in the series region and not outside axises?
Any help would be very much appreciated, it would avoid me a great deal of work.
Thanks in advance
Ivan