Setting Number of Horizontal Grid Lines While Zooming

TeeChart for ActiveX, COM and ASP
Post Reply
tirby
Newbie
Newbie
Posts: 16
Joined: Wed Oct 13, 2004 4:00 am

Setting Number of Horizontal Grid Lines While Zooming

Post by tirby » Wed Aug 07, 2013 9:04 pm

Hello,

The graph is setup to follow the 1-2-5 rule across 20 horizontal lines for the Y-Axis of the grid during normal view.
My customer is requesting that the number of horizontal grid lines remain constant (20 Lines) while in Zoomimg or Panning.
How can I do this?

Thanks

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

Re: Setting Number of Horizontal Grid Lines While Zooming

Post by Yeray » Thu Aug 08, 2013 3:26 pm

Hello,

What about setting a Left Axis Increment each time the chart is zoomed/unzoomed?
Ie:

Code: Select all

Dim nGridLines As Integer

Private Sub Form_Load()
  TChart1.Aspect.View3D = False
  
  TChart1.AddSeries scLine
  With TChart1.Series(0)
    .FillSampleValues
  End With
  
  nGridLines = 20
  TChart1.Environment.InternalRepaint
  recalcIncrement
End Sub

Private Sub TChart1_OnUndoZoom()
  recalcIncrement
End Sub

Private Sub TChart1_OnZoom()
  recalcIncrement
End Sub

Private Sub recalcIncrement()
  With TChart1.Axis.Left
    .Increment = (.Maximum - .Minimum) / nGridLines
  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

tirby
Newbie
Newbie
Posts: 16
Joined: Wed Oct 13, 2004 4:00 am

Re: Setting Number of Horizontal Grid Lines While Zooming

Post by tirby » Fri Aug 09, 2013 8:34 pm

Yeray,

Thanks for the info.

That got me started in the right direction.
I also had to set the min.Separation % to 0 to keep the 20 lines from disappearing if the graph height is set to short.
I modified the code to cover both left and right axis.

Post Reply