简体   繁体   English

折线图渲染后的回调

[英]Callback after line chart rendered

I implement charts 2 libraries in my project.我在我的项目中实现了图表 2 库。 it's working well.它运作良好。 I want to show an alert message after the line chart rendered completely.我想在折线图完全呈现后显示一条警告消息。 is there any callback function or anything else?有没有回调function之类的? how can I show a message after the line chart displayed?折线图显示后如何显示消息?

I want to do like before chart render showing loader at the end displayed chart I want to hide that loader.我想像在图表渲染显示加载器之前那样在显示的图表末尾显示我想隐藏该加载器。

You can use onComplete callback function of animation.您可以使用动画的onComplete回调函数。 This will be called after the chart (animation) is completely rendered.这将在图表(动画)完全呈现后调用。

options: {
   animation: {
      onComplete: function() {
         alert('Line Chart Rendered Completely!');
      }
   },
   ...
}

if you want to run your logic only for one time after render,如果你只想在渲染后运行你的逻辑一次,

options: {
   animation: {
      onComplete: function(chart) {
      if(chart.initial){
         alert('do something here only for one time after render');
      }

      }
   },
   ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM