topfunky/gruff — pull request #99 by camway (2014-01-29 19:21:15+00:00)
Title: Legends as tables and better y_increment algorithm

All modifications are to the Gruff::Base class

Added new attr_accessor for `legend_as_table`(bool, defined in `initialize_ivars`) for defining the table layout as columns instead of placing to fit.

Also calling `.guesstimate_y_increment` on an instance of the Gruff::Base will auto populate `y_axis_increment` and optionally `marker_count` (depending on if it's defined at the time). The algorithm handles a wide range of values and defaults to having 8 markers on a graph.

I tried to make the changes to `draw_legend` as simple as possible and flag them as appropriate. You should see a "#CUSTOM" next to/above anything I've modified.

guesstimate_y_increment was derived from Toon Krijthe's reponse @ http://stackoverflow.com/questions/326679/choosing-an-attractive-linear-scale-for-a-graphs-y-axis