Skip to content

docs: explain the size and the plugins of a chart in the FAQ - #1379

Merged
dangreen merged 2 commits into
masterfrom
docs/faq-size-and-plugins
Nov 30, 2026
Merged

dangreen merged 2 commits into
masterfrom
docs/faq-size-and-plugins

Conversation

@dangreen

Copy link
Copy Markdown
Collaborator

Fixes #1168.

Changes

  • The size of a chart. The FAQ page suggested maintainAspectRatio: false together with the width and height props, which a responsive chart does not keep, and said nothing about the container. It now explains the two ways to size a chart:

    • a container of its own with position: relative and a height;
    • responsive: false with the width and height props.

    It also warns that a chart sharing its parent element with other content grows without end, which is [Bug]: Massive memory leak with maintainAspectRatio with bar graphs #1168.

  • New FAQ page: "Why doesn't the chart use new plugins?" Chart.js takes the plugins when it creates the chart, so a new plugins array does not change an existing chart. The page shows two ways around it: pass changing values through options.plugins.<id>, or switch plugins with a key. It is in the sidebar and in the FAQ list.

Checked locally

  • Sizes, checked in Chrome with plain Chart.js 4.6.2 and 4.3.0:
    • a container of its own, 300px high, gives a chart 300px high;
    • responsive: false keeps 400×200;
    • a canvas that shares a flex, grid or block parent with a button grows by about 330px a second on both versions.
  • Plugins, checked on the wrapper with a temporary test that is not committed:
    • new options.plugins.<id> values reach the plugin without recreating the chart;
    • a new plugins array is ignored;
    • a changed key creates the chart with the new plugins.
  • Website. It builds with 0 errors. Both pages were checked in Chrome, and so were the previous and next links of the new page.

🤖 Generated with Claude Code

The FAQ suggested `maintainAspectRatio: false` with the width and height props, which a responsive chart does not keep, and said nothing about the container. A chart that shares its parent element with other content grows without end, as in #1168.
Chart.js takes the plugins of a chart when it creates the chart. The new FAQ page shows how to pass changing values through the options of a plugin, and how to switch plugins with a key.
@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.97%. Comparing base (094fa63) to head (0c25936).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1379   +/-   ##
=======================================
  Coverage   93.97%   93.97%           
=======================================
  Files           3        3           
  Lines          83       83           
  Branches       20       20           
=======================================
  Hits           78       78           
  Misses          3        3           
  Partials        2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dangreen
dangreen marked this pull request as ready for review November 30, 2026 22:36
@dangreen
dangreen merged commit b7f8865 into master Nov 30, 2026
11 checks passed
@dangreen
dangreen deleted the docs/faq-size-and-plugins branch November 30, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Massive memory leak with maintainAspectRatio with bar graphs

1 participant