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
drawing on canvas
Hi Ivan,
yes, you can use the ClipRectangle method :
yes, you can use the ClipRectangle method :
Code: Select all
Private Sub TChart1_OnBeforeDrawSeries()
With TChart1
.Canvas.ClipRectangle .Axis.Left.Position, 0, .Axis.Right.Position, .Axis.Bottom.Position
.Canvas.Pen.Color = vbBlack
posx1 = .Axis.Bottom.CalcXPosValue(-2)
posy1 = .Axis.Left.CalcYPosValue(-2)
.Canvas.MoveTo posx1, posy1
posx = .Axis.Bottom.CalcXPosValue(2)
posy = .Axis.Left.CalcYPosValue(2)
.Canvas.LineTo posx, posy
End With
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
Drawing on canvas
Great!
Thank you very much, I was getting crazy by calculating intersections of arcs and lines with the 4 axis...
Thank you
Ivan
P.S. Have you had any luck with the isometric bug?
Thank you very much, I was getting crazy by calculating intersections of arcs and lines with the 4 axis...
Thank you
Ivan
P.S. Have you had any luck with the isometric bug?
Hi Ivan,
I'm working on some bugs now, hope to found a solution soon.
I'm working on some bugs now, hope to found a solution soon.
Pep Jorge
http://support.steema.com
http://support.steema.com