package de.lmu.ifi.dbs.elki.visualization.scales;

import de.lmu.ifi.dbs.elki.algorithm.AbortException;
import de.lmu.ifi.dbs.elki.data.DoubleVector;
import de.lmu.ifi.dbs.elki.database.Database;
import de.lmu.ifi.dbs.elki.math.DoubleMinMax;

/**
 * Scales helper class.
 * Currently, this will just compute a linear scale for each axis.
 * It is planned to add functionality to include some analysis to
 * be able to automatically choose log scales when appropriate. 
 * 
 * @author Erich Schubert
 *
 */
public class Scales {
  /**
   * Compute a linear scale for each dimension.
   * 
   * @param <O> vector type
   * @param db Database
   * @return Scales, indexed starting with 1 (just like the database)
   */
  public static <O extends DoubleVector> LinearScale[] calcScales(Database<O> db) {
    if (db == null) {
      throw new AbortException("No database was given to Scales.calcScales.");
    }
    int dim = db.dimensionality();
    DoubleMinMax minmax[] = DoubleMinMax.newArray(dim);
    LinearScale scales[] = new LinearScale[dim+1];
  
    // analyze data
    for(Integer objId : db.getIDs()) {
      DoubleVector v = db.get(objId);
      for(int d = 0; d < dim; d++) {
        minmax[d].put(v.getValue(d+1));
      }
    }
  
    // generate scales
    scales[0] = null;
    for(int d = 0; d < dim; d++) {
      scales[d+1] = new LinearScale(minmax[d].getMin(), minmax[d].getMax());
    }
    return scales;
  }

}

@@ -129,22 +129,22 @@
 ki.data.
-Double
+Number
 Vector;%0A
@@ -736,28 +736,33 @@
 extends 
-Double
+Number
 Vector
+%3C?,?%3E
 %3E Linear
@@ -1119,20 +1119,25 @@
     
-Double
+Number
 Vector
+%3C?,?%3E
  v =
@@ -1226,16 +1226,30 @@
 lue(d+1)
+.doubleValue()
 );%0A     

Use NumberVector instead of DoubleVector