Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting Raphael with Rails

This is a high-level question about web frameworks, that as a desktop app developer, I don't have much knowledge of.

I am planning to build a web application which visualizes some data stored in a database. I plan on using Rails for user query. For visualization, the Raphael JS library looks good. Would it be a considerable task trying to connect Rails with this library?

Any recommendations for substitutes for these 2 are welcome.

like image 505
raheel Avatar asked Sep 23 '10 14:09

raheel


3 Answers

There isn't really much that needs to be done to connect Rails and Raphaël. Raphaël is a Javascript library, and so runs entirely on the client, and Rails is a web application framework, running on the server. All you really need to do to integrate them are include Raphaël on your page, and provide data to it in a format easy to use from Javascript; using RESTful controllers which provide data in JSON should make it easy for you to load data using XMLHttpRequest from the client, which you can then display using Raphaël.

like image 122
Brian Campbell Avatar answered Sep 29 '22 08:09

Brian Campbell


Ryan Bates talk about charts (including Raphael) in this Railscasts, Im pretty sure It's a good starting point.

like image 27
jpemberthy Avatar answered Sep 29 '22 08:09

jpemberthy


Raphael is a self-contained JS library, the server-side framework/language you pick is really unimportant. You can't just plug one into the other though, you'll have to figure out how to supply Raphael with the data it needs in the format it expects. Rails will be no better or worse than any other framework at this.

like image 45
meagar Avatar answered Sep 29 '22 06:09

meagar