Real time chart (SVG) + AJAX/Javascript/Jquery + StdOut + Python + I dont really know myself


Question

I am not sure how to accurately describe my problem , and right now i have a total mess in my head , so please deal with it and correct me if i am wrong , and i will be for sure.

MAIN GOAL:

Is to built a real time line chart , which updates itself without web page reloading based on data , which comes from stdout . So it basically must be python script , which gets every second value , and based on this values continues to draw line in a line chart .

1) Well basic tags in my head right now are : Javascript / AJAX , cgi , python http web server , SVG (Vector graphics).

So basically the biggest problem , which i dont understand is how to continuesly transfer stdout values to the webpage . Should i write my own python http web server , somehow pass values and with javascript or ajax + SVG draw the chart .

Or writing a http web server is a stupid idea and i can somehow make it work without it ?

Any other suggestions , or pointing me to some tutorials or arcticles are welcome . Because right now i am very confused , especially on the part of continuesly passing values to webpage.

Thx in advance. Hope you will be able to point me somewhere =)

1
1
4/27/2011 6:33:49 PM

Accepted Answer

What you want to do is use JavaScript to render the chart, for example using a library such as highcharts. Then, you can use AJAX to make an HTTP request back to a web server to get your data.

Depending upon your needs, you could just keep making these calls periodically to get new data. Or you could look into using a more efficient technique such as web sockets, comet, etc.

2
4/27/2011 6:39:28 PM

Highcharts are nice for a static data or for data updated at max 1000ms speed. Try changing update rate to 100ms - it looks like crap.

I would recommend Smoothie Charts. Fits perfectly for your scenario.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon