Reputation: 1401
I am using chart-kick to generate graphs in my Ruby on Rails application. I am able to display the charts without any problem. The issue is I am in need to refresh the page which has the graph each time the data is added to see the updated graph. How do I make sure that the graph alone reloads everytime I update new data in my database? Is that possible?
Note: Highcharts is not an option. I am giving this to a commercial website and they can't afford Highcharts.
Upvotes: 4
Views: 1309
Reputation: 1401
I ended up using Chart.js and using Ajax requests to poll the database and update the graph for its changes. I was not successfull in implementing Websockets.
Upvotes: 2
Reputation: 22296
To achieve what you want, you need a bidirectional communication between your server and your client. I will suggest you to use websockets, it suffers from not being supported by all browsers but as fallback you can use polling the server for new results (if you care enough for a fallback). To check the current support status check this page.
Follow this example on websocket-rails gem to get started.
Upvotes: 1