Repository navigation
docs: explain the size and the plugins of a chart in the FAQ - #1379
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1168.
Changes
The size of a chart. The FAQ page suggested
maintainAspectRatio: falsetogether with thewidthandheightprops, which a responsive chart does not keep, and said nothing about the container. It now explains the two ways to size a chart:position: relativeand a height;responsive: falsewith thewidthandheightprops.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
pluginsarray does not change an existing chart. The page shows two ways around it: pass changing values throughoptions.plugins.<id>, or switch plugins with akey. It is in the sidebar and in the FAQ list.Checked locally
responsive: falsekeeps 400×200;options.plugins.<id>values reach the plugin without recreating the chart;pluginsarray is ignored;keycreates the chart with the new plugins.🤖 Generated with Claude Code