Chartjs-ChartJS sees date in string as numbers

1👍

The Problem with your code is that the echo will just output the content of the variable but as you are parsing it’s value into a javascript array you need to surround your value with quotation marks. So if you change

for ($i = 0; $i < count($data); $i++) {
    echo $data[$i] . ",";
}

into

for ($i = 0; $i < count($data); $i++) {
    echo "'" . $data[$i] . "',";
}

it should work. This will also solve your other problem. So with this change you should also be able to use the time.

Leave a comment