开发者

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

开发者 https://www.devze.com 2023-03-01 06:54 出处:网络
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.

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 + SV开发者_StackOverflow中文版G 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 =)


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.


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.


Also check the real-time updates possibilities of Flot: http://people.iola.dk/olau/flot/examples/

I use a database as buffer, so no need for Comet or other push-techniques.


I would use JavaScript to create or manipulate an SVG document, with AJAX requests polling the server and getting data back.

0

精彩评论

暂无评论...
验证码 换一张
取 消