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

multiple charts in Flexbox not the same size #8409

Closed
robske110 opened this issue Feb 10, 2021 · 4 comments
Closed

multiple charts in Flexbox not the same size #8409

robske110 opened this issue Feb 10, 2021 · 4 comments

Comments

@robske110
Copy link

Expected Behavior

Multiple charts should be the same size in a flex with the same grow and shrink parameters.

Current Behavior

Charts are different size
image

Possible Solution

unknown

Steps to Reproduce

Multiple charts in a Flexbox row with equal grow and shrink
https://jsfiddle.net/rmp67bd4/1/

Context

I am trying to use Flexbox to quickly layout many doughnut charts in a grid pattern.

Environment

@kurkle
Copy link
Member

kurkle commented Feb 10, 2021

Adding flex-basis: 30% helps quite a lot (for 3 charts):
https://jsfiddle.net/x9byLr82/1/ (v3, but it seems to work the same)

@ba55ie
Copy link

ba55ie commented Feb 11, 2021

Or use css grid:

I don't think this is bug (related to Chart.js).

@LeeLenaleee
Copy link
Collaborator

Its not a chartjs issue, if you resize the area fast it makes some canvases bigger, verry inconsistent. But every time the chart is rendered to the max the canvas is allowed

@robske110
Copy link
Author

Yes, I think this is simply undefined behaviour from the browsers side, since every chart can technically "fit itself" into any space. If there is nothing that can be done from the chartjs side to mitigate this, I think simply specifying the width (be it with css grid, flex-bases or good old width: 33%) is probably fine.

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

4 participants