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

Charts are given a fixed width, even when they are set to be responsive #108

Closed
devmattrick opened this issue May 14, 2017 · 2 comments
Closed

Comments

@devmattrick
Copy link

Expected Behavior

Charts would resize based on the size of their parent container.

Actual Behavior

Charts are (by default) 400x400px in size. This is set as an HTML attribute rather than a CSS size. This is the markup that it generates and this is how I am using vue-chartjs.

Environment

  • vue.js version: 2.2.6
  • vue-chart.js version: 2.6.3
  • npm version: 4.5.0
@apertureless
Copy link
Owner

If you set the responsive attribute to true, Chartjs will automatically set the width and height of the canvas according to the outer container. If you resize the container or your window, you will see, that these numbers change.

That your charts are per default 400x400 must be related to your outer containers.

As you see in this codepen it resizes.

@devmattrick
Copy link
Author

Ah I see, if the chart is in a container which is not explicitly set to be 100% wide, it won't force its container to fill its parent. Thanks for the quick reply and sorry for taking your time!

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

2 participants