i want to add the foreach in google line chart.

i will describe the data from aws dynamodb.

so, i use unmarshalItem.

but it doesnot work.

i don't know problem.

the result outputs blank in website. maybe 500 error. 
 

source code is as follows:


<html>
<head>
  <script type="text/javascript" 
src="https://www.gstatic.com/charts/loader.js";></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['line']});
      google.charts.setOnLoadCallback(drawChart);

    function drawChart() {
      var data = new google.visualization.DataTable();
      data.addColumn('number', 'id');
      data.addColumn('number', 'data');
      data.addRows([
        [1,100],[2,200],
//      data.addRows([

<?php
        foreach($iterator as $item) {
               $movie = $marshaler->unmarshalItem($item);
               echo "[".$movie['id'].",".$movie['data']."]".",";
         }
?>
        ]);



      var options = {
        chart: {
          title: 'Box Office Earnings in First Two Weeks of Opening',
          subtitle: 'in millions of dollars (USD)'
        },
        width: 900,
        height: 500,
        axes: {
          x: {
            0: {side: 'top'}
          }
        }
      };

      var chart = new 
google.charts.Line(document.getElementById('line_top_x'));

      chart.draw(data, google.charts.Line.convertOptions(options));

-- 
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/2596eb17-2fc8-4952-9ba5-bf5be2ae4b62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to