Page 1 of 1
Horizontal dotted lines from 0 point of Y-axis .
Posted: Tue Dec 15, 2009 7:59 am
by 6924564
Hi,
I am using TeeChart Pro 5.0.
I need to draw one horizontal dotted lines in my line graph from the point 0 in Y- axis. I have attached one image.
Can you tell me how can I do this.
Re: Horizontal dotted lines from 0 point of Y-axis .
Posted: Tue Dec 15, 2009 9:55 am
by yeray
Hi CS,
With TeeChart v8 you can use ColorLine to do that but in Teechart v5 I think that this tool wasn't still available. If not, you still could draw the desired line drawing it directly to the canvas at OnAfterDraw event.
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.AddSeries scFastLine
TChart1.Series(0).Add -50, "", clTeeColor
TChart1.Series(0).Add 0, "", clTeeColor
TChart1.Series(0).Add 75, "", clTeeColor
TChart1.Series(0).Add 50, "", clTeeColor
TChart1.Series(0).Add 50, "", clTeeColor
TChart1.Axis.Left.SetMinMax -100, 300
TChart1.Tools.Add tcColorLine
TChart1.Tools.Items(0).asColorLine.Axis = TChart1.Axis.Left
TChart1.Tools.Items(0).asColorLine.Value = 0
TChart1.Tools.Items(0).asColorLine.Pen.Color = vbMagenta
TChart1.Tools.Items(0).asColorLine.Pen.Style = psDash
End Sub
'Private Sub TChart1_OnAfterDraw()
' With TChart1.Canvas
' .Pen.Color = vbMagenta
' .Pen.Style = psDash
' .Line TChart1.Axis.Bottom.IStartPos, TChart1.Axis.Left.CalcYPosValue(0), TChart1.Axis.Bottom.IEndPos, TChart1.Axis.Left.CalcYPosValue(0)
' End With
'End Sub
Re: Horizontal dotted lines from 0 point of Y-axis .
Posted: Thu Dec 17, 2009 8:06 am
by 6924564
Thanks Yeray. It worked.