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");
},
...
}],
...
}
}
});
添加回答
舉報