Chartjs-I want to use an object to help create a chart with Chartjs

0👍

I just figured it out! Chartjs expects object literals (ie, { ….. }), but I was returning an object literal along with its curly braces, inside of a { } container. So, it ended up looking something like this:

{
    {
    label: 'Diastolic',
    data: <?php echo(json_encode($diastolic)); ?>,
    backgroundColor: "rgba(76, 245, 112, 1)",
    borderColor: "rgba(76, 245, 112, 1)",
    fill: false
    }
}

Those outer curly braces can’t be there. I think I understand this correctly. 🙂

Leave a comment