Sysquake Remote Live
Moving average
The figure below illustrates the moving average, which has two effects: smoothing and delay.
Data come from a pseudo-random number generator, but it would be easy to let Sysquake Remote connect to a live data feed on the Internet or to a database.
Source code
Here is the code inserted in the file stored on the server. If you look at the source of this page in your browser, you will see only the HTML code produced by Sysquake Remote.
<?sqr % initialization rng default; t = 1995 + (0:7*360) / 360; n = length(t); x = 100 + cumsum(randn(1, n) + 0.03); w = 60; % interactive form use sqr; format = 'Moving average window: %{6}n\n%{Revert}R%{Update}S'; names = {'w'}; s0 = struct('w',w); s = processhtmlform(format, names, s0); s.w = max(min(s.w, 720), 2); % must be between 2 and 720 displayhtmlform(format, names, s, 'get'); w = s.w; % figure beginfigure('size', [440, 300]); plotoption xygrid; plot(t, x, 'h(00e000)'); plot(t(w:end), conv(x,ones(1,w)/w)(w:end-w+1), 'k'); legend(sprintf('index (1995=100)\nmoving average %d days',w), 'h(00e000)k') endfigure; ?>