Horizontal dotted lines from 0 point of Y-axis .

TeeChart for ActiveX, COM and ASP
Post Reply
CS
Newbie
Newbie
Posts: 22
Joined: Sat Jun 08, 2002 4:00 am

Horizontal dotted lines from 0 point of Y-axis .

Post by CS » Tue Dec 15, 2009 7:59 am

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.
Attachments
LineGraph-HorizontalDottedLine.JPG
Dotted horizontal line from point 0 in Y- axis
LineGraph-HorizontalDottedLine.JPG (6.23 KiB) Viewed 5074 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Horizontal dotted lines from 0 point of Y-axis .

Post by Yeray » Tue Dec 15, 2009 9:55 am

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
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

CS
Newbie
Newbie
Posts: 22
Joined: Sat Jun 08, 2002 4:00 am

Re: Horizontal dotted lines from 0 point of Y-axis .

Post by CS » Thu Dec 17, 2009 8:06 am

Thanks Yeray. It worked.

Post Reply