// Do a pass to compute range
public static HistogramChart fromData(Iterable<? extends Vector> data,
			int numBuckets) {
		// Do a pass to compute range
		double min = Double.MAX_VALUE, max = Double.MIN_VALUE;
		ArrayList<Double> copy = new ArrayList();
		for (Vector datum : data) {
			double x = datum.get(0);
			copy.add(x);
			min = Math.min(min, x);
			max = Math.max(max, x);
		}
		// TODO: Check min and max are sensible?
		double[] array = MathUtils.toArray(copy);
		// TODO: Allow the num of buckets to be specified
		HistogramData dist = new HistogramData(new GridInfo(min, max,
				numBuckets));
		for (int i = 0; i < array.length; i++) {
			dist.count(array[i]);
		}
		return new HistogramChart(dist);
	}
public static HistogramChart fromData(Iterable<? extends Vector> data,
int numBuckets) {
// Do a pass to compute range
double min = Double.MAX_VALUE, max = Double.MIN_VALUE;
ArrayList<Double> copy = new ArrayList();
public static HistogramChart fromData(Iterable<? extends Vector> data,
int numBuckets) {
// Do a pass to compute range
double min = Double.MAX_VALUE, max = Double.MIN_VALUE;
ArrayList<Double> copy = new ArrayList();
for (Vector datum : data) {
double x = datum.get(0);
copy.add(x);
min = Math.min(min, x);
max = Math.max(max, x);
}
// TODO: Check min and max are sensible?
double[] array = MathUtils.toArray(copy);
public static HistogramChart fromData(Iterable<? extends Vector> data,
int numBuckets) {
// Do a pass to compute range
double min = Double.MAX_VALUE, max = Double.MIN_VALUE;
ArrayList<Double> copy = new ArrayList();
for (Vector datum : data) {
double x = datum.get(0);
copy.add(x);
min = Math.min(min, x);
max = Math.max(max, x);
}
// TODO: Check min and max are sensible?
double[] array = MathUtils.toArray(copy);
// TODO: Allow the num of buckets to be specified
HistogramData dist = new HistogramData(new GridInfo(min, max,
numBuckets));
for (int i = 0; i < array.length; i++) {
dist.count(array[i]);
}
return new HistogramChart(dist);
}