0

I have used the chartjs 2.8 and drew a Bar chart using the same. There is one rectangle coming above the chart with filled color (https://i.stack.imgur.com/Kh0pl.jpg). I have tried multiple ways to remove that but fails.

I have tried the below code but no luck.

legend: {
    display: false,
}

Here is my current code

var ctx = document.getElementById("myChart").getContext('2d');
    var myChart = new Chart(ctx, {
        type: 'bar',
        data: chartData1,
        options: {
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero: true
                }
            }]
        }
    }
});

Could you anyone please tell me how to remove that?

Amol Rokade
  • 145
  • 1
  • 11

1 Answers1

2

It should be this, if it doesnt work you aren't on version 2 or something else is wrong.

var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, {
    type: 'bar',
    data: chartData1,
    options: {
        legend: {
            display: false,
        },
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero: true
                }
            }]
        }
    }
});
Deckerz
  • 2,606
  • 14
  • 33