设置动画速度 - ChartJS? [英] Set Animation speed - ChartJS?

查看:12
本文介绍了设置动画速度 - ChartJS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在chartJS中设置饼图的动画速度.

I am trying to set the animation speed of a pie chart in chartJS.

我尝试了以下方法:

  1. numSteps: 数字

  1. numSteps: Number

动画步骤:数字

Chart.defaults.global.animationSteps = Number

Chart.defaults.global.animationSteps = Number

这些都没有改变速度.有什么建议吗?

None of these have changed the speed. Any advice?

 var myNewChart;
    var data = [
        {
        value: 30,
        label: "hello",
        color: "#F7464A"
      }, {
        value: 50,
        color: "#E2EAE9"
      }, {
        value: 100,
        color: "#D4CCC5"
      }, {
        value: 40,
        color: "#949FB1"
      }, {
        value: 100,
        color: "#4D5360"
      },
    
    ];
    
    
    var options = {
      animation: true,
      animationEasing: 'easeInOutQuart',
      animationSteps: 80,
      multiTooltipTemplate: "<%= datasetLabel %> - <%= value %>"
    
    };
    
    
    var ctx = document.getElementById("myChart")
                                        .getContext("2d");
    
    myNewChart = new Chart(ctx).Doughnut(data, options);

推荐答案

使用 Chart.defaults.global.animation.duration = 3000;

这篇关于设置动画速度 - ChartJS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆