If you've ever drawn a graph (manually or with a computer), you know that you have to pick upper and lower bounds for the x and y axes based on the data points you're graphing. Usually, this is a relatively simple matter, but, at least for me, it's proven to be a difficult problem to solve in a general manner.
I've built some time-based charting components with SVG (because CFCHART sucks), and while they work very well, I simply can't find an algorithm for finding appropriate bounds that works effectively. My first thought was to extend the range a few percent above and below the min and max, but that usually ends up with grid lines labels that are ugly (1, 1.333333, 1.6666666, 2, etc.).
I'm currently using an implementation that scales based on the number of gridlines, applied to the order of magnitude of the range boundaries. It works pretty well, except where the order of magnitude changes close to a boundary. I.e. if the range is from 0.01 up to 1.01, the scale will end up being from 0 to 10, which isn't desirable, because the top 89% of the chart is empty.
So with the success of my last to "fishing for feedback" posts (on BlogCFC, and tabbed documents), here's the next inline. I'd love to hear about other people's solutions to this sort of problem, because it's quite a nasty one (or I'm an idiot and missing the obvious).