Example from
https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart
If I place this code in a standard .html view, it works fine-
<script>
jQuery(document).ready(function() {
setTimeout(function() {
// Google Visualization stuff goes here
function drawVisualization() {
// Some raw data (not necessarily accurate)
var data = google.visualization.arrayToDataTable([
['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua New Guinea',
'Rwanda', 'Average'],
['2004/05', 165, 938, 522,
998, 450, 614.6],
['2005/06', 135, 1120, 599,
1268, 288, 682],
['2006/07', 157, 1167, 587,
807, 397, 623],
['2007/08', 139, 1110, 615,
968, 215, 609.4],
['2008/09', 136, 691, 629,
1026, 366, 569.6]
]);
var options = {
title : 'Monthly Coffee Production by Country',
vAxis: {title: "Cups"},
hAxis: {title: "Month"},
seriesType: "bars",
series: {5: {type: "line"}}
};
var chart = new
google.visualization.ComboChart(document.getElementById("chart_div"));
chart.draw(data, options);
}
google.setOnLoadCallback(drawVisualization);
}, 0);
});
</script>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
...but if I move this code to a LOAD component, and call it from the view,
the graph is not rendered. I can't tell why this is and don't get any
helpful error msgs (eg in the web console).
It's also necessary to put these lines of code in the .html that calls the
LOAD component (not in the .load file)-
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
TIA for any pointers,
-jl
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.