如果你想使用{v:2005,f:'2005'}
技巧,你不能使用ArrayToDataTable
,你需要稍微不同地定义 DataTable。您可以在这里看到类似的问题:
不工作的数据表:
var data = google.visualization.arrayToDataTable([
['Category', 'Amount'],
['Food', {v:5595.819984, f:'5.595,82'}],
['Home', {v:1890.530002, f:'1.890,53'}],
['Mail', {v:8.380000, f:'8,38'}],
['Train', {v:564.899998, f:'564,90'}],
['Photo', {v:959.119995, f:'959,12'}],
['Lego', {v:428.760004, f:'428,76'}],
工作数据表:
var data = google.visualization.DataTable();
data.addColumn('string', 'Category');
data.addColumn('number', 'Amount');
data.addRows([
['Food', {v:5595.819984, f:'5.595,82'}],
['Home', {v:1890.530002, f:'1.890,53'}],
['Mail', {v:8.380000, f:'8,38'}],
['Train', {v:564.899998, f:'564,90'}],
['Photo', {v:959.119995, f:'959,12'}],
['Lego', {v:428.760004, f:'428,76'}],
]);