Below is my code snippet. Please help


<html>
<head>
<script type="text/javascript"
src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  <script type="text/javascript" 
src="https://www.google.com/jsapi";></script>
  <script type="text/javascript">
    google.load('visualization', '1.1', {packages: ['line', 'corechart']});
    google.setOnLoadCallback(drawChart);
    function drawChart() {
  $.ajax({
                    type : "POST",
                    url : "MYURL",
                    data: { chartType: "myLineChart"} ,                   
                    success : function(response) {
                        alert(response);
/* This is the Data I am returning from Server, which is reflected in 
server logs and alert.
[ [2,  12, 20, 22, 19, 23],
  [4,  12.2, 18, 20, 17, 21.5],
  [6,  12.3, 17.5, 18.2, 16.7, 19.2],
  [8,  12.4, 15, 15, 14, 17],
  [10,  12.5, 12, 11.5, 11.2, 12.5],
  [12,  12.6, 10, 9.8, 9.7, 11.2],
  [14,  12.5, 9.5, 9, 8.7, 9.5]]
*/
 var data = new google.visualization.DataTable();
      data.addColumn('number', 'Month');
      data.addColumn('number', 'Option1');
      data.addColumn('number', 'Option2');
      data.addColumn('number', 'Option3');
  data.addColumn('number', 'Option4');
  data.addColumn('number', 'Option5');

    /*  data.addRows([
        [2,  12, 20, 22, 19, 23],
[4,  12.2, 18, 20, 17, 21.5]       
      ]);*/
data.addRows(response);
      var options = {
        chart: {
          title: 'My Title'
         
        },
        width: 600,
        height: 450,
        axes: {
          x: {
            0: {side: 'top'}
          },
  y: {
            0: {label: 'USD'}
          }
        }
      };

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

      chart.draw(data, options); 
                    }
                });


     
  
    }
  </script>
</head>
<body>
<table border="2">
<tr><td><div id="mydiv"></div></td></tr>
</table>
  
  
</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 google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.
  • [visualization-api] Googl... Pankaj Goud

Reply via email to