Skip to content

Instantly share code, notes, and snippets.

@winston
Created April 4, 2010 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save winston/355372 to your computer and use it in GitHub Desktop.
Save winston/355372 to your computer and use it in GitHub Desktop.
GoogleVisualr::ImageSparkLine Creation Example
# http://code.google.com/apis/visualization/documentation/gallery/image_spark_line.html#Example
def image_spark_line
@chart = GoogleVisualr::ImageSparkLine.new
@chart.add_column("number", "Revenue" )
@chart.add_column("number", "Licenses")
@chart.add_rows(10)
@chart.set_value(0,0,435)
@chart.set_value(1,0,438)
@chart.set_value(2,0,512)
@chart.set_value(3,0,460)
@chart.set_value(4,0,491)
@chart.set_value(5,0,487)
@chart.set_value(6,0,552)
@chart.set_value(7,0,511)
@chart.set_value(8,0,505)
@chart.set_value(9,0,509)
@chart.set_value(0,1,132)
@chart.set_value(1,1,131)
@chart.set_value(2,1,137)
@chart.set_value(3,1,142)
@chart.set_value(4,1,140)
@chart.set_value(5,1,139)
@chart.set_value(6,1,147)
@chart.set_value(7,1,146)
@chart.set_value(8,1,151)
@chart.set_value(9,1,149)
options = { :width => 120, :height => 40, :showAxisLines => false, :showValueLabels => false, :labelPosition => 'left' }
options.each_pair do | key, value |
@chart.send "#{key}=", value
end
end
<div id='chart'></div>
<%= @chart.render('chart') %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment