Chartjs-How to fix [<br /> when trying to enter data through php in data (chart.js)

1👍

It seems issue at your javascript code..it is not converting the php array to javascript properly.

try this:

<script type='text/javascript'>
var ctx = document.getElementById('myChart').getContext('2d');
var labels = '<?php echo json_encode($Timers); ?>';

var myChart = new Chart(ctx, {
    type: 'line',
    data: {
        labels: labels,
        datasets: [{
            label: 'Time',
            data: [<?php echo $Wheights; ?>],

1👍

<br /> is part of php error, that doesn’t show completely in rendered html.

if you want to see actual error, you can see page source (Ctrl+u).

Leave a comment