potch/statsdash — pull request #2 by jsocol (2011-11-11 15:12:45+00:00)
Title: Dynamic tile size/shape

This isn't ready to merge, I was tired and there's probably some hacky bullshit that could be way better--also I just copied one tile into AMO two more times for testing--but I think it's actually doing a solid job of picking tile sizes now. I picked a target aspect ratio of 7:3 and it definitely prefers sparkline-style graphs to a row of boxes (you need to shrink the screen pretty far, vertically, for it to decide to use 6x1, but it shifts from 2x3 to 3x2 in a totally reasonable space, and shrinking it horizontally gets to 1x6 pretty quick).

So, feedback is welcome! (Ping @rlr as well.) This works out of the box and doesn't require any other changes, which is pretty sweet. But obviously the ability to pick how many graphs I want would be super-awesome.

It will probably degenerate for primes > 5 or so. We might eventually decide to put in some special casing for common ones, maybe 5, 7, 11, but I deferred that for now.