flot/flot — pull request #46 by markrcote (2012-06-08 15:45:49+00:00)
Title: Fix minTickSize for year units

This should fix issue 195 (http://code.google.com/p/flot/issues/detail?id=195). flot was ignoring minTickSizes given in years (the tick spec ends with [1, "year"], but the comment indicates that all integer values for "year" should be supported). The automatic tick calculation for years was also broken when the time range was less than about 5.5 years.

I'm not super crazy about the slight redundancy in the year special-case clause; I think if minTickSize was given in years we could actually skip the size/unit calculation for loop above it. However that would mean yet another if clause that looks at minTickSize, and we'd still need to execute the special-case clause in any case because the size/unit calculation determines the unit if no minTickSize is given (or if a weird minTickSize is given, such as [24, "month"]). So, while slightly redundant, this is probably clearer than the alternative (or at least any alternative I can think of at the moment). And the redundancy was already there. :)