I am trying to create a cycle/slider that has two google charts in it. I can display them separately on the page with the below code, but when space became premium I decided to go to slider/cycle. With the below code. The first chart draws but when the second scrolls into view. There is no chart. It only says: Unable to get property 'length' of undefined or null reference on Chrome: Cannot read property 'length' of null. I realize that when one chart is visible the other is not. But my unfamiliarity with javascript is making it hard to come up with an answer.
<script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> function drawCharts() { var data1 = google.visualization.arrayToDataTable(<% = jsostring%>); var options1 = { title: 'PSNL Weight Chart', backgroundColor: {fill:'none'} }; var data2 = google.visualization.arrayToDataTable(<% = jsostring2%>); var options2 = { title: 'PSNL Sleep Chart', backgroundColor: {fill:'none'} }; var chartA = new google.visualization.LineChart( document.getElementById('chart_div')); chartA.draw(data1, options1); var chartB = new google.visualization.ColumnChart( document.getElementById('chart_div2')); chartB.draw(data2, options2); } google.setOnLoadCallback(drawCharts); google.load("visualization", "1", { packages: [ "corechart"] }); </script> How can I change display:'block' to display:'none and back at the appropriate times. Any help would be much appreciated. -- You received this message because you are subscribed to the Google Groups "Google Chart 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-chart-api. For more options, visit https://groups.google.com/groups/opt_out.
