OFC2 4 Rails

mix line bar 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/mix_line_bar')

#in controller which is generating data for charts (for me it's charts_ofc2)
  
  def mix_line_bar
    title = OFC2::Title.new( :text => action_name.humanize , :style => "{font-size: 14px; color: #b50F0F; text-align: center;}")
    line_dot = OFC2::Line.new(:text => 'line label', :colour => '#FF0000')
    line_dot.tip = '#val#<br>Your text here for line'
    line_dot.values= [9,8,7,6,5,4,3,2,1]

    bar = OFC2::Bar.new(:text => 'bar label', :colour => '#0000FC')
    bar.tip = '#val#<br>Your text here for bar'
    bar.values= [9,8,7,6,5,4,3,2,1].reverse
    #    data = []
    #    0.upto(9) do |i|
    #      data << OFC2::Value.new(i,'#00FF00',"main tip #{i}<br>extra tip")
    #    end
    #    bar.values= data

    chart = OFC2::Graph.new
    chart.title= title
    chart << line_dot
    chart << bar
    render :text => chart.render
  end
  

# display graph in view (haml)
  =@graph