I wonder how the p-property is supposed to work when sending JSON table row and column data to render.
I try to send {"p":{"title":"This is the title"}} but I can't get it to work.
Is it possible to set graph configuration options from JSON response?
Best regards,
Niclas
Found a solution. Don't know if it is the best out there but it works.
On the server. Add p properties to the JSON data. In this case 'title'.
function drawChart() {
var jsonData = $.ajax({
url: "/statistics/getData",
dataType:"json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
var title = data.getTableProperty("title");
var chart = new google.visualization.ColumnChart(
document.getElementById('chart_div'));
chart.draw(data, {'title':title,
'width':800,'height':300});
}
精彩评论