【问题标题】:counting function for anychart labels任意图表标签的计数功能
【发布时间】:2016-11-02 16:19:27
【问题描述】:

我有一个使用 anychart.js 制作的饼图

JSFiddle

我想要实现的是在页面加载时使图表上的标签“计数”。我有一个工作的 javascript 示例位于 Here

这是我用来实现这一点的代码

$(document).ready(function () {
    $('.count').each(function () {
    $(this).prop('Counter', 0).animate({
        Counter: $(this).text()
    }, {
        duration: 4000,
        easing: 'swing',
        step: function (now) {
            $(this).text(Math.ceil(now));
        }
    });
});
});

我只是不知道如何将它附加到饼图的标签上。

【问题讨论】:

    标签: anychart


    【解决方案1】:

    如果切换到 7.12.0 可以开箱即用动画:http://jsfiddle.net/jqqgf5r1/7/

        chart.animation(true);
    

    【讨论】:

    • 啊啊啊太棒了。不是我要寻找的标签,但我没有意识到饼图有加载动画。非常感谢!
    【解决方案2】:

    不确定我是否理解您想要实现的目标,但我希望此示例对您有所帮助 http://jsfiddle.net/jqqgf5r1/10/

        // update progress values in data to random values every 500ms
        setInterval(function() {
            var pointsCount = data.getRowsCount();
                    for (var i = 0; i < pointsCount; i++) {
            chart.data().set(i, 'progress', Math.ceil(Math.random() * 100));
          }
        }, 500); 
    

    【讨论】:

      猜你喜欢
      • 2020-02-17
      • 1970-01-01
      • 1970-01-01
      • 2017-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-11
      相关资源
      最近更新 更多