gwt - Inserting JSON in DataTable in Google Visualisation -
i read json can inserted datatable. however, done in js on html page (if memory serves right). using gwt- visualisation driver given here, , methods add row not designed json in mind. there work-able solution? trying make stacked column chart. thanks.
i struggled using geomap , data table combined. in workaround used evaljson() in prototype javascript framework make json string object.
var country_obj = country_data.evaljson(true);
then loop on object's length :
var data = new google.visualization.datatable(); data.addrows(country_obj.country.length); data.addcolumn('string', 'country'); data.addcolumn('number', map_context); var j = country_obj.country.length; ( = 0; < j; i++ ) { var num = new number(country_obj.country[i].geo_mstat_reads); data.setvalue(i, 0, country_obj.country[i].country_name); data.setvalue(i, 1, num.valueof()); } // , table.draw() data
this worked me because scales exact size of dataset trying show.
also can whole whack of operations on object makes life , coding easier read , write.
i hope helps problem.
Comments
Post a Comment