private void init() {

    double[] tempYAxisData = new double[numBins];
    final double binSize = (max - min) / numBins;

    // y axis data
    Iterator<? extends Number> itr = originalData.iterator();
    while (itr.hasNext()) {

      double doubleValue = ((Number) itr.next()).doubleValue();
      int bin = (int) ((doubleValue - min) / binSize); // changed this from numBins
      if (bin < 0) { /* this data is smaller than min */
        // System.out.println("less than");
      }
      else if (doubleValue == max) { // the value falls exactly on the max value
        tempYAxisData[bin - 1] += 1;
      }
      else if (bin > numBins || bin == numBins) { /* this data point is bigger than max */
        // System.out.println("greater than");
      }
      else {
        tempYAxisData[bin] += 1;
      }
    }
    yAxisData = new ArrayList<Double>(numBins);
    for (double d : tempYAxisData) {
      yAxisData.add(d);
    }

    // x axis data
    xAxisData = new ArrayList<Double>(numBins);
    for (int i = 0; i < numBins; i++) {
      xAxisData.add(((i * (max - min)) / numBins + min) + binSize / 2);
    }
  }