Hi,
I have a json encoded array ($dataTable) that looks like this:
{"cols":[{"type":"string","label":"Analys"},{"type":"string","label":"Test 1"},{"type":"string","label":"Test 2"}],
"rows":[{"c":[{"v":"Top"},{"v":"78"},{"v":"71"}]},{"c":[{"v":"In"},{"v":"88"},{"v":"91"}]},{"c":[{"v":"Pref"},{"v":"60"},{"v":"72"}]},{"c":[{"v":"Int"},{"v":"13"},{"v":"9"}]}]}
I think that's right but when I try to display the graph it says "table has no columns"...
Copied from google I have this in my head section:
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable(<?php echo $dataTable; ?>);
var options = {
title: 'Company Performance',
hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
and ofcourse in the body section I have a <div id="chart_div"></div>.
Does anybody here have experience of google charts and maybe could give me some hints to what might be the problem?
Take care!
Adam