Chartjs 3.x 迁移指南关于动画不工作的说明

Chartjs 3.x Migration Guide notes on animation not working

当我正在为使用 Chartjs 创建的图表更新代码时,我使用了迁移指南:

https://www.chartjs.org/docs/next/getting-started/v3-migration.html

写的大部分内容都有效,但我似乎对特定更改下写的一些要点有问题,准确地说是这两个:

responsiveAnimationDuration 现在配置在 animation.resize.duration

hover.animationDuration 现在配置在 animation.active.duration

所以这是我代码中的结构:

new Chart(
    // ...
    options: {
        // ...
        animation: {
            resize: {        // IDE already complaining here that 'resize' does not exist
                duration: 0,
            },
            active: {        // Same problem here
                duration: 0,
            },
        },
    },

我使用的是 3.5.1 版本,如果有帮助的话

我是否遗漏了什么或者我做错了什么? 还有其他人遇到过这个问题吗?

您可以将 animation 设置为 false:

options: { 
    animation: false,
    ...

您可以在 Disabling animation.

阅读更多内容