[wxruby-users] chart extension for wxRuby?
Andreas Warberg
lists at ruby-forum.com
Sun Apr 20 09:28:54 EDT 2008
Alex Fenton wrote:
> require 'scruffy'
> require 'wx'
>
> class Chart < Wx::Window
> attr_reader :graph
> def initialize(*args)
> super
> evt_paint :on_paint
> @graph = Scruffy::Graph.new(:title => "Monthly Profits")
> graph.add(:line, 'John', [100, -20, 30, 60])
> graph.add(:line, 'Sara', [120, 50, -80, 20])
> end
>
> def on_paint
> paint do | dc |
> graph.render(dc, :width => size.width, :height => size.height)
> end
> end
> end
>
>
> Wx::App.run do
> frame = Wx::Frame.new(nil, :title => 'chart demo')
> chart = Chart.new(frame)
> frame.show
> end
This won't run. I get 'in `render': wrong number of arguments (2 for 1)
(ArgumentError)' when I copy your example verbatim.
Removing the extra argument in render and rerunning gives me:
C:/ruby/lib/ruby/gems/1.8/gems/scruffy-0.2.2/lib/scruffy/graph.rb:131:in
`render': undefined method '[]' for #<Wx::PaintDC:0x591d318>
(NoMethodError)
I would like to render a graph directly to the screen - is this possibly
using scruffy / wxruby?
Regards
Andreas
--
Posted via http://www.ruby-forum.com/.
More information about the wxruby-users
mailing list