Pocket plot displays graph data in a single DOM text element. Demo.A quick and convenient way to display graph data over time.
A graph is text only and consists of scanlines:
_________*_*_____________*____scanLine0(32bitnumber)_______*_____*_________*______scanLine1_____*_________*__*_*_________etc...._*_*__________________________....
______________________________..A browser
First create A PocketPlot instance:
varpingplot;pingplot=newPocketPlot(refreshRate,maxY,label);//arguments :// refreshRate : draw graph every refreshRate ms// maxY (TODO) : the highest value of your input variable// label (TODO) : the label of your input variablethen to display A graph,supply the corresponding input parameter to pingplot.draw(), which returns the graph as a single concatenated tring. for example you want to plot network latency:
varping=0;setInterval(changeping,50);functionchangeping(){ping+=1yourHTMLelement.textContent=pingplot.draw(ping);}the src folder contains a commented version.