Hi all,

Just created a function to show a chart with different php variables. This 
is the code:


*******************************
<script type="text/javascript">

// AREA CHART ///////////////
/////////////////////////////

google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
  ['Month', 'Test 1',               'Test 2',                'Test 3',     
      'Test 4',            'Test 5'],
  ['Jan',   <?print $ppja;?>, <?print $thja;?>, <?print $tgja;?>, <?print 
$dhja;?>, <?print $dgja;?>],
  ['Feb',   <?print $ppf;?>, <?print $thf;?>,          <?print $tgf;?>, <?print 
$dhf;?>,          <?print $dgf;?> ],
  ['Mar',   <?print $ppm;?>, <?print $thm;?>, <?print $tgm;?>, <?print 
$dhm;?>, <?print $dgm;?> ],
  ['Apr',   <?print $ppa;?>, <?print $tha;?>, <?print $tga;?>, <?print 
$dha;?>, <?print $dga;?> ],
  ['May',   <?print $ppma;?>, <?print $thma;?>, <?print $tgma;?>, <?print 
$dhma;?>, <?print $dgma;?> ],
  ['June', <?print $ppj;?>,        <?print $thj;?>,         <?print 
$tgj;?>,         <?print $dhj;?>,     <?print $dgj;?> ],
  ['July', <?print $ppJ;?>, <?print $thJ;?>, <?print $tgJ;?>, <?print 
$dhJ;?>, <?print $dgJ;?> ],
  ['Aug',   <?print $ppau;?>, <?print $thau;?>, <?print $tgau;?>, <?print 
$dhau;?>, <?print $dgau;?> ],
  ['Sep',   <?print $pps;?>, <?print $ths;?>, <?print $tgs;?>, <?print 
$dhs;?>, <?print $dgs;?> ],
  ['Oct',   <?print $ppo;?>, <?print $tho;?>, <?print $tgo;?>, <?print 
$dho;?>, <?print $dgo;?> ],
  ['Nov',   <?print $ppn;?>, <?print $thn;?>, <?print $tgn;?>, <?print 
$dhn;?>, <?print $dgn;?> ],
  ['Dec',   <?print $ppd;?>, <?print $thd;?>, <?print $tgd;?>, <?print 
$dhd;?>, <?print $dgd;?> ]

        ]);

        var options = {
          title:  Growth',
          hAxis: {title: '2013',  titleTextStyle: {color: 'green'}}
        };

        var chart = new 
google.visualization.AreaChart(document.getElementById('area_vm'));
        chart.draw(data, options);
      }
    </script>

</script>
<?php

print "<br><br>";
print "<div id='area_vm'></div>";
print "<br><br>";
?>

*******************************


Now if i replace all the <? print $variables; ?> with just straight numbers 
the chart works.

The variables are not empty, i can print them onscreen outside the 
function. On the same page i also have a Pie chart wich works correctly.
I think i'm missing something.

Any ideas ?

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