butterywombat
butterywombat

Reputation: 2089

ruby on rails - open flash charts

I'm trying various ways to implement pretty graphs in my app. I followed http://pullmonkey.com/projects/open_flash_chart2 steps in my app, but instead of creating test_it, I just added to my own controller. In my routes.rb, I have

resources :my_controller_name do
    collection do
      get 'graph_code'
    end
  end

also, since I don't think it could find the action my_controller_name/graph_code otherwise (I'm kind of confused as to why most tutorials leave the routes part out? Am I doing something wrong?). (I also used @graph.html_safe in my views for Rails 3) Anyway when I go to /my_controller_name, I get the error in the flash box:

Open Flash Chart

JSON Parse Error [Syntax Error]
Error at character 0, line 1:

0: #<OpenFlashChart::OpenFlashChart:0x000001043c4b78

I don't know why this is happening. I tried creating a new app and following the guide, generating a controller named test_it. It worked (provided I corrected the routing). I can't think of how my controller is any different than test_it, except I initially generated it using a rails scaffold (so it has all the MVC parts), whereas I only generated the test_it controller. (I've also tried using/not using the json gem conflict fix, but it didn't make a difference--https://github.com/klochner/open_flash_chart/commit/00cf531387880af8c49ed5118737f0492b437f75) Thanks for any insight, I'm stumped as to why it's easy to implement on a new app but I can't add it to mine... Thanks.

Upvotes: 0

Views: 669

Answers (2)

Peter Brown
Peter Brown

Reputation: 51707

Don't waste your time with Flash based charting libraries. Highcharts is definitely the way go to. It works in pretty much any browser, including those that don't support Flash. Much better performance on OS X than Flash will ever provide.

Upvotes: 0

butterywombat
butterywombat

Reputation: 2089

Nevermind, it seems to work if I use the old lib/base.rb instead of the json gem fix. Ah well.

Upvotes: 2

Related Questions