Jump to content
Software FX Community

RE: Scaling the X-Axis


Software FX

Recommended Posts

Using ChartFX IE 2000 this would be the code (I am also including this sample in the ChartFX IE 2000 support site under the Data tree)

<%

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

' Cosmetic

chart.RgbBk = RGB(255,255,255)

Chart.Chart3D = False

Chart.AllowDrag = False

' Set the chart type to lines (ChartFX will draw an XY chart if X values are provided)

Chart.Gallery = LINES

' hard-coded data using a fixed date and different times

' if the data was in a database you would generate a SQL statement that

' returns the data for an specific day

Chart.OpenDataEx COD_VALUES,1,3

Chart.OpenDataEx COD_XVALUES,1,3

dDate = DateSerial(1999,10,15)

Chart.XValueEx(0,0) = dDate + TimeSerial(8,5,10)

Chart.ValueEx(0,0) = 100

Chart.XValueEx(0,1) = dDate + TimeSerial(11,23,32)

Chart.ValueEx(0,1) = 105.5

Chart.XValueEx(0,2) = dDate + TimeSerial(16,09,00)

Chart.ValueEx(0,2) = 103.25

Chart.CloseData COD_XVALUES

Chart.CloseData COD_VALUES

Set XAxis = Chart.Axis(AXIS_X)

' Make sure the min and max are set with the specified date and the required

' times (8 AM to 4:30 PM)

XAxis.Min = dDate + TimeSerial(8,0,0)

XAxis.Max = dDate + TimeSerial(16,30,0)

' Set MinorStep to 30 minutes and Step to an hour

XAxis.MinorStep = TimeSerial(10,30,0) - TimeSerial(10,0,0)

XAxis.Step = TimeSerial(11,0,0) - TimeSerial(10,0,0)

' Set Display Format

XAxis.Format = "Thh:mm tt"

%>

<%= chart.GetHtmlTag(550,350) %>

Regards,

Juan Cegarra

Software FX, Inc.

http://support.softwarefx.com

-----Original Message-----

From: Darin Hutcheson [ mailto:dhutcheson@durlacher.com]

Posted At: Tuesday, October 26, 1999 11:00 AM

Posted To: Server

Conversation: Scaling the X-Axis

Subject: Scaling the X-Axis

Hi,

I want to create a chart to show a share price over a day. I want the X

Axis to go from 8:00am to 4:30pm.

The trouble I have is that before the end of the day, I do not have any data

points at 4:30pm. I also do not have a constant spacing between data points

e.g. I might have trades at 8:05, 8:45, 9:07, 9:08 which indicates I should

use a scatter chart. If I do, how can I show the time values on the X Axis?

I want a tick on the hour every hour.

Link to comment
Share on other sites

Using ChartFX IE 2000 this would be the code (I am also including this sample in the ChartFX IE 2000 support site under the Data tree)

<%

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

' Cosmetic

chart.RgbBk = RGB(255,255,255)

Chart.Chart3D = False

Chart.AllowDrag = False

' Set the chart type to lines (ChartFX will draw an XY chart if X values are provided)

Chart.Gallery = LINES

' hard-coded data using a fixed date and different times

' if the data was in a database you would generate a SQL statement that

' returns the data for an specific day

Chart.OpenDataEx COD_VALUES,1,3

Chart.OpenDataEx COD_XVALUES,1,3

dDate = DateSerial(1999,10,15)

Chart.XValueEx(0,0) = dDate + TimeSerial(8,5,10)

Chart.ValueEx(0,0) = 100

Chart.XValueEx(0,1) = dDate + TimeSerial(11,23,32)

Chart.ValueEx(0,1) = 105.5

Chart.XValueEx(0,2) = dDate + TimeSerial(16,09,00)

Chart.ValueEx(0,2) = 103.25

Chart.CloseData COD_XVALUES

Chart.CloseData COD_VALUES

Set XAxis = Chart.Axis(AXIS_X)

' Make sure the min and max are set with the specified date and the required

' times (8 AM to 4:30 PM)

XAxis.Min = dDate + TimeSerial(8,0,0)

XAxis.Max = dDate + TimeSerial(16,30,0)

' Set MinorStep to 30 minutes and Step to an hour

XAxis.MinorStep = TimeSerial(10,30,0) - TimeSerial(10,0,0)

XAxis.Step = TimeSerial(11,0,0) - TimeSerial(10,0,0)

' Set Display Format

XAxis.Format = "Thh:mm tt"

%>

<%= chart.GetHtmlTag(550,350) %>

Regards,

Juan Cegarra

Software FX, Inc.

http://support.softwarefx.com

-----Original Message-----

From: Darin Hutcheson [ mailto:dhutcheson@durlacher.com]

Posted At: Tuesday, October 26, 1999 11:00 AM

Posted To: Server

Conversation: Scaling the X-Axis

Subject: Scaling the X-Axis

Hi,

I want to create a chart to show a share price over a day. I want the X

Axis to go from 8:00am to 4:30pm.

The trouble I have is that before the end of the day, I do not have any data

points at 4:30pm. I also do not have a constant spacing between data points

e.g. I might have trades at 8:05, 8:45, 9:07, 9:08 which indicates I should

use a scatter chart. If I do, how can I show the time values on the X Axis?

I want a tick on the hour every hour.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...