[jifty-devel] Chart plugin: Handling scripts in regions

Thomas Sibley trs at bestpractical.com
Sun Aug 5 16:02:33 EDT 2007


Andrew Sterling Hanenkamp wrote:
> Thomas,
> 
> I've done some clean up on the charting API, which has included some 
> patches on the PlotKit renderer. I've tried to clean things up a bit now 
> that we have a few renderers and I know what to look for.

The cleanups look good, particularly the standardizing of chart types.

> A new problem I see now is that if you place a PlotKit chart inside of a 
> region and then replace that with another region containing PlotKit 
> charts, the charts never render because the script tags are stripped. I 
> was trying to think of a better way to handle this and was wondering if 
> we might render a table containing the data for the chart, which would 
> then be replaced by a PlotKit chart when the next Behaviour.apply() call 
> is made. This could be a standard facility provided by the plugin rather 
> than by the renderer since I expect other renderers to need something 
> like it. If PlotKit failed to render, at least there'd be a table 
> showing the data.

I thought we eval'ed any scripts in the new region after it's been 
inserted (and had some settle time).  It seems that we do (jifty.js, 
line 966).  I imagine it's not working because the chart rendering is 
being triggered as an onLoad event for the window.  It should probably 
change to an onAvailable event for the div being inserted.

> P.S. Thanks for the work on PlotKit. It'll make the big bosses happier 
> than what I would have had time for otherwise.

No problem, we might end up using it too.  I'm still jealous of some of 
Ruby's really pretty image-based charting libs though.  They're based on 
GD and ImageMagick, but it's custom stuff that's much prettier than 
GD::Graph.  I haven't found an equivalent for Perl.

Tom

> ------------------------------------------------------------------------
> 
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel



More information about the jifty-devel mailing list