I tooled around with it for a while... the timeplot data seems to support
JSON, but the timeline integration does not.
<snip>
timeplot = Timeplot.create(document.getElementById("TIMEPLOT"),
plotInfo);
eventSource.loadPlotData(plot_data); // JSON data
eventSource2.loadXML(xml_events, ''); // XML data
</snip>
I used a Java servlet to generate the timeplot JSON data and then used a
combination of DOJO and an xml.js library to generate the XML data for the
timeline.
<snip>
var xml_events;
for (var i = 0; i < lastQuery.adcalls.length; i++)
{
var adcall = lastQuery.adcalls[i];
var referral = lastQuery.adcalls[i].referrals[0];
var response = referral.responses[0];
var row = new Array(4);
row[0] = adcall.date; // Add date
row[1] = adcall.time; // Add adcall time
row[2] = referral.time; // Add referral time
row[3] = response.time; // Add response time
// Add row to timeplot data
plot_data[global_plot_data.length] = row;
:
//ellided
:
var attr_str = '{start: "' + adcall.tl_date + '", ' +
'title: "Test #' + (global_event_count++) + '", ' +
'link: "' + escape(referral.url) + '"}';
var attrs = eval('(' + attr_str + ')');
var desc = response.type + ' (' + response.length + ' bytes)';
xml_events += elementNL(
'event',
desc,
attrs
);
}
// Prepare XML
var xml_txt = '<data>\n' + xml_events + '</data>';
// alert(xml_txt);
var parser=new DOMParser();
var eventsXMLDoc=parser.parseFromString(xml_txt,"text/xml");
// update Timplot
if (plot_data.length > 1) {
updateTimePlot(plot_data, eventsXMLDoc, width, height);
}
</snip>
The updateTimePlot function calls standard timeplot creation calls as per
the top of this email.
On Fri, Mar 6, 2009 at 7:18 AM, Adam N <[email protected]> wrote:
>
> Has anybody extended Timeplot to handle different data sources
> (specifically JSON)? I'm new to the project so I'll probably just
> convert my data to the text format available - but I'd prefer to use
> JSON since everything I would typically spit out is JSON .
>
> Thanks.
> >
>
--
Scott Thomson
0401 726 889
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---