Re: [Simile-Widgets] timeline: Dynamically Changing events displayed

2011-05-19 Thread Michael Nosal
You can change events at any time after they have been loaded.
The events are accessible through the EventSource object.

Timeline doesn't have event setters, but they are easy enough to add:
jQuery.extend(Timeline.DefaultEventSource.Event.prototype,{
setStart:   function(start) {if (start != null) this._start = 
start;},
setEnd: function(end) { if (end != null) this._end = end;}
});

Once you have access to the individual event, you can change any of the 
properties of the object and then have the timeline repaint.

For example, given:
var eventSource = new Timeline.DefaultEventSource();
...
tl.loadXML(events.xml,function(xml,url) {
eventSource.loadXML(xml,url);
}
Your events are now painted on your timeline.

Then to update an event, first get the EventSource object where it lives:
var  es = tl.getBand(1).getEventSource();

You can access specific events by id:
es.getEvent(e1)

or use an event iterator to iterate over all the events:
es.getAllEventIterator()

You can also get an iterator to return events between a pair of dates.

Now you can call:
var e = es.getEvent(e1); // get a specific event by its id
e.setStart(new Date(02/14/2011 12:45));
e.setEnd(new Date(02/14/2011 17:30)

When you have finished changing your events, just call paint() on your timeline:
tl.paint();

You can easily add additional event setters, for event text, description, etc. 
if you need to update more properties than just start/end.

--Mike


On May 19, 2011, at 12:01 PM, Udo Loeb wrote:

 Hi!
 
 I guess this is something that I also tried to figure out recently, so 
 I'd like to clear this, hopefully its useful for others, too:
 
 What I (and maybe espressoguy) try to do is, change an event, that is 
 already loaded / painted, in other words:
 1. You load events with certain specs with loadXML.
 - They will be painted onto the timeline.
 2. Then you want to change an event, that is already painted.
 
 Is this possible?
 
 I tried to add a condition / check to the event loading, that simply 
 clears / deletes events that are already painted, but I ran into 
 problems, as events are painted again and again, depending on user 
 interactions like scrolling.
 
 As far as I see there is no feature like updateEvent or 
 changeEventProperties provided, or am I wrong?
 
 Thanx for any feedback,
 
 kind regards,
 
 Udo

-- 
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.



Re: [Simile-Widgets] timeline: Dynamically Changing events displayed

2011-05-16 Thread Michael Nosal
What do you mean by dynamically change?
If you mean simply loading different datasets at initialization time, then it 
is a simple call to loadXML (or loadJSON):
 tl.loadXML(examples/jfk/jfk.xml, function(xml, url) { 
eventSource.loadXML(xml, url); });
You just specify the path to the desired data file: examples/jfk/jfk.xml
This could be a path to some service on your server that returns dynamically 
generated data, such as incidentReports.xml?date=2011-05-16
You can also load your timeline data after the page has been loaded and the 
timeline drawn. You might have links on your page to let the user fetch 
different datasets.
Is this what you are referring to?

--Mike Nosal


On May 14, 2011, at 9:36 PM, espressoguy wrote:

 I'm new to timeline...
 
 I can see in the jfk example that is provided with the
 distribution of timeline that it's possible to dynamically change the
 events displayed.  But I don't see any documentation explaining how
 this works.  I'm sure it's done with AJAX but I don't see an
 explanation of how to do it.
 
   Can someone tell me where I can find an explanation?
 
 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.



[Simile-Widgets] timeline: Dynamically Changing events displayed

2011-05-14 Thread espressoguy
I'm new to timeline...

I can see in the jfk example that is provided with the
distribution of timeline that it's possible to dynamically change the
events displayed.  But I don't see any documentation explaining how
this works.  I'm sure it's done with AJAX but I don't see an
explanation of how to do it.

   Can someone tell me where I can find an explanation?

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.