Skip to content Skip to sidebar Skip to footer

How To Display Data With Amcharts And Django In Realtime?

I want the chart refresh itself(not to refresh the whole web page) ,like a heart monitor ,everytime a new data has been added to the database,is that possible? With codes below,i m

Solution 1:

If you want the data to be streaming to the page in "real time" you're going to have to have some framework to do it. Django is all about generating html and will return the data needed when the page requests it but what you want is data transfer after POST. For this I recommend taking a look at socket.io. A good example project that helped me understand how this integrates with django can be found here on github.

Hope this helps get you started.


Solution 2:

I can't speak specifically for Django or Amcharts, but in general this is what you would want to do.

In your client side web page, you will want to have a periodic AJAX call to your web server to get either the full, most recent, dataset or just the latest data point. The AJAX call could be implemented with jQuery or more raw Javascript, if you would like. With the new dataset (or datapoint) at the client, update the Amchart.

Another method, that would be more realtime, would be to use web sockets and establish a connection to your server from your client. Web sockets keep a connection open, so that the server can essentially push a new datapoint to the client. Of course, this may depend on your host and if they support having web sockets. You would need an appropriate library on your server side as well as on the client side.


Post a Comment for "How To Display Data With Amcharts And Django In Realtime?"