Hi,
I am currently working on a script that generates a report onto a web page. Basically I read the data from a text file and generate 3 lines for a chart.
My problem is the chart sometimes takes over 2 mintues to generate. The first line on the chart contains over 6,000 points. But the second and third lines are just straight lines. I cant figuere out a way to generate the straight lines using only 2 or 3 points instead of 6000 (this would greatly speed up my chart). Any ideas?
I'm not sure if there is a better way to do this to speed it up, but any suggestions would be greatly apprectiated. My code is posted below. If its confusing and you have any questions just ask, I did my best to make it comprehendable. Thanks alot,
Paul
'Read the contents of the file.
i = 0
Set ts = fs
penTextFile(xfilename, ForReading)
Do While ts.AtEndOfline <> True
xdata(i) = CDbl(ts.ReadLine)
ydata(i) = i
plustoldata(i) = .001 'data for first straight line
minustoldata(i) = -.001 'data for second straight line
i = i+1
Loop
ts.Close
nooflines=CInt(i) 'holds the total number of data points
'plot the data
With MSChart1
.chartType = 16 'x-y scatter
'This sets the # of rows in the chart
.RowCount = nooflines
' line#1
CurSeries = 1
'This sets the number of columns per row.
'We need to increase the ColumnCount. For X-Y Scatter graphs, we
'need 2 columns for each series.
.ColumnCount = CurSeries * 2
.ColumnLabelCount = CurSeries * 2
'Both of the next 2 lines seem to do the same thing:
.Plot.SeriesCollection(CurSeries * 2 -1).SeriesMarker.Show = False
.Plot.SeriesCollection.Item(CurSeries * 2 - 1).SeriesMarker.Show = False
'Create the plot points for this series from the arrays:
For i = 1 To nooflines
.DataGrid.SetData i, CurSeries * 2 - 1, ydata(i-1), False
.DataGrid.SetData i, CurSeries * 2, xdata(i-1)*.001, False
Next
.Column = CurSeries * 2 - 1
'line #2 (first straight line)
CurSeries = 2
.ColumnCount = CurSeries * 2
.ColumnLabelCount = CurSeries * 2
'Both of the next 2 lines seem to do the same thing:
.Plot.SeriesCollection(CurSeries * 2 - 1).SeriesMarker.Show = False
.Plot.SeriesCollection.Item(CurSeries * 2 - 1).SeriesMarker.Show = False
'Create the plot points for this series from the arrays:
For i = 1 To nooflines
.DataGrid.SetData i, CurSeries * 2 - 1, ydata(i-1), False
.DataGrid.SetData i, CurSeries * 2, plustoldata(i-1), False
Next
.Column = CurSeries * 2 - 1
'line #3 (second straight line)
CurSeries = 3
.ColumnCount = CurSeries * 2
.ColumnLabelCount = CurSeries * 2
'Both of the next 2 lines seem to do the same thing:
.Plot.SeriesCollection(CurSeries * 2 - 1).SeriesMarker.Show = False
.Plot.SeriesCollection.Item(CurSeries * 2 - 1).SeriesMarker.Show = False
'Create the plot points for this series from the arrays:
For i = 1 To nooflines
.DataGrid.SetData i, CurSeries * 2 - 1, ydata(i-1), False
.DataGrid.SetData i, CurSeries * 2, minustoldata(i-1), False
Next
.Column = CurSeries * 2 - 1
End With
I am currently working on a script that generates a report onto a web page. Basically I read the data from a text file and generate 3 lines for a chart.
My problem is the chart sometimes takes over 2 mintues to generate. The first line on the chart contains over 6,000 points. But the second and third lines are just straight lines. I cant figuere out a way to generate the straight lines using only 2 or 3 points instead of 6000 (this would greatly speed up my chart). Any ideas?
I'm not sure if there is a better way to do this to speed it up, but any suggestions would be greatly apprectiated. My code is posted below. If its confusing and you have any questions just ask, I did my best to make it comprehendable. Thanks alot,
Paul
'Read the contents of the file.
i = 0
Set ts = fs
Do While ts.AtEndOfline <> True
xdata(i) = CDbl(ts.ReadLine)
ydata(i) = i
plustoldata(i) = .001 'data for first straight line
minustoldata(i) = -.001 'data for second straight line
i = i+1
Loop
ts.Close
nooflines=CInt(i) 'holds the total number of data points
'plot the data
With MSChart1
.chartType = 16 'x-y scatter
'This sets the # of rows in the chart
.RowCount = nooflines
' line#1
CurSeries = 1
'This sets the number of columns per row.
'We need to increase the ColumnCount. For X-Y Scatter graphs, we
'need 2 columns for each series.
.ColumnCount = CurSeries * 2
.ColumnLabelCount = CurSeries * 2
'Both of the next 2 lines seem to do the same thing:
.Plot.SeriesCollection(CurSeries * 2 -1).SeriesMarker.Show = False
.Plot.SeriesCollection.Item(CurSeries * 2 - 1).SeriesMarker.Show = False
'Create the plot points for this series from the arrays:
For i = 1 To nooflines
.DataGrid.SetData i, CurSeries * 2 - 1, ydata(i-1), False
.DataGrid.SetData i, CurSeries * 2, xdata(i-1)*.001, False
Next
.Column = CurSeries * 2 - 1
'line #2 (first straight line)
CurSeries = 2
.ColumnCount = CurSeries * 2
.ColumnLabelCount = CurSeries * 2
'Both of the next 2 lines seem to do the same thing:
.Plot.SeriesCollection(CurSeries * 2 - 1).SeriesMarker.Show = False
.Plot.SeriesCollection.Item(CurSeries * 2 - 1).SeriesMarker.Show = False
'Create the plot points for this series from the arrays:
For i = 1 To nooflines
.DataGrid.SetData i, CurSeries * 2 - 1, ydata(i-1), False
.DataGrid.SetData i, CurSeries * 2, plustoldata(i-1), False
Next
.Column = CurSeries * 2 - 1
'line #3 (second straight line)
CurSeries = 3
.ColumnCount = CurSeries * 2
.ColumnLabelCount = CurSeries * 2
'Both of the next 2 lines seem to do the same thing:
.Plot.SeriesCollection(CurSeries * 2 - 1).SeriesMarker.Show = False
.Plot.SeriesCollection.Item(CurSeries * 2 - 1).SeriesMarker.Show = False
'Create the plot points for this series from the arrays:
For i = 1 To nooflines
.DataGrid.SetData i, CurSeries * 2 - 1, ydata(i-1), False
.DataGrid.SetData i, CurSeries * 2, minustoldata(i-1), False
Next
.Column = CurSeries * 2 - 1
End With