是否有Dygraph已加载事件? [英] Is there an Dygraph has loaded event?

查看:59
本文介绍了是否有Dygraph已加载事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在笔形图中的每个列上显示复选框.但是我不知道何时使用

I want to show checkboxes for every column in my dygraph. But I can't figure out when to get the names of my columns from dygraph using

g.getLabels().

当我知道图形已加载后,当我手动调用它时,它将起作用.但是我该如何自动化呢?我找不到"Dygraph.loaded"之类的事件或"Dygraph.hasLoaded"之类的属性.有什么方法可以轻松做到这一点吗?

It works when I call it manually after I know the graph has loaded. But how can I automate this? I couldn't find an event like "Dygraph.loaded" or a property like "Dygraph.hasLoaded". Is there some way to easily do this?

推荐答案

这是 .ready() 方法旨在:

This is what the .ready() method is designed to do:

g = new Dygraph(div, "/path/to/data.csv");
g.ready(function() {
  var labels = g.labels();
  ...
});

首次绘制图表后,将调用传递给 ready()的函数.

The function you pass to ready() will be called after the chart has been drawn for the first time.

如果将CSV数据或数组传递给Dygraphs构造函数,则将同步调用它.如果您传递一个URL,它将被异步调用.

If you pass CSV data or an array to the Dygraphs constructor, it will be called synchronously. If you pass a URL, it will be called asynchronously.

这篇关于是否有Dygraph已加载事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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