Thanks, Jon and LVS. I got it running after a fashion, but I have to
do some pretty klugy things, so I'm sure that my method is not the
best one.
To summarize, I load the events directly from my server in
tl.loadJSON(getTimelineURL, function(json, url) {
eventSource.loadJSON(json, url); })
This works to load and display the data. I need the start date and
end date, so I do that by making a separate call to the server (using
the YUI loadjson) and loop through the list of points to find the
earliest and latest dates.
Although this works, I cannot believe that it is necessary, so I am
still doing something that is less that optimal. Because of caching,
the second call to the server takes only a few milliseconds. So, I
can live with it.
When the URL is given in tl.loadJSON, it goes and fetches the data in
a RESTful / JSONic way and processes it. The disadvantage for me is
that the only data that can be in the JSON is the list of events.
Jon, I think I tried your suggestion, but it would certainly be worth
going back and retrying again. I tried so many things.
LVS, I have been making extensive use of the Firebug debugger. I
don't know how anyone could do this kind of stuff without it. It's
fabulous.
Thank you all for your help. I have another question, but I will put
that in a separate thread.
Thanks,
Herb
On Oct 5, 4:09 pm, Jon Crump <[email protected]> wrote:
> Herb, your line:
>
> var eventData = YAHOO.lang.JSON.parse(o.responseText)["timeline"]["events"]
>
> Seems to call the list of event objects. What you want is the object
> that has the 'events' property. I don't know how that yahoo parser
> works, but I think you should be calling the data object thus:
>
> var eventData = YAHOO.lang.JSON.parse(o.responseText)["timeline"]
>
> then your eventData variable will contain a js object with a key
> 'events' and a value that is a list of event objects
>
> As to your line:
>
> eventSource.loadJSON(eventData["timeline"], document.location.href);
>
> This may be superfluous, try proceeding without it. The
> eventSource.loadJSON method (sources.js in the api) goes to some
> lengths to derive a base url derived from document.location.href. I
> don't pretend to know how this method really works, but it may be that
> all you need to do is to
>
> 1. create an event source:
> var eventSource = new Timeline.DefaultEventSource()
>
> 2. define your themes, bands, decorators and such;
>
> 3. create a timeline instance:
> tl = Timeline.create(document.getElementById("clusTimeline"), bandInfos)
>
> (I don't think you need: Timeline.HORIZONTAL, it's the default I believe)
>
> 4. Load your data thus:
> tl.loadJSON(eventData, function(json, url) {
> eventSource.loadJSON(json, url); })
>
> I've never really understood how these methods work, but you may find
> it instructive to read carefully:
> Timeline.DefaultEventSource.prototype.loadJSON in sources.js
>
> and
> Timeline.loadJSON in timeline.js
>
> You'll probably understand what's going on in there better than I
>
> Jon
>
> On Mon, Oct 4, 2010 at 8:12 PM, herb <[email protected]> wrote:
> > Thanks Jon. This is what I did. It looks like a step in the right
> > direction, but maybe not far enough.
>
> > tl = Timeline.create(document.getElementById("clusTimeline"),
> > bandInfos, Timeline.HORIZONTAL);
>
> > eventSource.loadJSON(eventData["timeline"],
> > document.location.href);
>
> > tl.loadJSON(eventData["timeline"], function(json, url) {
>
> > eventSource.loadJSON(json, url); })
>
> > It showed the loading message, but then I got this error message
> > popping up:
> > Failed to load json data from [object Object]
> > Not Found
> > Near as I can tell, the tl.loadJSON tries to load the raw json
> > information from the server. When I replaced eventData["timeline"]
> > with the URL of my server call, it stopped complaining, but it still
> > did not show the events.
>
>
--
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
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.