chartjs / chartjs/Chart.js

Responsive charts with bootstrap (or probably any other layout system)

Open
#11,243 0 comments 1 reaction 0 assignees View on GitHub
type: documentation
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Documentation Is:

- [ ] Missing or needed?
- [ ] Confusing
- [X] Not sure?

### Please Explain in Detail...

The docs at https://www.chartjs.org/docs/latest/configuration/responsive.html suggest a way of responsive sizing based on the viewport size, which often isn't appropriate.

### Your Proposal for Changes

Using the `aspect-ratio` property it's possible to make a chart fit nicely within the parent container's width instead of the window size. `overflow: hidden` is also needed otherwise the height won't change and trigger a redraw.

```html




```

### Example

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.