我想在更新时间线时向用户显示加载屏幕
我在 R 中使用基于 vis.js 时间线构建的 timevis 库。由于我展示了很多点,因此对象可能需要一段时间才能显示,我希望用户知道这一点。
我尝试使用来自shinycssloaders的withSpinner - 它仅在第一次绘制时间线时有效(当用户更改控件并要求更新时我重新绘制)。
我注意到一些晦涩的代码似乎正在运行: https://visjs.github.io/vis-timeline/examples/timeline/other/loadingScreen.html.
在其他地方找不到任何相关文档。
当我将其添加到我的代码中时似乎不起作用。
timevis (data = data, groups = dataGroups,
options = list (stack = (nrow (dataGroups) == 1),
orientation = list (axis = "both"),
loadingScreenTemplate = "function() {return '<h1>Loading...</h1>' }"))
})```
Nothing shows up during loading. The image displays in full when done.
Vis Timeline 似乎有一个 bug,因此当
loadingScreenTemplate()
中未设置 end
时,options
不起作用,并且如果您使用 setOptions()
也不起作用。
但是,当您使用
new vis.Timeline()
构造函数创建时间线并在 end
中设置 options
时,它确实有效。
查看本例源码:https://visjs.github.io/vis-timeline/examples/timeline/other/loadingScreen.html