Bharat
Bharat

Reputation: 139

Chart.js maxBarThickness is deprecated in angular 8

I am facing issue of deprecated methods:

Chart.js:1990 bar chart: "scales.[x/y]Axes.maxBarThickness" is deprecated. Please use "dataset.maxBarThickness" instead

How this can be resolved?

I was using following way to set maxBarThickness of bar graph dynamically

this.barOptions.scales.xAxes[0]['barPercentage'] = 0.8;

But this is throwing warnings now.

Please share your suggestions!

Upvotes: 2

Views: 2364

Answers (1)

uminder
uminder

Reputation: 26150

This property is no longer part of the xAxis but it can be set directly on the dataset as explained in dataset configuration.

Please also see example usage.

data: {
    datasets: [{
        barPercentage: 0.5,
        barThickness: 6,
        maxBarThickness: 8,
        minBarLength: 2,
        data: [10, 20, 30, 40, 50, 60, 70]
    }]
};

Upvotes: 6

Related Questions