Charts library for Ruby
I've made a number of useful charts with the Google Chart API. There are a few gems: googlecharts, gchartrb. I haven't used them but they look like a good first cut.
As to not displaying it you can just make the call and save the result. No need to render, just make the call, get the URL, and fetch the file.
What is your preferred way to produce charts in a Ruby on Rails web application?
Google Charts is an excellent choice if you don't want to use Flash. It's pretty easy to use on its own, but for Rails, it's even easier with the gchartrb gem. An example:
GoogleChart::PieChart.new('320x200', "Things I Like To Eat", false) do |pc|
pc.data "Broccoli", 30
pc.data "Pizza", 20
pc.data "PB&J", 40
pc.data "Turnips", 10
puts pc.to_url
end
ChartKick library hash doesn't work
It appears that I have made a mistake somewhere in my code that was conflicting with the javascript file from working. Honestly, I'm not quite sure what I did differently since I've been trying different things. As it stands I have //= require Chart.bundle
before //= require chartkick
in my application.js file and i have Chart.bundle.js in my vendor/assets/javascripts folder. It seems this is all it took and all seems to be good now. I believe i may have had conflicting code somewhere and just missed that conflicting code while looking through what I had.
Ruby on Rails Pie Chart Library?
Yes, Gruff is pretty cool for this.
Candlestick/Financial Charts in Ruby
The google chart API supports candlestick charts, among other things.
There are a few gems that automate this: googlecharts, gchartrb. I haven't used them but they look like a good first cut.
Here's a quick example from the docs:
Drawing Library for Ruby
The simple answer is that (at time of writing) what you want almost certainly didn't exist. Sorry!
If you're Windows-based then I'd look for a product in the .NET space, where I expect you'd find something. You're probably going to have to pay real money though. I suppose, if you're brave, you may be able to talk to it using IronRuby.
From a non-MS environment I would be hoping for a Java-based solution. As already mentioned, within the Web world, you're going to be hoping some something JavaScript-based, or probably more likely, something from the Flash (or maybe even Silverlight?) world.
Actually, if you want to stay in Ruby and don't mind some risk, Silverlight might be a way to go - assuming the DLR stuff actually works (no experience here). Ruby - much as I love it - hardly has the most mature GUI structure around it.
Update: Since writing this (approaching 5 years ago) the situation has improved - a little. While I'm still not aware of any specific Ruby graph-drawing libraries, there is improved support for Graphviz here (Github) or by gem install ruby-graphviz
. I've found that for simple graphs, it's quite possible to write the script directly from Ruby.
Related Topics
Ruby Class Instance Variables and Inheritance
Pg Error Could Not Connect to Server: Connection Refused Is the Server Running on Port 5432
"Errno::Eaccess...Permission Denied" Running Compass Watch
How to Start the Ruby Debugger on Exception
Simple Ruby Input Validation Library
Mongoid: Find Through Array of Ids
Ruby Way to Group Anagrams in String Array
Convert String with Comma to Integer
How to Organize Minitest/Unit Tests
How to View a Sample of the Call Stack in Ruby
Check If String Contains Any Substring in an Array in Ruby
Is Time.Zone.Now.To_Date Equivalent to Date.Today
Ruby Get Time in Given Timezone
How to Get a List of Files That Have Been 'Required' in Ruby