OFC2 4 Rails

pie radius chart

# include js file on site
  = javascript_include_tag 'swfobject.js'

# in controller
  #ofc2(width, height, url, id =Time.now.usec, flash_attributes = {}, flash_params = {})
  @graph = ofc2(650,300, 'charts_ofc2/pie_radius')

#in controller which is generating data for charts (for me it's charts_ofc2)
  
  def pie_radius
    data_1 = [
      OFC2::PieValue.new(:value => 35,  :label => 'Mozilla', :font_size => 35),
      OFC2::PieValue.new(:value => 25, :label => 'Safari', :font_size => 25),
      OFC2::PieValue.new(:value => 30, :label =>  'Opera', :font_size => 30),
      OFC2::PieValue.new(:value => 10,  :label => 'IE', :font_size => 10)
    ]
    data_2 = [
      OFC2::PieValue.new(:value => 35,  :label => 'Mozilla'),
      OFC2::PieValue.new(:value => 25, :label => 'Safari'),
      OFC2::PieValue.new(:value => 30, :label =>  'Opera'),
      OFC2::PieValue.new(:value => 10,  :label => 'IE'),
    ]

    pie = OFC2::Pie.new(
      :gradient_fill => true,
      :alpha => 0.8,
      :start_angle => 35,
      :animate =>  [OFC2::PieFade.new, OFC2::PieBounce.new],
      :tip => '#label#<br>#val# of #total#<br>#percent# of 100%',
      :values => data_1,
      :radius => 80
    )
    under_pie = OFC2::Pie.new(
      :no_labels => true,
      :gradient_fill => true,
      :alpha => 0.8,
      :start_angle => 35,
      :animate =>  [OFC2::PieFade.new, OFC2::PieBounce.new],
      :tip => '#label#<br>#val# of #total#<br>#percent# of 100%',
      :values => data_2,
      :radius => 50
    )
    colours  = []
    0.upto(4) do |i|
      colours  << "##{i + 1}#{10-i}#{i+4}#{10-i}#{i+5}#{10-i}"
    end
    pie.colours = colours

    chart = OFC2::Graph.new
    chart.title= OFC2::Title.new( :text => action_name.humanize , :style => "{font-size: 14px; color: #b50F0F; text-align: center;}")
    chart << under_pie
    chart << pie

    render :text => chart.render
  end
  

# display graph in view (haml)
  =@graph