0

我想知道如何将此数据集拆分为多个数组以用作 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
4

1 回答 1

0

你实际上可以有一个数组数组......

chartData(i,j)(k)

...但我真的不推荐它。除了“无法将我的大脑围绕它”问题之外,这是一种在服务器上耗尽内存的简单方法。

你能在循环中生成图表,即重复使用相同的变量吗?

于 2013-11-05T02:46:44.263 回答