getting array plsql in javascript

2

I created a cursor in pl, now I'm trying to pass the records to a array of the javascript to create graphics, newData will receive the cursor data.

Javascript created is this:

<html>
<head>
  <script type="text/javascript" src="https://www.google.com/jsapi"></script><scripttype="text/javascript">
    google.load("visualization", "1", {packages:["corechart"]});
    google.setOnLoadCallback(drawChart);
    function drawChart() {

     var dataTable = new google.visualization.DataTable();

     var newData = [['Ano', 'Vendas'],
        ['2004',  1000       ],
        ['2005',  1170],
        ['2006',  660],
        ['2007',  1030],
        ['2008',  1530]];


     // determine the number of rows and columns.
      var numRows = newData.length;
      var numCols = newData[0].length;

      // in this case the first column is of type 'string'.
      dataTable.addColumn('string', newData[0][0]);

      // all other columns are of type 'number'.
      for (var i = 1; i < numCols; i++)
        dataTable.addColumn('number', newData[0][i]);           

      // now add the rows.
      for (var i = 1; i < numRows; i++)
        dataTable.addRow(newData[i]);    

    var options = {
      title: 'Vendas anual'
    };

    var chart = new google.visualization.PieChart(document.getElementById('piechart'));

    chart.draw(dataTable, options);
  }
</script>

          

    
asked by anonymous 07.07.2015 / 20:10

0 answers