So, I see a curious problem. If I have a function
var counter;
cycleCharts(chartId) {
console.log('chartId: ' + chartId);
if(typeof chartId == 'undefined' || chartId < 0) {
next = counter++;
}
else {
next = chartId;
}
}
This function can be called explicitly by user action, in which case it is chartIdpassed as an argument and the selected diagram is displayed; or it can be in autoplay mode, in which case it calls setInterval, which is initialized as follows:
var cycleId = setInterval(cycleCharts, 10000);
Strange, I actually see that cycleCharts()getting the argument chartId, even if it called out setInterval! setIntervaldoesn't even have parameters to pass the function cycleCharts, so I'm very puzzled by why chartIdnot undefined when cycleChartscalled from setInterval.
source
share