我想知道如何将此数据集拆分为多个数组以用作 HighCharts 折线图中的数据集
下面的 resultSet(0,i) 包含一个日期,而
resultSet(1,i) 包含一个值。
我希望能够根据日期的年份;
Year(resultSet(0,i)) 将数据集分解为 HighCharts 折线图的多个数据集。基本上像
if recordDate = Year(resultSet(0,i)) then
''populate recordSet1
recordSet1(i) = resultSet(1,i)
else
'if the records now have a new date
'add a year to the recordDate, since they are in chronological order in the resultset
recordDate = recordDate + 1
'do the check on that record now and add it to a new resultSet, then re-enter the loop and populate the new recordSet
if recordDate = Year(resultSet(0,i)) then
recordSet2(i) = resultSet(1,i)
end if
End If
但我想不出如何动态创建数组名称,以便我可以拥有多个记录集。
'Get CurrentYear to Compare Dataset To
dim CurrentYear
CurrentYear = Year(Date)
dim totalYears
dim recordDate
totalYears = (adoRsChart("yr_count") - 1)
recordDate = CurrentYear - totalYears
dim dateYearDiff
dim yAxisData()
dim xAxisData()
dim resultSet
resultSet = adoRsChart.GetRows()
For i = 0 to UBound(resultSet, 2)
reDim preserve xAxisData(i)
xAxisData(i) = resultSet(1,i)
response.write(resultSet(0,i) & "<br/>")
response.write(resultSet(1,i) & "<br/>")
response.write(resultSet(2,i) & "<br/>")
response.write(resultSet(3,i) & "<br/>")
reDim preserve yAxisData(i)
yAxisData(i) = "'" & resultSet(3,i) & "'"
Next