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: 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 9 October 2010 21:58, Zack Nathan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Robert Pankowecki (rupert)
2010-Oct-10 07:52 UTC
Re: Name error when trying to include a file
Do you even know how Ruby work ? Why do you try to include it in your controller ? Read the documentation first: http://github.com/peterpunk/open_flash_chart_lazy/ http://ofcl.onrails.com.ar/ This error might occur because you installed the plugin wrong, or you might have forgotten to `require'' some files. Robert Pankowecki -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks guys, I fixed it, it was todo with how the plugin installed. Colin, I dont mind what plugin I use aslong as it works well. Are there any quick guides or tutorials you could recommend on flot with rails because I dont mind giving it a go, but I need it working relatively fast. Thanks. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 10 October 2010 14:30, Zack Nathan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thanks guys, I fixed it, it was todo with how the plugin installed. > > Colin, I dont mind what plugin I use aslong as it works well. Are there > any quick guides or tutorials you could recommend on flot with rails > because I dont mind giving it a go, but I need it working relatively > fast.The flot website has many examples. There is a Rails plugin, flotilla, which makes life fairly easy. I don''t know whether it is compatible with Rails 3 if that is an issue for you. I tried Open Flash Chart (not the lazy version, not sure of the difference) and thought that the architecture is completely wrong. It makes the chart in the controller whereas it should of course be in the view. The controller should just provide the data to be charted and the view should format it and draw it. That is how it works in flotilla. I found flot to be quicker drawing graphs with many points (though that may not be true on IE as there flot has to use a canvas emulator) Of course if you are developing a public site you have the major decision of whether to insist the users have flash enabled or javascript enabled. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote:> On 10 October 2010 14:30, Zack Nathan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Thanks guys, I fixed it, it was todo with how the plugin installed. >> >> Colin, I dont mind what plugin I use aslong as it works well. Are there >> any quick guides or tutorials you could recommend on flot with rails >> because I dont mind giving it a go, but I need it working relatively >> fast. > > The flot website has many examples. There is a Rails plugin, > flotilla, which makes life fairly easy. I don''t know whether it is > compatible with Rails 3 if that is an issue for you. > > I tried Open Flash Chart (not the lazy version, not sure of the > difference) and thought that the architecture is completely wrong. It > makes the chart in the controller whereas it should of course be in > the view. The controller should just provide the data to be charted > and the view should format it and draw it. That is how it works in > flotilla. > > I found flot to be quicker drawing graphs with many points (though > that may not be true on IE as there flot has to use a canvas emulator) > > Of course if you are developing a public site you have the major > decision of whether to insist the users have flash enabled or > javascript enabled. > > ColinThanks for the reply. I actually reverted to open flash chart and my other post on the rails forum is about it. I changed plugins because the other one is a more updated version I think. Yeah, flotilla looks good, but iv got a test bar chart working with openflashchart and am now trying to get a line chart working so i''ll stick with that. Thanks, Zack. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.