Skip to content
Advertisement

PaddingLeft of afterFit does not work during chart.js option

I want padding at the beginning of the X-axis as shown in the image below.

But padding doesn’t work in my code.

What’s the matter?

enter image description here

My Chart Screen

enter image description here

Chart.js Version 2.9.4

here is code

html

JavaScript

javascript

JavaScript

I want padding at the beginning of the X-axis as shown in the image below.

But padding doesn’t work in my code.

What’s the matter? paddingLeft is not working..plz

Advertisement

Answer

You are doing nothing wrong, it seems like it is a bug in chart.js. version 2.4.0 is the latest version I can see it works in.

Working example:

JavaScript
JavaScript
JavaScript

fiddle link: https://jsfiddle.net/Leelenaleee/dxrm918n/2/ Filed an issue for this on there git: https://github.com/chartjs/Chart.js/issues/8344

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement