OFC2 4 Rails

mix advanced scaled axis 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_advanced_scaled_axis')

#in controller which is generating data for charts (for me it's charts_ofc2)
  
  def mix_advanced_scaled_axis
    title = OFC2::Title.new( :text => action_name.humanize , :style => "{font-size: 14px; color: #b50F0F; text-align: center;}")
    line_dot = OFC2::Line.new( :values => [9,8,7,6,5,4,3,2,1,12] )
    chart = OFC2::Graph.new
    chart.title= title

    x_labels = OFC2::XAxisLabels.new
    #        x_labels.rotate= 'vertical'
    x_labels.rotate= 'diagonal'


    x = OFC2::XAxis.new
    x.colour= '#D7E4A3'
    x.grid_colour= '#A7E4A3'
    # Add the X Axis Labels to the X Axis
    x.labels= x_labels

    y_axis = OFC2::YAxis.new(:min => 0, :max => 20)
    y_axis.colour= '#AAAA00'
    y_axis.grid_colour= '#00FFF0'

    chart.x_axis= x
    chart.y_axis= y_axis
    chart.y_axis_right= y_axis

    chart << line_dot
    render :text => chart.render
  end
  

# display graph in view (haml)
  =@graph