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) {
	
		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);
		}
	
		double[] array = MathUtils.toArray(copy);
	
		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) { 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); } double[] array = mathutils.toarray(copy); 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); }