Keep number of bins below 100, or Google Charts won't work.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@50 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-02-05 20:12:56 +00:00
parent 764952865a
commit 755b01c2c4

View File

@ -70,11 +70,15 @@ public class NumericBinIndex {
_max = (Math.ceil(_max / _step) * _step);
int binCount = 1 + (int) Math.ceil((getMax() - getMin()) / getStep());
if (binCount > 100) {
_step *= 2;
binCount = Math.round((1 + binCount) / 2);
}
_bins = new int[binCount];
for (double d : allValues) {
int bin = (int) Math.round((d - getMin()) / getStep());
getBins()[bin]++;
int bin = (int) Math.round((d - _min) / _step);
_bins[bin]++;
}
}