Scott,

That will help alot.  It leads me to another question.  A little background:

I'm trying to create a voting app that shows the probability of a number of
outcomes happening historically.  I can pull that data as {datetime,score}
for each possible outcome and then normalize it in JS with the other scores
at that datetime so the probability of all the outcomes = 1 (or 100% -
however you want to say it).  This would require me to generate the file
whenever somebody requests it after somebody voted on that outcome.

Or, I can pull the data pre-normalized, but then it would be best to pull
the data like {outcome_id,datetime,normalized_score} which doesn't seem to
be something that timeplot can handle AFAIK.  This would be the functional
equivalent as the above situation but it's N-1 fewer queries where N is the
number of outcomes.

The third option is to simply generate a file for each possible outcome and
update it every time somebody requests the data after somebody else voted on
ANY outcome.

Have you or anybody else dealt with this kind of situation?

Thanks very much,
Adam

On Thu, Mar 5, 2009 at 5:08 PM, 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
>
>
> >
>


-- 
Adam Nelson

http://www.varud.com
http://twitter.com/varud
http://www.linkedin.com/in/adamcnelson

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