Hi ,
I think first you should create a default EventSource object the it will
work
function onLoadw() {
var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [
Timeline.createBandInfo({
eventSource: eventSource,
date: "Jun 28 2006 00:00:00 GMT",
width: "70%",
intervalUnit: Timeline.DateTime.MONTH,
intervalPixels: 100
}),
Timeline.createBandInfo({
eventSource: eventSource,
date: "Jun 28 2006 00:00:00 GMT",
width: "30%",
intervalUnit: Timeline.DateTime.YEAR,
intervalPixels: 200
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
timeLine = Timeline.create(document.getElementById('my-timeline'),
bandInfos);
timeLine.loadXML("Example1.xml", function(xml, url) {
eventSource.loadXML(xml,url); });
}
i tried it and eventSource working file.
Hope it will help you.
On Friday, 3 October 2008 20:43:50 UTC+5:30, LarryK wrote:
>
>
> Hi,
>
> Your alert showed null since the timeline had not yet processed the
> xml events (you had not yet called eventSource.loadXML).
> The incoming xml (from your server) is in variable xml.
>
> Remember your goal (from your first message). You want to "manipulate
> the EventSource prior to it loading into timeline."
> ==>> I figured that what you meant by that was you wanted to change
> some of the values of the events as they come in from the xml file on
> your server.
>
> Set a breakpoint inside the function and look at the xml object.
> Use firebug with firefox to debug
>
> Look at
> http://simile-widgets.googlecode.com/svn/timeline/trunk/src/webapp/api/scripts/sources.js
>
> for an example of parsing the xml
>
> tl = Timeline.create(document.getElementById("tl"),
> bandInfos, Timeline.HORIZONTAL);
> tl.loadXML("jfk.xml", function(xml, url) {
> // look at or manipulate the xml variable here
> // set a breakpoint here
> eventSource.loadXML(xml, url); // loads the
> xml into the timeline
> });
>
>
> Good luck,
>
> Larry
>
>
> On Oct 3, 10:44 am, "g f" <[email protected]> wrote:
> > Thanks for the reply Larry,
> > So from your example it looks like I can get a handle on the xml prior
> > to actually loading the xml into the timeline?
> > If this is true then how?
> >
> > I tried:
> > tl = Timeline.create(document.getElementById("tl"),
> > bandInfos, Timeline.HORIZONTAL);
> > tl.loadXML("jfk.xml", function(xml, url) {
> > alert(eventSource.getEarliestDate());
> > eventSource.loadXML(xml, url);
> > });
> >
> > But It still returns null.
> >
> > Thanks for your help so far!
> >
> > On Wed, Oct 1, 2008 at 10:24 PM, LarryK <[email protected]> wrote:
> >
> > > Hi gf,
> >
> > > My understanding is that you can manipulate the xml in the callback
> > > function before calling eventSource.loadXML
> >
> > > example:
> > > tl = Timeline.create(document.getElementById("tl"),
> > > bandInfos, Timeline.HORIZONTAL);
> > > tl.loadXML("jfk.xml", function(xml, url) {
> > > // manipulate xml object here
> >
> > > // then call
> > > eventSource.loadXML(xml, url);
> > > });
> >
> > > Hope this helped,
> >
> > > Larry
> >
> > > On Oct 1, 8:13 pm, g f <[email protected]> wrote:
> > >> Hello all,
> > >> I have a need to manipulate the EventSource prior to it loading into
> > >> timeline.
> > >> Seems like this is not possible until the EventSource is actually
> > >> already loaded into timeline.
> > >> I tried alert(eventSource.getEarliestDate()) and received a null.
> >
> > >> My idea was to create a javascript XML DOM object from the XML String
> > >> and then do my manipulation and then call:
> > >> Timeline.loadXML(JAVASCRIPT_DOM_OBJECT, function(xml, url)
> > >> { eventSource.loadXML(xml, url); });
> >
> > >> Is this possible or perhaps is it possible to pass a String instead
> of
> > >> a JS_DOM_OBJ?
> >
> > >> I had seen a post a year or so ago and David had shown someone how to
> > >> pass the string but I cannot find that post.
> >
> > >> Thanks!
--
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/simile-widgets/-/wIqFm0nMD1cJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/simile-widgets?hl=en.