Prev | Current Page 102 | Next

David Berube

"Practical Reporting with Ruby and Rails"

event DESC;"
CHAPTER 4 n CREATING REPORTS ON THE DESKTOP 66
data = []
Event.find_by_sql(sql).each do |row|
bar_chart.data row.event, (row.average_time.to_i/1000)
end
bar_chart.labels = {0=>'Time'}
chart_png_filename = "./player_#{player.id}.png"
bar_chart.write(chart_png_filename)
pic = FXPNGImage.new(FXApp.instance())
FXFileStream.open(chart_png_filename,
FXStreamLoad) { |stream| pic.loadPixels(stream) }
pic.create
@graph_picture_viewer.image = pic
File.unlink(chart_png_filename)
end
end
fox_application=FXApp.new
TransmegtechGraphWindow.new
FXApp.instance().create # Note that getApp returns the same FXApp instance
# as fox_application references.
FXApp.instance().run
Save this script as desktop_team_performance_graph.rb. You can run the script using
the following command:
ruby desktop_team_performance_graph.rb
When you run this command, you will see a screen with the text ???no data.??? You can
then use the drop-down menus to select a game and a player. The sample database has
data only for the Tech Website Baron game.


Pages:
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
Mobb Deep Milk Inc. siatki tkane Joseph Malik Maria McKee