问题描述
当我将过去的数据复制到data.addRows方法时,它工作正常,但是当我试图创建条形图时,由于某种原因,将数据插入到 var rawData 即时接收中
给出的行大小不等于8表中的列)。
这是代码:
data.addColumn('number','Time');
data.addColumn('number','a');
data.addColumn('number','b');
data.addColumn('number','c');
data.addColumn('number','d');
data.addColumn('number','e');
data.addColumn('number','f');
data.addColumn('number','g');
data.addRows([[rawData]]);
,这是 console.log(rawData); 的值/ p>
[8,0,0,0,0,0,0,2],[9,0,0,3, 0,1,0,2],[10,0,0,20,0,1,0,7],[11,13,0,24,2,7,0,16],[12,0, 1,23,2,3,0,1],[13,2,4,31,2,0,0,6],[14,0,0,53,0,2,0,4],[ 15,0,1,57,2,2,0,13],[16,0,0,46,0,7,0,6],[17,0,0,61,0,0,0, 7],[18,0,0,15,3,2,0,3],[19,0,0,0,1,0,0,182],[21,0,2,0,0,0, 0,305],[23,0,0,0,0,6,0,1]
谢谢
而不是 im trying to create bar chart and but for some reason,it dosnt work. when i copy past data to data.addRows method it working fine but when i insert the data to var rawData im receiving this is the code: and this is the value of console.log(rawData); thanks miki instead of 这篇关于Google图表“行的尺寸不同于”当data.addRows来自var的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! rawData
已经被定义为数组的数组,所以你必须调用:
$ p $ data.addRows(rawData);
data.addRows([[RAWDATA]]);
Row given with size different than 8 (the number of columns in the table).
data.addColumn('number', 'Time');
data.addColumn('number', 'a');
data.addColumn('number', 'b');
data.addColumn('number', 'c');
data.addColumn('number', 'd');
data.addColumn('number', 'e');
data.addColumn('number', 'f');
data.addColumn('number', 'g');
data.addRows([[rawData]]);
[8,0,0,0,0,0,0,2],[9,0,0,3,0,1,0,2],[10,0,0,20,0,1,0,7],[11,13,0,24,2,7,0,16],[12,0,1,23,2,3,0,1],[13,2,4,31,2,0,0,6],[14,0,0,53,0,2,0,4],[15,0,1,57,2,2,0,13],[16,0,0,46,0,7,0,6],[17,0,0,61,0,0,0,7],[18,0,0,15,3,2,0,3],[19,0,0,0,1,0,0,182],[21,0,2,0,0,0,0,305],[23,0,0,0,0,6,0,1]
rawData
is already defined as array of arrays so you have to call:data.addRows(rawData);
data.addRows([[rawData]]);