Jump to content
Software FX Community

Problem with set step of X Axis as date and time.


User (Legacy)

Recommended Posts

Hi there,

I am plotting several curve against time. The data are from SQL Server

with ADO. Following is the related code:

dim conn,chart, rs, strSQL

dim BeginDate, EndDate

'Create object

Set Chart = Server.CreateObject("ChartFX.WebServer")

Set conn = Server.CreateObject("ADODB.Connection")

conn.Open(".....")

Set rs = Server.CreateObject("ADODB.Recordset")

'Set time sector

BeginDate="3/19/2001 0:0:0"

EndDate="3/19/2001 1:0:0"

'Create readset

strSQL="SELECT date, p1, p2 FROM table1 WHERE date BETWEEN beginDate and

endDate"

rs.Open strSQL,conn,adOpenForwardOnly,adLockReadOnly

'X-Y Plot

chart.DataType(0)=CDT_XVALUE

for i=1 to 2

chart.DataType(i)=CDT_VALUE

next

chart.AdoResultSet rs

'Assign x axis parameters

chart.Axis(AXIS_X).Max=cdate(beginDate)

chart.Axis(AXIS_X).Min=cdate(endDate)

chart.Axis(AXIS_X).Format = AF_TIME 'Display in unit of hour

Response.Write chart.GetHtmlTag(750,400,"PNG")

The time step of above chart's X axis is 2 hour 24 minute. I would like to

set the time step to 2 hours or 3 hours. Any body know how to do it, please

give me a hand.

Thank you in advance for your help.

Peter Hao

Link to comment
Share on other sites

  • 6 months later...

I think it is quite simple:

XAxis.Step = TimeSerial(3,0,0)

"Peter Hao" <peterh@promore.com> wrote in message

news:R8zDI2yr8GA.1696@webserver1.softwarefx.com...

> Hi there,

>

> I am plotting several curve against time. The data are from SQL Server

> with ADO. Following is the related code:

>

> dim conn,chart, rs, strSQL

> dim BeginDate, EndDate

>

> 'Create object

> Set Chart = Server.CreateObject("ChartFX.WebServer")

> Set conn = Server.CreateObject("ADODB.Connection")

> conn.Open(".....")

> Set rs = Server.CreateObject("ADODB.Recordset")

>

> 'Set time sector

> BeginDate="3/19/2001 0:0:0"

> EndDate="3/19/2001 1:0:0"

>

> 'Create readset

> strSQL="SELECT date, p1, p2 FROM table1 WHERE date BETWEEN beginDate and

> endDate"

> rs.Open strSQL,conn,adOpenForwardOnly,adLockReadOnly

>

> 'X-Y Plot

> chart.DataType(0)=CDT_XVALUE

> for i=1 to 2

> chart.DataType(i)=CDT_VALUE

> next

>

> chart.AdoResultSet rs

>

> 'Assign x axis parameters

> chart.Axis(AXIS_X).Max=cdate(beginDate)

> chart.Axis(AXIS_X).Min=cdate(endDate)

> chart.Axis(AXIS_X).Format = AF_TIME 'Display in unit of hour

>

> Response.Write chart.GetHtmlTag(750,400,"PNG")

>

> The time step of above chart's X axis is 2 hour 24 minute. I would like

to

> set the time step to 2 hours or 3 hours. Any body know how to do it,

please

> give me a hand.

>

> Thank you in advance for your help.

>

> Peter Hao

>

>

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...