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.