javascript - Google Line Chart Adding Array of Objects -
i have array of objects i've created parsing json string: var measurementdata = @html.raw(jsonconvert.serializeobject(this.model.item1)); var stringifieddata = json.stringify(measurementdata); var parseddata = json.parse(stringifieddata); this gives me number of objects, depending on model, looking this: now question is, how add these google line chart without having hardcode datatable? this i've got now, works somewhat: var data = new google.visualization.datatable(); data.addcolumn('string', 'timestamp'); data.addcolumn('number', selectedmeasurements); data.addrows([ [parseddata[index[0]].timestamp, parseddata[index[0]][selectedmeasurements]], [parseddata[index[1]].timestamp, parseddata[index[1]][selectedmeasurements]] ]); chart.draw(data, options, { isstacked: true, vaxis: { viewwindowmode: 'explicit', ...