protected static int getPreferredColumns ( double width , double height , int numc , double maxwidth ) { // Maximum width (compared to height) of labels - guess. // FIXME: do we really need to do this three-step computation? // Number of rows we'd use in a squared layout: final double rows = Math . ceil ( FastMath . pow ( numc * maxwidth , height / ( width + height ) ) ) ; // Given this number of rows (plus one for header), use this many columns: return ( int ) Math . ceil ( numc / ( rows + 1 ) ) ; }
Compute the preferred number of columns .