AnsweredAssumed Answered

Change layer definitions properly repeatedly

Question asked by piterpaulppp on Nov 21, 2016
Latest reply on Nov 22, 2016 by piterpaulppp

Hi,

 

We do time series "manually" for some reasons.

We created recursive function.

The issue is with changing of layer definitions repeatedly. The layer disappears between first and second (recursive) call to the function.

 

var isPlay = true;
var layerDefinitionsTS = [];

var currentTimeSeriesLayer = (initialized outside);
function PlayTimeSeries(startYear, endYear, timeIntervalMilliSeconds) {
   if (startYear == endYear)
      return;
   if (isPlay == false)
      return;
//layerDefinitionsTS = [];
      currentTimeSeriesLayer.setLayerDefinitions(null, true);

      layerDefinitionsTS[currentTimeSeriesLayer.visibleLayers[0]] = "Year = " + startYear;
      currentTimeSeriesLayer.setLayerDefinitions(layerDefinitionsTS, false);

      setTimeout(function (startYear, endYear, timeIntervalMilliSeconds) {
      startYear = startYear;
      console.log("Year: " + startYear);

      startYear = startYear + 1;

      PlayTimeSeries(startYear, endYear, timeIntervalMilliSeconds);
   }, timeIntervalMilliSeconds, startYear, endYear, timeIntervalMilliSeconds);
};

 

Any help will be appreciated.

Outcomes