Mat Schaffer on 20 Mar 2007 17:32:24 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] PubNite Recap



On Mar 20, 2007, at 12:23 PM, Steve Eichert wrote:

Any chance you might be able to expand upon what was discussed regarding Gruff? I'm just about to embark on a project that is likely going to make use of it and I'd be interested in hearing about anything that might help with that adventure. I'm sure the other Philly Rails heads would be interested as well, right? :)

Sure thing. Basically I've been trying to extend Gruff for doing time-based graphing (think network throughput only measured in 2 minute chunks every 15 minutes).


I got that working, but it felt hackish because of what I see as a shortcoming in gruff.

Basically in an attempt to be user friendly, gruff calculates things like minimum_value, maximum_value. In my time mixin I'd like to auto calculate start_time, end_time, etc...

Currently Gruff does this in a very simplistic fashion which requires that the user add all the data to a graph first, then set any manual overrides. If the overrides are set first, the #data function will wax the user's preference with it's own calculated values. In code:

graph.maximum_value = 10
graph.data('my data', [8,12,15])
graph.maximum_value # => 15

graph.data('my data', [8,12,15])
graph.maximum_value = 10
graph.maximum_value # => 10

I feel like a maximum_value set by the user should always override the auto-calculations regardless of ordering.

But Gruff references @maximum_value and @minimum_value directly all over the place (even in different graph subclasses). So fixing the problem would cause a pretty big overhaul of the code (something like 8 files modified) and I'm a little nervous about presenting Topfunky with such a rewrite as I'm sure his coder-fu is stronger than mine. But Toby encouraged me to do it anyway and perhaps he'll be thankful.

-Mat
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk