Select to view content in your preferred language

How to programmatically change the timeExtent of a Map when you a timeSlider?

1542
1
Jump to solution
05-28-2013 09:09 PM
DevdattaTengshe1
Deactivated User
I have a time-aware layer in in my map, and also a timeslider. The full time extent of the map is a year, with data every month.

I want that when the map loads, the data is shown for that particular month, and the slider is also on that month.

I can programatically set the timeExtent on the map, using map.setTimeExtent(), but the timeslider does not auto-update to this date.

How should the timeExtent to be set, so that the timeSlider auto-updates  along with it?

To see an reproducible example, go to the sample: http://help.arcgis.com/en/webapi/javascript/arcgis/samples/time_sliderwithdynamiclayer/index.html, and open up your firebug/developer console, and enter
map.setTimeExtent(map.timeSlider.fullTimeExtent);
The map will show you data for the entire period, but the time slider does not update.
0 Kudos
1 Solution

Accepted Solutions
DevdattaTengshe1
Deactivated User
I had cross-posted this on GIS.Stackexchange, and I got an answer there.

Basically, I was going about it the wrong way. Instead of setting the timeExtent on the map, I needed to set the time slider to a specific position, and the map will be automatically updated to that time extent.

To do this, I just needed to set the ThumbIndex on the slider, using the following code:

// Assuming time slider has a single time thumb timeSlider.setThumbIndexes([4]); 

View solution in original post

0 Kudos
1 Reply
DevdattaTengshe1
Deactivated User
I had cross-posted this on GIS.Stackexchange, and I got an answer there.

Basically, I was going about it the wrong way. Instead of setting the timeExtent on the map, I needed to set the time slider to a specific position, and the map will be automatically updated to that time extent.

To do this, I just needed to set the ThumbIndex on the slider, using the following code:

// Assuming time slider has a single time thumb timeSlider.setThumbIndexes([4]); 
0 Kudos