2015-11-29 202 views
0

我是新来的,当我的图表在页面加载时自动启动,所以我的问题是如何延迟动画,直到它变成视图端口,这是什么代码,也是在哪里准确地把它放在chart.js?延迟动画chart.js

谢谢。

+0

看看这个问题 - http://stackoverflow.com/q/33356826/360067 – potatopeelings

+0

是的,我看到了这一点,但是因为我提到了我的JS技能,所以我只能在chart.js中使用此代码(或下面)来使其工作。 – wessam

回答

1

您首先需要安装:chartjs-插件递延here 然后添加到您的项目

plugins: { 
    deferred: {   // enabled by default 
     xOffset: 150,  // defer until 150px of the canvas width are inside the viewport 
     yOffset: '50%', // defer until 50% of the canvas height are inside the viewport 
     delay: 500  // delay of 500 ms after the canvas is considered inside the viewport 
    } 
}