Hi Adam,

Here is an example of the XML data for the timeline data...

<data>
<event start='Mar 16 2009 09:37:05 GMT+1100' title='Test #4' link='http%3A//
view.atdmt.com/NOA/jview/128922611/direct%3Bwi.728%3Bhi.90/01%3Frand%3D409864%26click%3Dhttp%3A//webhostname/ADCLICK/CID%3D0001a6ac16f7708e00000000//SITE%3DSITE.NAME/AREA%3DAREA>NAME/AAMSZ%3D728x90/acc_random%3D409864/nolog/relocate'>text/html
(257 bytes)</event>
<event start='Mar 16 2009 09:37:09 GMT+1100' title='Test #5' link='http%3A//
view.atdmt.com/NOA/jview/128922611/direct%3Bwi.728%3Bhi.90/01%3Frand%3D4402851%26click%3Dhttp%3A//webhostname/ADCLICK/CID%3D0001a6ac16f7708e00000000//SITE%3DSITE.NAME/AREA%3DAREA.NAME/AAMSZ%3D728x90/acc_random%3D4402851/nolog/relocate'>text/html
(257 bytes)</event>
<event start='Mar 16 2009 09:37:10 GMT+1100' title='Test #6' link='http%3A//
bs.serving-sys.com/BurstingPipe/BannerSource.asp%3FFlightID%3D747459%26Page%3D%26PluID%3D0%26Pos%3D2604'>text/html
(257 bytes)</event>
</data>

Serialized JSON timeplot data for the same three data points is...

[
    [
        "2009-03-16 09:48:02",
        16,
        31,
        16
    ],
    [
        "2009-03-16 09:48:11",
        16,
        31,
        31
    ],
    [
        "2009-03-16 09:48:12",
        47,
        31,
        47
    ]
]

I hope this helps.

Cheers,
Scott

On Fri, Mar 6, 2009 at 9:08 AM, Scott Thomson <
[email protected]> wrote:

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



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

Reply via email to