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

Excessive padding after updating to v3 when using pointHoverRadius and borderWidth #10394

Closed
arggh opened this issue Jun 3, 2022 · 6 comments

Comments

@arggh
Copy link

arggh commented Jun 3, 2022

Expected behavior

I would expect layout.padding = 0 to actually make padding 0.

Current behavior

When dataset uses pointHoverRadius and borderWidth, the padding is dramatically increased regardless of any padding settings. It can easily be seen that there's no reason to include that extra padding, as everything would easily fit on the canvas without any extra padding. Especially on mobile, this creates a very silly user experience.

The same effect, but with less dramatic outcome, can be observer when using pointHoverRadius and pointRadius.

Screenshot 2022-06-03 at 8 32 50

Reproducible sample

https://codepen.io/arggh/pen/JjpZJYG

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

v3.8.0

Browser name and version

Chrome 101

Link to your project

No response

@arggh arggh added the type: bug label Jun 3, 2022
@LeeLenaleee
Copy link
Collaborator

@arggh
Copy link
Author

arggh commented Jun 3, 2022

https://www.chartjs.org/docs/latest/configuration/layout.html

Setting autoPadding: false seems to remove the padding, but do @LeeLenaleee agree, that in the repro there's excessive padding around the chart?

Apply automatic padding so visible elements are completely drawn.

In the repro, there's a padding of about 40 pixels on both sides, with nothing drawn on the padded area.

@LeeLenaleee
Copy link
Collaborator

Seems to happen because of a configuration mistake.
The borderWidth is supposed to be a number. But you supplied it as a string.
This is not supported, if you supply it as a number it shows the chart normally fine

@arggh
Copy link
Author

arggh commented Jun 3, 2022

The borderWidth is supposed to be a number. But you supplied it as a string.

🤦‍♂️ You are very much correct. Thank you for noticing, problem solved.

@arggh arggh closed this as completed Jun 3, 2022
@kurkle
Copy link
Member

kurkle commented Oct 11, 2022 via email

@LeeLenaleee
Copy link
Collaborator

The autopadding was added in 3.6 as an enhancement (#9716) so it does not need to be in the migration guide since it was not breaking and was not between 2 major versions

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