chartjs / chartjs/Chart.js

Pie Chart scales even if animation.animateScale = false when the container go from display:none to display:block

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

Description

### Expected behavior

Create a Pie Chart with this option: `animation: { duration: 1000, animateRotate: true, animateScale: false }`

If the Pie Chart is created inside a div with `display:none` (in my app, a Bootstrap Modal), when the div is set to `display:block`, the scale animation shouldn't run, and it does.

Here is a Code Pen with the problem : https://codepen.io/Fifi-Lulu/pen/jOdPXpZ

### Current behavior

The chart runs the scale animation when the div is set to `display:block` event if `animation.animateScale` is set to `false`

### Reproducible sample

https://codepen.io/Fifi-Lulu/pen/jOdPXpZ

### Optional extra steps/info to reproduce

_No response_

### Possible solution

Prevent the scale animation to run when the `display` style is changed from `none` to `block`

### Context

My Pie Charts are in a Bootstrap Modal. When the modal is shown the first time, the charts are scaled and it's ugly.

### chart.js version

v4.4.0

### Browser name and version

Chrome Version 117.0.5938.88 (Official Build) (64-bit)

### Link to your project

https://thememoriser.com

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.