PHP表格值到图表[重复]

This question already has an answer here:

I want to display the values of my table in a chart but i dont know where to start. Is there any tutorial how to do this? I tried searching for same problems with me hoping to find any solution but i didnt get any

</div>

I suggest you to use Google charts:

<html>
  <head>
    <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([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]
        ]);

        var options = {
          title: 'Company Performance'
        };

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

Then change the values by making a DB query or reading from file.

For example, if we zoom in the drawChart() function:

function drawChart() {
    var data = google.visualization.arrayToDataTable([
        ['Year', 'Sales', 'Expenses'],
        <?php 
             for ($i = 2004; $i < 2008; $i++) { 
                $dataSet .= '[\'' . $i . '\', ' . rand(100, 1500). ', ' . rand(100,500) . '],';
             }
             echo substr($dataSet, 0, -1); //remove the last ,(comma) from array
        ?>
        ]);