1 回答
TA贡献1789条经验 获得超10个赞
不确定我是否理解正确,但无论如何我都会试一试。如果我错了,请告诉我。
您在循环中创建图表。您想要在回调中访问特定图表。
你为什么不访问oVizFrame你的回调?
首先,我会将 for 循环替换为forEach. forEach为数组中的每个元素调用给定函数:
aSubscriptions.forEach(function(oSubscription) {
const oModel = new JSONModel();
const chartData = oSubscription.NAV_SUBSCRIBED_LOGS.results;
...
}
在 for 循环中,您的变量被重用。在forEach函数中,为每个项目创建一个新范围。因此,当您oVizFrame在回调中访问时,它与oVizFrame您之前声明的相同。
然后你应该能够oVizFrame在你的回调中访问。
oVizFrame.setVizProperties({
plotArea: {
dataPointStyle: {
"rules": [{
callback: function(oContext, extData) {
// >>>>>>>> Do something with oVizFrame <<<<<<<<
that.checkValue(oContext, "S");
},
...
}, {
callback: function(oContext, extData) {
// >>>>>>>> Do something with oVizFrame <<<<<<<<
that.checkValue(oContext, "F");
},
...
}],
...
}
}
});
添加回答
举报