Google visualization 谷歌图表你能用另一种方式拆分数组吗?
据我所知,这是一种制作折线图的方法,在谷歌图表中是这样的:Google visualization 谷歌图表你能用另一种方式拆分数组吗?,google-visualization,Google Visualization,据我所知,这是一种制作折线图的方法,在谷歌图表中是这样的: data.addRows( [ // change strings to Dates (year, month), where months are zero-indexed [new Date(2013, 0), 5, 2, 1], [new Date(2012, 11), 2, 0, 2], [new Date(2012, 10), 5, 1,
data.addRows(
[
// change strings to Dates (year, month), where months are zero-indexed
[new Date(2013, 0), 5, 2, 1],
[new Date(2012, 11), 2, 0, 2],
[new Date(2012, 10), 5, 1, 3]
]);
上面将生成三行…行1:5->2->5,行2:2->0->1和行3:1->2->3。这对我来说是不合逻辑的。我想写一行这样的句子……第一行:
data.addRows(
[
// change strings to Dates (year, month), where months are zero-indexed
[new Date(2013, 0), 5],
[new Date(2012, 11), 2],
[new Date(2012, 10), 5]
]);
然后第2行:
data.addRows(
[
// change strings to Dates (year, month), where months are zero-indexed
[new Date(2013, 0), 2],
[new Date(2012, 11), 0],
[new Date(2012, 10), 1]
]);
等等,我的例子是错误的。但我希望您明白我的意思,并且您可以找到一种方法来进行更友好的查询。原因还在于我的日期会有所不同。所以我需要一个长数组,里面有很多空值
我希望你能帮助我:)谢谢你的回答……我对javascript不是很在行,但它看起来确实是一个解决方案!再次感谢。