public HistogramDataset getHistogramDataset(final int nBins) {
    HistogramDataset output = new HistogramDataset();
    output.setType(HistogramType.RELATIVE_FREQUENCY);
    ArrayList<Double> croppedData = new ArrayList<Double>();

    for (String mode : this.rawData.keySet()) {
      for (double d : this.rawData.get(mode).getElements()) {
        if (d < this.maxXYForPlotting) {
          croppedData.add(d);
        }
      }
      output.addSeries(mode, Utils.convert(croppedData), nBins);
    }
    return output;
  }