3👍
✅
according to the data table definition in the code, there are three columns…
var data = new google.visualization.DataTable();
data.addColumn('string', 'Month');
data.addColumn('number');
data.addColumn('number');
but from reading the question, sounds like you only need two…
var data = new google.visualization.DataTable();
data.addColumn('string', 'Month');
data.addColumn('number');
and to add a single row of values, the format should be…
['Month', 0]
to add all the rows, using addRows
, the format should be…
[
['Month', 0],
['Month', 12],
['Month', -12]
]
In your views context, change 'data' : data
to 'data': json.dumps(data)
It is crucial to use json either in javascript, or in view.
Source:stackexchange.com