Re: [Rails] Name error when trying to include a file
On 9 October 2010 21:58, Zack Nathan <lists@ruby-forum.com> wrote:
> So im trying to use a plugin called open flash chart lazy. Its a chart
> plugin that renders charts in flash (I think). Heres my controller:
Not answering the question I know, but unless you are really keen on
flash you might to look at the flot javascript library which works
well for me. http://code.google.com/p/flot/
Colin
>
> class ChartsController < ApplicationController
> include OpenFlashChartLazy
> layout "default"
> before_filter :login_required
>
> def index
>
> workout_calories_array = Array.new
> spinclass_calories_array = Array.new
>
> workout_calories.each do |w|
> workout_calories_array << [w.created_at.to_date,
> w.calories_burned]
> end
> spinclass_calories.each do |sc|
> spinclass_calories_array << [sc.created_at.to_date,
> sc.calories_burned]
> end
>
> line_graph = OpenFlashChartLazy::Line.new("Calories")
> workout_calories_serie =
> OpenFlashChartLazy::Serie.new([workout_calories_array],{:title=>"Workouts"})
> spinclass_calories_serie =
> OpenFlashChartLazy::Serie.new([spinclass_calories_array],{:title=>"Spin
> classes"})
>
> Heres the error from the server:
>
> Processing ApplicationController#index (for 127.0.0.1 at 2010-10-09
> 21:47:29) [GET]
>
> NameError (uninitialized constant ChartsController::OpenFlashChartLazy):
> app/controllers/charts_controller.rb:3
>
> Rendered rescues/_trace (33.4ms)
> Rendered rescues/_request_and_response (0.4ms)
> Rendering rescues/layout (internal_server_error)
>
>
> Thanks, jakx12.
>
> line_graph.add_serie(workout_calories_serie)
> line_graph.add_serie(spinclass_calories_serie)
> line_graph.x_axis.labels.rotate="vertical"
> line_graph.bg_colour="#FFFFFF"
> line_graph.x_axis.colour="#808080"
> line_graph.x_axis["grid-colour"]="#A0A0A0"
> line_graph.x_axis.stroke=0.5
>
> line_graph.y_axis.colour="#808080"
> line_graph.y_axis.stroke=0.5
> line_graph.y_axis["grid-colour"]="#A0A0A0"
> line_graph.to_json
>
> render :text => line_graph.to_graph_json
> end
>
> end
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home