1

任意のファイルまたは配列からヒストグラムを描画するために Google 視覚化 API を実装しようとしています。csv データを含む配列を機能に打ち込もうとしていますが、 google.visualization.arrayToDataTable()機能していません。この関数を1つではなくリアルタイムデータに使用する方法を知っている人はいますか? 以下はグーグルからの例です:

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

この機能でそれが不可能な場合は、他の提案があります。また、スケーラビリティの問題により d3 を使用できません。

4

0 に答える 0