I need to build some reports for a cakePHP system I have been building and google charts seems to be the easiest way to get some charts happening.
How do I go about getting the cakePHP data into the chart records? I have only just started by using the sample code on google charts info pages.
e.g.
<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();
data.addColumn('string', 'Staff Member');
data.addColumn('number', 'Current');
data.addColumn('number', 'Competed');
data.addColumn('number', 'Overdue');
data.addRows([
['2004', 1000, 400, 100],
['2005', 1170, 460, 100],
['2006', 660, 1120, 100],
['2007', 1030, 540, 100]
]);
var options = {
title: 'Task Status Summary',
hAxis: {title: 'Staff Member', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<div id="chart_div" style="width: 1000px; height: 500px;"></div>
Thanks
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Tuesday, March 27, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment