Chartjs-Chart.js first bar is not showing

0đź‘Ť

âś…

To solve it, I scale the y axis to min value 0:

<script>
var barContratsIBS = {
    labels: ['Marché A', 'Marché B', 'Marché C'],
    datasets: [{
        label: 'Les études d’exécution',
        backgroundColor: '#660066',
        data: [7, 10, 8]
    }, {
        label: 'Les études de fabrication, l’approvisionnement et la fabrication',
        backgroundColor: '#660066',
        data: [5, 10, 8]
    }, {
        label: 'La livraison et le montage sur site',
        backgroundColor: '#660066',
        data: [6, 10, 8]
    }]
};

var _options = {
    scales: {
        yAxes: [{
            ticks: {
                suggestedMin: 0
            }
        }]
    }
};

var ctxContratsIBS = document.getElementById("canvasContratsIBS");
var myBarChart = new Chart(ctxContratsIBS, {
    type: 'bar',
    data: barContratsIBS,
    options: _options
});

Leave a comment