AnsweredAssumed Answered

TimeSlider not show  info

Question asked by gmonzon on Aug 28, 2015
Hello, I want to implement the esri.dijit.TimeSlider .  But when I click the button that shows the  div that contains the TimeSlider  and after played, my base map does not show the behavior that I wanted.
What I doing wrong?
 
My  code is like 
function initSlider() {
    try{   
            var timeSlider = new esri.dijit.TimeSlider({
                style: "width: 100%;"
            }, dojo.dom.byId("timeSliderDiv"));
            map.setTimeSlider(timeSlider);
 
            var timeExtent = new esri.TimeExtent();
            timeExtent.startTime = new Date("01/01/2015".replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3")); //new Date("01/01/2015 UTC");
            timeExtent.endTime = new Date("08/31/2015".replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3")); //new Date("08/31/2015 UTC");
            timeSlider.setThumbCount(2);
            timeSlider.createTimeStopsByTimeInterval(timeExtent, 1, "esriTimeUnitsWeeks");
            timeSlider.setThumbIndexes([0, 1]);
            timeSlider.setThumbMovingRate(2000);
            timeSlider.startup();
 
            //add labels for every other time stop
            var labels = dojo._base.array.map(timeSlider.timeStops, function (timeStop, i) {
                //if ( i % 2 === 0 ) {
                return timeStop.getUTCFullYear();
                //} else {
                return "";
                //}
            });
 
            timeSlider.setLabels(labels);
 
            timeSlider.on("time-extent-change", function (evt) {
                var startValString = evt.startTime.getUTCFullYear();
                var endValString = evt.endTime.getUTCFullYear();
                dojo.dom.byId("daterange").innerHTML = "<i>" + startValString + " and " + endValString + "<\/i>";
            });
              
    }
        catch (e) {
            console.log("ExcepTion : initSlider : " + e);
            HideProgress();
    }
 
}
 

My code button is :

time = dojo.connect(map, 'layers-add-result', initSlider);

Outcomes