Bugs: Browse | Submit New | Admin
I am drawing line graphs out of a database and came across this error when only one data point was presented to Gruff::Line Non-conforming drawing primitive definition `circle': vendor/plugins/gruff/lib/gruff/line.rb:82:in `draw' vendor/plugins/gruff/lib/gruff/line.rb:82:in `draw' vendor/plugins/gruff/lib/gruff/base.rb:323:in `to_blob' If I have some more time later today, I'll submit a patch. Thanks for some cool software. Regards Andre
Add A Comment:
Date: 2006-08-23 13:31 Sender: Andre Sachs Ignore the prevoius follow up. --- vendor/plugins/gruff/lib/gruff/line.rb 17 Aug 2006 11:46:20 -0000 1.1 +++ vendor/plugins/gruff/lib/gruff/line.rb 23 Aug 2006 13:23:17 -0000 @@ -37,8 +37,8 @@ super return unless @has_data - - @x_increment = @graph_width / (@column_count - 1).to_f + @x_increment = 0 + @x_increment = @graph_width / (@column_count - 1).to_f if @column_count > 1 circle_radius = clip_value_if_greater_than(@columns / (@norm_data.first[1].size * 2.5), 5.0) @d = @d.stroke_opacity 1.0
Date: 2006-08-23 13:00 Sender: Andre Sachs Divide by zero causes @x_increment to become Infinity. --- vendor/plugins/gruff/lib/gruff/line.rb 17 Aug 2006 11:46:20 -0000 1.1 +++ vendor/plugins/gruff/lib/gruff/line.rb 23 Aug 2006 12:52:13 -0000 @@ -37,8 +37,8 @@ super return unless @has_data - - @x_increment = @graph_width / (@column_count - 1).to_f + @x_increment = 0 + @x_increment ||= @graph_width / (@column_count - 1).to_f circle_radius = clip_value_if_greater_than(@columns / (@norm_data.first[1].size * 2.5), 5.0) @d = @d.stroke_opacity 1.0