Animation doesn't work if I change the size of pie chart
- Vorherrschende Sprache
- JavaScript
- Sterne
- 67.7k
- Forks
- 11.9k
- Ø Merge
- 7 Std. 39 Min.
- Gemergte PRs (30 T.)
- 5
Beschreibung
### Documentation Is:
- [x] Missing or needed?
- [x] Confusing
- [ ] Not sure?
### Please Explain in Detail...
When I change the size of my chart animation and reload the page, the animation sometimes doesn’t work. I tested different sizes and found that it only works reliably when the size is a multiple of 4. After hours of investigation, I realized this happens because my devicePixelRatio (DPR) is 1.25.
With a fractional DPR, Chart.js calculates the chart radius as a non-integer. When the canvas tries to draw the animation, the browser rounds the size, which triggers a resize internally. As a result, the animation does not play.
I think this behavior should be mentioned in the Chart.js documentation, as it can be confusing for developers.
### Your Proposal for Changes
Write about this behaviour in documentation
### Example
_No response_
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne damit, den Abschnitt der Chart.js-Dokumentation zu finden, der die Größenänderung von Diagrammen, die Canvas-Größe oder Animationen behandelt, und überprüfe dann, wo das Verhalten von devicePixelRatio bei gebrochenen Werten derzeit beschrieben wird. Aktualisiere die relevante Dokumentation, um zu erklären, dass eine nicht ganzzahlige Größenangabe die Animation nach einem Neuladen verhindern kann; abgeschlossen ist die Aufgabe, wenn Entwickler die mit DPR zusammenhängende Einschränkung und ihre Auswirkungen verstehen können.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100