Chartjs-Chart.Js Doughnut not calculating JSON data properly

0👍

I was constructing the JSON from PHP, something like:

    $data = $autoQuery->fetch_array();
    $autoData = array('CARS' => $data['CARS'],
                    'MOTORS' => $data['MOTORS'],
                    'BOATS' => $data['BOATS']);
    echo json_encode($autoData);

This wasn’t working. When I put intval() before each $data variable, it worked!

Leave a comment