Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Afterfit adjusting axis not working as intended #8344

Closed
LeeLenaleee opened this issue Jan 26, 2021 · 5 comments
Closed

Afterfit adjusting axis not working as intended #8344

LeeLenaleee opened this issue Jan 26, 2021 · 5 comments

Comments

@LeeLenaleee
Copy link
Collaborator

LeeLenaleee commented Jan 26, 2021

Before version 2.5.0 in the afterFit callback of an axis you could change the padding so the chart would start later:
image

Since 2.5.0 and in the new beta this doesnt work anymore, the value is changed if I log it in the console but it doesnt change the chart

Expected Behavior

Adjust the axis with the new values.

Current Behavior

ignoring the new values

Steps to Reproduce

Working 2.4.0: https://jsfiddle.net/Leelenaleee/dxrm918n/2/
Not working 2.9.4: https://jsfiddle.net/Leelenaleee/t7ndrxk5/2/
Not working beta 9: https://jsfiddle.net/Leelenaleee/t09823kd/2/

Environment

  • Chart.js version: 2.9.4 and beta 9
  • Browser name and version: chrome latest stable build
@kurkle
Copy link
Member

kurkle commented Jan 26, 2021

Is it stated somewhere that afterFit would be the place for this kind of adjustement? It would seem logical it should be done in beforeFit.

Please add a reproduce of this.

@LeeLenaleee
Copy link
Collaborator Author

Mb putted them in a commented block, tried making it beforeFit but that also doesn't seem to work.

@kurkle
Copy link
Member

kurkle commented Feb 22, 2021

The beta9 with 100px padding left/right: https://jsfiddle.net/axwutk4c/

image

I guess the difference is, its calculated from the edge. And also the y-axis moves with the chart area.

@kurkle
Copy link
Member

kurkle commented Mar 2, 2021

Same applies to 2.9.4, the padding is used, if its greater than the required padding for labels.

@kurkle kurkle closed this as completed Mar 2, 2021
@pauloricca
Copy link

Has there been a solution or alternative for this? We would like to have the option to have some padding between the Y axis and the first X axis tick, but paddingLeft doesn't seem to work anymore.

I tried the "grace" property but doesn't seem to have any effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants