To work properly you should place
<script type="text/javascript" src="https://www.google.com/jsapi";></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
    </script>
in layout.html, between head tags. This should load first.

Then rest of the script should go to .load file. Also note that, if you are 
running function with google.setOnLoadCallback(drawVisualization);, the 
function will not run if component is loaded after loading website. Because 
trigger for function is moment when website is loaded, and if you load with 
ajax after that moment has passed, there is no function to be triggered.

So to ensure that function is run after loading component you can use 
inside .load file

<div id="chart_div" style="width: 900px; height: 500px;"></div>
<script>
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);
</script>


-- 
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.

Reply via email to