Chartjs-Can't create multiple charts with Chart JS

0👍

maybe you can try like this

//setup
const data = {
    labels: <?=  json_encode($datesForChart) ?>,
    datasets: [{
        label: <?= json_encode($viewData['selectedCurrency1']) ?>,
        data: <?= json_encode($ratesForChartCurrency1) ?>,
        borderWidth: 1
    },
    {
        label: <?= json_encode($viewData['selectedCurrency2']) ?>,
        data: <?= json_encode($ratesForChartCurrency2) ?>,
        borderWidth: 1
    }]
};

// config
const config = {
    type: 'line',
    data,
    options: {
        scales: {
            y: {
                beginAtZero: false
            }
        }
    }
};

Leave a comment