-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何动态创建或刷新图表 #4
Comments
请问,现在解决了吗? |
加个延时ok |
|
定时器不保险吧,写个返回函数的函数就行了 let chart = {}
page({
data: {
opts:{
onInit: () => {}
},
showChart: false
},
onLoad(options) {
// 请求完成后再生成初始化函数 加载图表
// 必须用wx:if控制图表 不然页面一加载就执行初始化了
const func = this.initChart(数据)
this.setData({
opts: {
onInit: func
},
showChart: true
})
},
initChart(data) {
/// 返回一个初始化函数
return function (canvas, width, height, F2) {
chart = new F2.Chart({
el: canvas,
width,
height
});
chart.source(data);
// ,......
chart.render();
return chart;
}
}
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
业务中有个需求
请问需要异步的获取数据后,创建或者刷新图表这种需求,正确的应该如何做?
The text was updated successfully, but these errors were encountered: