I have an array of objects which I\'ve created by parsing a JSON string:
var measurementData = @Html.Raw(JsonConvert.SerializeObject(this.Model.Item1));
You can use "setValue(rowIndex, columnIndex, value)" method:
var jsonData = '[{"SlideId":"D2011", "InstrumentId":"I335", "IncMin":"37.13", "IncMax": "37.19", "BrMin":"31.4"}, {"SlideId":"D2014", "InstrumentId":"I335", "IncMin":"37.13", "IncMax": "37.19", "BrMin":"31.4"}]';
var parsedData = JSON.parse(jsonData);
var len = parsedData.length;
var data = new google.visualization.DataTable();
data.addColumn('string', 'TimeStamp');
data.addColumn('number', selectedMeasurements);
data.addRows(len);
for (var n = 0; n < len; n++) {
var i=0;
for (var key in parsedData[n]) {
data.setValue(n, i, parsedData[n][key]);
i++;
}
}
chart.draw(data, options, {
isStacked: true,
vAxis: {
viewWindowMode: 'explicit',
viewWindow: {
max: 100,
min: 0
}
}
});
http://jsfiddle.net/mblenton/qnusuLtn/2/