Skip to content

Instantly share code, notes, and snippets.

@winston
Created April 4, 2010 13:38
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/355400 to your computer and use it in GitHub Desktop.
Save winston/355400 to your computer and use it in GitHub Desktop.
GoogleVisualr::Gauge Creation Example
# http://code.google.com/apis/visualization/documentation/gallery/gauge.html#Example
def gauge
@chart = GoogleVisualr::Gauge.new
@chart.add_column('string' , 'Label')
@chart.add_column('number' , 'Value')
@chart.add_rows(3)
@chart.set_value(0, 0, 'Memory' )
@chart.set_value(0, 1, 80)
@chart.set_value(1, 0, 'CPU' )
@chart.set_value(1, 1, 55)
@chart.set_value(2, 0, 'Network')
@chart.set_value(2, 1, 68);
options = { :width => 400, :height => 120, :redFrom => 90, :redTo => 100, :yellowFrom => 75, :yellowTo => 90, :minorTicks => 5 }
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