如何在chart.js折线图中包含数据数组

时间:2015-02-27 04:48:04

标签: php arrays chart.js

我已经设置了以下代码来获取数组数据[];但我不知道如何将这些数组放入chart.js行代码

$data[] = array(substr($row['CHANGE_DATE'], 5), $lastMax, $lastMin);

我想用X轴绘制一个线路聊天为CHANGE_DATE,Y轴:$ lastMax,$ lastMin


Chart.js代码

  <script>
        // line chart data
        var buyerData = {
            labels : ["January","February","March","April","May","June"],
            datasets : [
            {
                fillColor : "rgba(172,194,132,0.4)",
                strokeColor : "#ACC26D",
                pointColor : "#fff",
                pointStrokeColor : "#9DB86D",
                data : [203,156,99,251,305,247]
            }
        ]
        }
        // get line chart canvas
        var buyers = document.getElementById('buyers').getContext('2d');
        // draw line chart
        new Chart(buyers).Line(buyerData);

0 个答案:

没有答案