OFC2 4 Rails

inline many line chart

# include js file on site
<%= javascript_include_tag 'swfobject.js' %>

# when you use ofc2_inline method you don't neeed extra controller which serving data

# lets say you have a controller Charts
class ChartsController < ApplicationController
  # and action inline_many_line
  def inline_many_line
    title = OFC2::Title.new(
      :text => action_name.humanize ,
      :style => "{font-size: 14px; color: #b50F0F; text-align: center;}"
    line_dot = OFC2::Line.new
    line_dot.values= [9,8,7,6,5,4,3,2,1]
    line_dot.colour = '#00FF00'
    chart = OFC2::Graph.new
    chart.title= title
    chart << line_dot

    @graph = ofc2_inline(650,300,chart,'inline_line')

    bar = OFC2::Bar.new
    bar.values= [9,8,7,6,5,4,3,2,1]
    bar.colour = '#FF0000'
    chart = OFC2::Graph.new
    chart.title= title
    chart << bar

    @seccond_graph = ofc2_inline(650,300,chart,'inline_line_2')
# notice that instead url (like was in another examples) we set an chart object
# @graph = ofc2_inline(650,300,chart,'inline_line')
# the 4th parameter is id, if you not set it, it will be automaticaly generated (another for each chart)
# every inline chart generated on the same page must have unique id!

# ok, we have controller and action, now display graph in a view for that action
# for this tiny example it is app/views/charts/inline_many_line.html.erb
<%=@graph %>
<%=@seccond_graph %>