Name error when trying to include a file

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

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

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

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.

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

Colin Law wrote: