javascript - AmCharts 折线图动画

标签 javascript animation amcharts

是否可以在 AmCharts 中以动画方式显示正在绘制的线(通过连接项目符号或从左到右顺序绘制线)?

我已经尝试过 startDurationstartEffectsequencedAnimation 属性,但所有选项似乎都将整条线动画化为整个,要么从顶部滑下,要么在进入时弹起。它比没有动画要好,并且非常适合柱形图/条形图,但对于折线图来说它看起来有点奇怪和不自然。

Here is the relevant documentation for AmCharts .

最佳答案

是的,您可以按照绘制的方式为 amchart 制作动画。 您可以使用 CSS 来做到这一点:

#chartdiv{
width       : 100%;
height      : 500px;
}

.amcharts-graph-g1 { //g1 is the id of your graph
  stroke-dasharray: 500%;
  -webkit-animation: am-draw 5s;
  animation: am-draw 5s;
}

@keyframes am-draw {
    0% {
        stroke-dashoffset: 500%;
    }
    100% {
        stroke-dashoffset: 0%;
    }
}

查看此链接:https://www.amcharts.com/demos/css-animations/

关于javascript - AmCharts 折线图动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26222176/

相关文章:

javascript - Google Pagespeed 中的 "above-the-fold content"是什么?

javascript - 使用 AngularJS 而不是 jQuery 动画警报

amCharts 4 - 如何禁用滚动条以防止缩放和平移

javascript - amcharts 交互式 map : making selected states a clickable link

javascript - 如何保护 Socket.IO?

javascript - 我如何断言一个函数有 `await` 使用 should.js 编辑了一个异步函数

javascript - 如何使输入按钮(键盘)在 IE8 的表单中正常工作?

jquery - 使用 jQuery 将随机值应用于动画持续时间

css - ReactJS 关键 Prop 在 CSS 动画中不起作用

javascript - AmCharts 股票图表 : remove Compare to selection box