daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'fox16'
  2. require 'google_chart'
  3. require 'open-uri'
  4.  
  5. include Fox
  6.  
  7. class ChartsWindow < FXMainWindow
  8.   def initialize(app)
  9.     super(app, "Google Charts Demo", :width => 650, :height => 250)
  10.     FXImageFrame.new(self, nil, :opts => LAYOUT_FILL) do |f|
  11.       f.image = FXPNGImage.new(app, open(bar_chart.to_escaped_url, "rb").read)
  12.     end
  13.   end
  14.  
  15.   def bar_chart
  16.     GoogleChart::BarChart.new('600x200', 'My Chart', :vertical) do |bc|
  17.       bc.data 'Trend 1', [5,4,3,1,3,5], '0000ff'
  18.       bc.data 'Trend 2', [1,2,3,4,5,6], 'ff0000'
  19.       bc.data 'Trend 3', [6,5,4,4,5,6], '00ff00'
  20.     end
  21.   end
  22.  
  23.   def create
  24.     super
  25.     show(PLACEMENT_SCREEN)
  26.   end
  27. end
  28.  
  29. if __FILE__ == $0
  30.   FXApp.new do |app|
  31.     ChartsWindow.new(app)
  32.     app.create
  33.     app.run
  34.   end
  35. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top