/** * Returns the start value for a bin. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (zero based). * * @return The start value. * * @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()); }
/** * Returns the start value for a bin. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * @param item the item index (zero based). * * @return The start value. * * @throws IndexOutOfBoundsException if {@code series} is outside the * specified range. */ @Override public Number getStartX(int series, int item) { List bins = getBins(series); HistogramBin bin = (HistogramBin) bins.get(item); return new Double(bin.getStartBoundary()); }
/** * Returns the start value for a bin. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (zero based). * * @return The start value. * * @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()); }
/** * Returns the X value for a bin. This value won't be used for plotting * histograms, since the renderer will ignore it. But other renderers can * use it (for example, you could use the dataset to create a line * chart). * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (zero based). * * @return The start value. * * @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); }
/** * Returns the X value for a bin. This value won't be used for plotting * histograms, since the renderer will ignore it. But other renderers can * use it (for example, you could use the dataset to create a line * chart). * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * @param item the item index (zero based). * * @return The start value. * * @throws IndexOutOfBoundsException if {@code series} is outside the * specified range. */ @Override 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); }
/** * Returns the X value for a bin. This value won't be used for plotting * histograms, since the renderer will ignore it. But other renderers can * use it (for example, you could use the dataset to create a line * chart). * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (zero based). * * @return The start value. * * @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()) / 2D; return new Double(x); }
/** * Synchronize values to bins. Compute bins values. * * @param bins List of bins. * @param values List of values. */ 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; } } } }
double currentMargin; currentBin = (HistogramBin)iter.next(); currentMargin = ((margin*(currentBin.getEndBoundary()-currentBin.getStartBoundary())))*XScale; if ((currentBin.getStartBoundary() >= xmin && currentBin.getStartBoundary() <= xmax) && (currentBin.getCount() >= ymin && currentBin.getCount() <= ymax) ) formatter.format("\\filldraw [line width=%.2fpt, opacity=%.2f, color=%s] ([xshift=%.4f] %.4f, %.4f) rectangle ([xshift=-%.4f] %.4f, %.4f); %%%n", lineWidth[i], (color.getAlpha()/255.0), colorString, currentMargin, (currentBin.getStartBoundary()-XShift)*XScale, 0.0, currentMargin, (var-XShift)*XScale, (currentBin.getCount()-YShift)*YScale); formatter.format("\\draw [line width=%.2fpt, color=%s] ([xshift=%.4f] %.4f, %.4f) rectangle ([xshift=-%.4f] %.4f, %.4f); %%%n", lineWidth[i], colorString, currentMargin, (currentBin.getStartBoundary()-XShift)*XScale, 0.0, currentMargin, (var-XShift)*XScale, (currentBin.getCount()-YShift)*YScale); else if ( (currentBin.getStartBoundary() >= xmin && currentBin.getStartBoundary() <= xmax) && (currentBin.getCount() >= ymin && currentBin.getCount() > ymax) ) formatter.format("\\filldraw [line width=%.2fpt, opacity=%.2f, color=%s] ([xshift=%.4f] %.4f, %.4f) rectangle ([xshift=-%.4f] %.4f, %.4f); %%%n", lineWidth[i], (color.getAlpha()/255.0), colorString, currentMargin, (currentBin.getStartBoundary()-XShift)*XScale, 0.0, currentMargin, (var-XShift)*XScale, (ymax-YShift)*YScale); formatter.format("\\draw [line width=%.2fpt, color=%s, style=dotted] ([xshift=%.4f] %.4f, %.4f) rectangle ([yshift=3mm, xshift=-%.4f] %.4f, %.4f); %%%n", lineWidth[i], colorString, currentMargin, (currentBin.getStartBoundary()-XShift)*XScale, (ymax-YShift)*YScale, currentMargin, (var-XShift)*XScale, (ymax-YShift)*YScale); formatter.format("\\draw [line width=%.2fpt, color=%s] ([xshift=%.4f] %.4f, %.4f) rectangle ([xshift=-%.4f] %.4f, %.4f); %%%n",
HistogramBin prec = (HistogramBin)binsIter.next(); double var; newTicks.add(prec.getStartBoundary()); newTicks.add(var = prec.getEndBoundary()); HistogramBin temp; while(binsIter.hasNext()) { temp = (HistogramBin)binsIter.next(); if(temp.getStartBoundary() != var) { newTicks.add(var = temp.getStartBoundary()); } else if(temp.getEndBoundary() != var) { newTicks.add(var = temp.getEndBoundary());