double[] findMinMax(Collection<?> data, AxisDataType axisType) {

    double min = Double.MAX_VALUE;
    double max = -Double.MAX_VALUE;

    for (Object dataPoint : data) {

      if (dataPoint == null) {
        continue;
      }

      double value = 0.0;

      if (axisType == AxisDataType.Number) {
        value = ((Number) dataPoint).doubleValue();
      }
      else if (axisType == AxisDataType.Date) {
        Date date = (Date) dataPoint;
        value = date.getTime();
      }
      else if (axisType == AxisDataType.String) {
        return new double[] { Double.NaN, Double.NaN };
      }
      if (value < min) {
        min = value;
      }
      if (value > max) {
        max = value;
      }
    }

    return new double[] { min, max };
  }