Skip to content

Instantly share code, notes, and snippets.

@X4
Created July 30, 2010 02:47
Show Gist options
  • Select an option

  • Save X4/499786 to your computer and use it in GitHub Desktop.

Select an option

Save X4/499786 to your computer and use it in GitHub Desktop.
# Create a new AnnotatedTimeLine chart
@chart = GoogleVisualr::AnnotatedTimeLine.new
# Add Column Headers
@chart.add_column('date' , 'Created at')
@chart.add_column('number', 'Open')
@chart.add_column('number', 'Close')
@chart.add_column('number', 'High' )
@chart.add_column('number', 'Low' )
@chart.add_column('number', 'Volume')
# Add Rows and Values
@chart.add_rows( [
[ Date.parse('2010-02-15'), 30000, 123, '23', 40645, '44'],
[ Date.parse('2009-02-15'), 30000, 123, '3', 40645, '44'],
[ Date.parse('2009-08-15'), 30000, 123, '34', 40645, '22'],
[ Date.parse('2009-06-15'), 30000, 123, '342', 40645, '22'],
[ Date.parse('2008-02-15'), 30000, 123, '24', 40645, '22']
] )
options = { :displayAnnotations => true}
options.each_pair do | key, value |
@chart.send "#{key}=", value
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment