Hi, I'm trying to create an application that displays live sparklines (small inline graphs). A typical page might have a dozen or so of these updating every few seconds, so it seems like either jsonrpc or xlmrpc is the right thing to use.
As a test, I've currently got sparklines updating on the client side using the jquery.sparkline and jquery.timers plugins. The code to make it work is pretty straightforward. After including the aforementioned plugins at the top of web2py_ajax.html, I can create a sparkline that updates once a second with code at the bottom of web2py_ajax.html like the following: <script type="text/javascript"> /* <![CDATA[ */ $(function() { $('.dynamicsparkline').everyTime(1000,function(i) { var a = [10,9,8,7,6,5,4]; var b = [0,0,0,0,0,0,0] var j = 2+i%5; for(var k=0; k<b.length; k++) { b[k] = a[k] %j;} $(this).sparkline(b); }); }); /* ]]> */ </script> and in my view the following code: <p> Sparkline with dynamic data: <span class="dynamicsparkline">Loading..</ span> </p> displays a nice little wiggly graph that changes once a second. Just the effect I'm looking for. So my question is this: What's the most straightforward way to rewrite this trivial little demo so the data calculation takes place server side? Clearly the work would be done by a function that looks something like the following: @service.jsonrpc ## or is xmlrpc easier? def datapoints(j): return [n%j for n in [10,9,8,7,6,5,4]] but what plugins, initializations and function calls are needed client-side to replace the lines in my javascript example that fill the 'b' array with the values to be plotted? Thanks, Mike