Hi,

A bit of backround.  I work with Plone 4.2.4 (CMS) and Python and wanted to 
integrate Google Charts with an Oracle back end.  Plone already has a very 
nice package called EEA.Daviz <http://plone.org/products/eea.daviz>.  
However, it was way more than I needed and I thought I could do it on my 
own, so I created some page templates and Python code that wraps the 
Javascript.  On my laptop (Mac OS X) it all worked fine.

However, once I pushed it to my server (SLES 10), BarCharts stopped 
working.  I have only tested Bar, Line and Motion charts.  All I get is a 
red error box that says "e[0].K is undefined".  After googling around, I 
found a very similar description of my problem 
here<http://www.sebdangerfield.me.uk/2010/08/b0-is-undefined-error-when-using-googles-visualization-api/>that
 suggests it is a Google Visualization error and the fix is to change 
the width and height properties.  However, changing the height or width did 
not fix it.  What is very strange is that, if I copy the example JS from 
the BarChart 
page<https://developers.google.com/chart/interactive/docs/gallery/barchart>and 
copy it into a vanilla Zope Page Template, it works just fine.  
However, once I wrap it in the master template (ie my theme for non-Plone 
folks), I get the red error message again.

So I am confused.  I have the same theme installed on my laptop and it did 
not give me any problems.  I know I can display BarCharts on the server 
without the theme in a vanilla Page Template.  The one suggestion

Can anyone point me in the right direction?  


ZPT that Works:

<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi";></script>
<script>
google.load("visualization", "1", {packages:["corechart"]});
                                google.setOnLoadCallback(drawChart);
                                function drawChart() {
var data = google.visualization.arrayToDataTable([
['COUNTRY', ' COUNT'],
['Austria', 19],
['Belgium', 73],
['Bosnia-Herzegovina', 4],
['Bulgaria', 20]]
                  ); var options = {
                     title: 'Test Bar Chart'}; var chart = new 
google.visualization.BarChart(document.getElementById('chart_div'));
                  chart.draw(data, options);}
</script>
</head>

  <body>
    <div id="chart_div" style="width: 900px; height: 1000px;"></div>
</body>
</html>

ZPT that does NOT work:

<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal";
      xmlns:metal="http://xml.zope.org/namespaces/metal";
      xmlns:i18n="http://xml.zope.org/namespaces/i18n";
      lang="en"
      metal:use-macro="context/main_template/macros/master"
      i18n:domain="plone">

<metal:main fill-slot="javascript_head_slot">
<script type="text/javascript" src="https://www.google.com/jsapi";></script>
<script>
google.load("visualization", "1", {packages:["corechart"]});
                                google.setOnLoadCallback(drawChart);
                                function drawChart() {
var data = google.visualization.arrayToDataTable([
['COUNTRY', ' COUNT'],
['Austria', 19],
['Belgium', 73],
['Bosnia-Herzegovina', 4],
['Bulgaria', 20]]
                  ); var options = {
                     title: 'Test Bar Chart'}; var chart = new 
google.visualization.BarChart(document.getElementById('chart_div'));
                  chart.draw(data, options);}
</script>
</metal:main>

  <body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main">

    <div id="chart_div" style="width: 900px; height: 1000px;"></div>

</tal:main-macro>
</metal:main>    
</body>
</html>



-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to