Page 1 of 1

Fixed scale of (timestamp) x-axis

Posted: Tue May 24, 2005 8:21 am
by 9080645
hello,

I use TeeChart 6.0.0.5 ActiveX in ASP pages.

I read data from SQL database via ODBC. I read the data in a for...next loop for several measurement circuits.

I add the data to a Series with .DataSource = 'Recordset' --> totally I have several Series in one Chart.

How can I set the x-axis visible scale to e.g. 1 day (by using GetDateTimeStep) so that the visible part of the x-axis shows always the 1 day data (and the data points adjusted to the correct positions according to their timestamp). Any extra data (not fitting to the current timescale) should be accessible via pages (with Chart.Page).

My Chart is working at the moment so that I can select the timescale from various possibilities, but it only affects on the "density" of the x-axis labels; e.g. if time scale 1 minute is selected, the timestamp label is shown every minute, and if 1 hour is selected, the timestamp label shows every hour. BUT it has no effect on the x-axis scaling.

Posted: Tue May 24, 2005 9:01 am
by narcis
Hello Mike,

You may use TChart1.Axis.Bottom.SetMinMax as in the VB code below:

Code: Select all

Private Sub Command1_Click()
    TChart1.Axis.Bottom.SetMinMax 0, 5
End Sub

Private Sub Command2_Click()
  With TChart1.Axis.Bottom
    .SetMinMax .Minimum - 5, .Maximum - 5
  End With
End Sub

Private Sub Command3_Click()
  With TChart1.Axis.Bottom
    .SetMinMax .Minimum + 5, .Maximum + 5
  End With
End Sub

Private Sub Command4_Click()
    TChart1.Axis.Bottom.SetMinMax TChart1.Series(0).Count - 6, TChart1.Series(0).Count - 1
End Sub

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 20
    TChart1.Axis.Bottom.SetMinMax 0, 5
End Sub
There's an example of this using DateTime labels at the TeeChart features demo available at the TeeChart program group, searching for "setminmax".