1

I am trying to implement google visualization api to draw histogram from any file or array. I am trying to punch in my array that contain the csv data into google.visualization.arrayToDataTable() function, but it is not working. Does anyone know how to use this function for not one but any real time data. Following is the example from google:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load("visualization", "1", {packages:["corechart"]});
  google.setOnLoadCallback(drawChart);
  function drawChart() {
    var data = google.visualization.arrayToDataTable([  // need this to get my any array which will be different as I am getting file from user in my program. 
      ['Dinosaur', 'Length'],
      ['Acrocanthosaurus (top-spined lizard)', 12.2],
      ['Albertosaurus (Alberta lizard)', 9.1],
      ['Allosaurus (other lizard)', 12.2],
      ['Apatosaurus (deceptive lizard)', 22.9],
      ['Archaeopteryx (ancient wing)', 0.9],
      ['Argentinosaurus (Argentina lizard)', 36.6],
      ['Baryonyx (heavy claws)', 9.1],
     
    var options = {
      title: 'Lengths of dinosaurs, in meters',
      legend: { position: 'none' }
    };

    var chart = new google.visualization.Histogram(document.getElementById('chart_div'));
    chart.draw(data, options);
  }
 </script>
<div id="chart_div" style="width: 900px; height: 500px;"></div>

If it is not possible with this function, anyone have any other suggestions. Also, I cant use d3 due to scalability issue.

Sam
  • 322
  • 1
  • 16
user3050590
  • 1,656
  • 4
  • 21
  • 40

0 Answers0