topfunky / gruff

Gruff graphing library for Ruby
http://gruff.rubyforge.org
MIT License
1.37k stars 239 forks source link

Fix error when input empty data in Gruff::BoxPlot #594

Closed Watson1978 closed 2 years ago

Watson1978 commented 2 years ago

This patch will fix following exception.

/home/watson/prj/gruff/lib/gruff/helper/bar_conversion.rb:42:in `-': nil can't be coerced into Integer (TypeError)
        from /home/watson/prj/gruff/lib/gruff/helper/bar_conversion.rb:42:in `get_top_bottom_scaled'
        from /home/watson/prj/gruff/lib/gruff/box_plot.rb:66:in `block in draw_graph'
        from /home/watson/prj/gruff/lib/gruff/box_plot.rb:51:in `each'
        from /home/watson/prj/gruff/lib/gruff/box_plot.rb:51:in `each_with_index'
        from /home/watson/prj/gruff/lib/gruff/box_plot.rb:51:in `draw_graph'
        from /home/watson/prj/gruff/lib/gruff/base.rb:531:in `draw'
        from /home/watson/prj/gruff/lib/gruff/base.rb:497:in `to_image'
        from /home/watson/prj/gruff/lib/gruff/base.rb:479:in `write'
        from box.rb:12:in `<main>'