0

I have set up the following code to get array data[]; but I don't know how to put those array in chart.js line code

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

I want to draw a line chat with X-axis as CHANGE_DATE, Y-axis: $lastMax, $lastMin


Chart.js code

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

4
  • stackoverflow.com/questions/17984772/… Commented Feb 27, 2015 at 4:56
  • what exactly are you trying to plot? your js code has 6 points set for data, and your php array appears to have the first value as a date, and the second 2 values as data points. you have 6 labels, which implies 6 different data sets. So I really have no idea what you are trying plot. Without any code, can you describe the chart you are trying to create? Commented Feb 27, 2015 at 5:00
  • Hello, i want to replace (1)["January","February","March","April","May","June"] with $row['CHANGE_DATE']; (2)[203,156,99,251,305,247] with $lastMin, and $lastMax Commented Feb 27, 2015 at 5:03
  • no body can help? domlai.com Commented Mar 23, 2015 at 6:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.