Examples of HistogramBin


Examples of org.jfree.data.statistics.HistogramBin

   * @throws IndexOutOfBoundsException
   *             if <code>series</code> is outside the specified range.
   */
  public Number getStartX(int series, int item) {
    List bins = getBins(series);
    HistogramBin bin = (HistogramBin) bins.get(item);
    return new Double(bin.getStartBoundary());
  }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

   * @throws IndexOutOfBoundsException
   *             if <code>series</code> is outside the specified range.
   */
  public Number getEndX(int series, int item) {
    List bins = getBins(series);
    HistogramBin bin = (HistogramBin) bins.get(item);
    return new Double(bin.getEndBoundary());
  }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

    double lower = minimum;
    double upper;
    List<HistogramBin> binList = new ArrayList<HistogramBin>(numOfBins);
    for (int i = 0; i < numOfBins; i++) {
      HistogramBin bin;
      // make sure bins[bins.length]'s upper boundary ends at maximum
      // to avoid the rounding issue. the bins[0] lower boundary is
      // guaranteed start from min
      if (i == numOfBins - 1) {
        bin = new HistogramBin(lower, maximum);
      } else {
        upper = minimum + (i + 1) * binWidth;
        bin = new HistogramBin(lower, upper);
        lower = upper;
      }
      binList.add(bin);
    }
    // fill the bins
    for (int i = 0; i < values.length; i++) {
      int binIndex = numOfBins - 1;
      if (values[i] < maximum) {
        double fraction = (values[i] - minimum) / (maximum - minimum);
        if (fraction < 0.0) {
          fraction = 0.0;
        }
        binIndex = (int) (fraction * numOfBins);
        if (binIndex >= numOfBins) {
          binIndex = numOfBins - 1;
        }
      }
      HistogramBin bin = (HistogramBin) binList.get(binIndex);
      bin.incrementCount();

    }
    // generic map for each series
    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("key", key);
View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

   * @throws IndexOutOfBoundsException
   *             if <code>series</code> is outside the specified range.
   */
  public Number getX(int series, int item) {
    List bins = getBins(series);
    HistogramBin bin = (HistogramBin) bins.get(item);
    double x = (bin.getStartBoundary() + bin.getEndBoundary()) / 2.;
    return new Double(x);
  }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

   * @throws IndexOutOfBoundsException
   *             if <code>series</code> is outside the specified range.
   */
  public Number getY(int series, int item) {
    List bins = getBins(series);
    HistogramBin bin = (HistogramBin) bins.get(item);
    double total = getTotal(series);
    double binWidth = getBinWidth(series);

    if (this.type == HistogramType.FREQUENCY) {
      return new Double(bin.getCount());
    } else if (this.type == HistogramType.RELATIVE_FREQUENCY) {
      return new Double(bin.getCount() / total);
    } else if (this.type == HistogramType.SCALE_AREA_TO_1) {
      return new Double(bin.getCount() / (binWidth * total));
    } else { // pretty sure this shouldn't ever happen
      throw new IllegalStateException();
    }
  }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

   * @throws IndexOutOfBoundsException
   *             if <code>series</code> is outside the specified range.
   */
  public Number getStartX(int series, int item) {
    List bins = getBins(series);
    HistogramBin bin = (HistogramBin) bins.get(item);
    return new Double(bin.getStartBoundary());
  }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

   * @throws IndexOutOfBoundsException
   *             if <code>series</code> is outside the specified range.
   */
  public Number getEndX(int series, int item) {
    List bins = getBins(series);
    HistogramBin bin = (HistogramBin) bins.get(item);
    return new Double(bin.getEndBoundary());
  }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

      double binWidth = (maximum - minimum) / (double)bins;
      double lower = minimum;
      final double EPS = 1.0e-15;
      List binList = new ArrayList(bins);
      for (int i = 0; i < bins; i++) {
         HistogramBin bin;
         if (i == bins - 1) {
            bin = new HistogramBin(lower, maximum*(1.0 + EPS));
         } else {
            double upper = minimum + (double)(i + 1) * binWidth;
            bin = new HistogramBin(lower, upper);
            lower = upper;
         }
         binList.add(bin);
      }

View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

      double binWidth = (maximum - minimum) / (double)bins;
      double lower = minimum;
      List binList = new ArrayList(bins);
      double EPS = 1.0e-15;
      for (int i = 0; i < bins; i++) {
         HistogramBin bin;
         if (i == bins - 1) {
            bin = new HistogramBin(lower, maximum*(1.0 + EPS));
         } else {
            double upper = minimum + (double)(i + 1) * binWidth;
            bin = new HistogramBin(lower, upper);
            lower = upper;
         }
         binList.add(bin);
      }

View Full Code Here

Examples of org.jfree.data.statistics.HistogramBin

    */
   private void synchronizeValuesAndBins(List bins, List values)
   {
      ListIterator iterBins = bins.listIterator(0);
      ListIterator iterValues = values.listIterator();
      HistogramBin bin;
      for (; iterBins.hasNext(); iterBins.set(
            new HistogramBin(bin.getStartBoundary(), bin.getEndBoundary())))
         bin = (HistogramBin)iterBins.next();

      iterBins = bins.listIterator(0);
      while (iterValues.hasNext()) {
         double currentValue = ((Double)iterValues.next()).doubleValue();
         boolean continu = true;
         iterBins = bins.listIterator(0);
         while (continu && iterBins.hasNext()) {
            HistogramBin tempBin = (HistogramBin)iterBins.next();
            if (currentValue >= tempBin.getStartBoundary() &&
                currentValue <  tempBin.getEndBoundary()) {
               tempBin.incrementCount();
               continu = false;
            }
         }
      }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.