I see. Thanks. Then is it possible to dynamically add decorators?

Alvin

On 10/27/2011 12:16 PM, Michael Nosal wrote:
Yes, this is possible, and quite easy to do.
You do need to add a method to set the times for your decorator and call 
.paint() on the decorator:

Timeline.SpanHighlightDecorator.prototype.setEndDate = function(date) {
        this._endDate = date;
};
Timeline.SpanHighlightDecorator.prototype.setStartDate = function(date) {
        this._startDate = date;
};
Timeline._Band.prototype.getDecorators = function() {
        return this._decorators;
}

Then you can do:
var myDecorator = tl.getBand(0).getDecorators()[0];
var ns = new Date("Nov 22 1963 13:35:00");
var ne = new Date("Nov 22 1963 14:05:00");
myDecorator.setStartDate(ns);
myDecorator.setEndDate(ne);
myDecorator.paint();

Try this on the JFK example and you'll see the shot/t.o.d. decorator shift by 
five minutes without having to rebuild the entire timeline.
It is a simple matter to update all your decorators dynamically this way, or to 
update them with dynamic data from a server.

--Mike

On Oct 27, 2011, at 8:20 AM, Alvin wrote:

Hello, I am wondering if there is a way to update the highlighted
parts of the timeline dynamically (i.e., update the decorators)?  I
got it to work by re-creating the entire timeline but that
unfortunately will also recenter the timeline.  Thanks.

--
You received this message because you are subscribed to the Google Groups "SIMILE 
Widgets" group.
To post to this group, send email to simile-widgets@googlegroups.com.
To unsubscribe from this group, send email to 
simile-widgets+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en.



--
You received this message because you are subscribed to the Google Groups "SIMILE 
Widgets" group.
To post to this group, send email to simile-widgets@googlegroups.com.
To unsubscribe from this group, send email to 
simile-widgets+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en.

Reply via email to