Package org.jfree.data.statistics

Examples of org.jfree.data.statistics.HistogramBin


            formatter.format( "\\definecolor{%s}{rgb}{%.2f, %.2f, %.2f}%n",
                              colorString, color.getRed()/255.0, color.getGreen()/255.0,
                              color.getBlue()/255.0);
         }

         HistogramBin currentBin=null;
         while(iter.hasNext()) {
            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) )
            {
               var = Math.min( currentBin.getEndBoundary(), xmax);
               if (filled[i]) {
                  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);
              }
              else {
                  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) )
            { // Cas ou notre rectangle ne peut pas etre affiche en entier (trop haut)
               var = Math.min( currentBin.getEndBoundary(), xmax);
               if (filled[i]) {
                  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);
               }
               else {
                  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, (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);
               }
            }
         }
      }
View Full Code Here


      if (((CustomHistogramDataset)this.dataset.getSeriesCollection()).getBinWidth(s) == -1){
         DoubleArrayList newTicks = new DoubleArrayList();
         ListIterator binsIter = ((HistogramSeriesCollection)this.dataset).getBins(s).listIterator();

         int i = 0;
         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());
            }
         }
         XAxis.setLabels(newTicks.elements());
      }
      else {
View Full Code Here

    *     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);
   }
View Full Code Here

    *     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 (type == HistogramType.FREQUENCY)
         return new Double(bin.getCount());
      if (type == HistogramType.RELATIVE_FREQUENCY)
         return new Double((double)bin.getCount() / total);
      if (type == HistogramType.SCALE_AREA_TO_1)
         return new Double((double)bin.getCount() / (binWidth * total));
      else
         throw new IllegalStateException();
   }
View Full Code Here

    *     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

    *     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

     */
    public void testEquals() {
       
        final double start = 10.0;
        final double end = 20.0;
        final HistogramBin b1 = new HistogramBin(start, end);
        final HistogramBin b2 = new HistogramBin(start, end);
       
        assertTrue(b1.equals(b2));
        assertTrue(b2.equals(b1));

    }
View Full Code Here

     * Confirm that cloning works.
     */
    public void testCloning() {
        final double start = 10.0;
        final double end = 20.0;
        final HistogramBin b1 = new HistogramBin(start, end);
        HistogramBin b2 = null;
        try {
            b2 = (HistogramBin) b1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("Failed to clone.");
        }
        assertTrue(b1 != b2);
        assertTrue(b1.getClass() == b2.getClass());
        assertTrue(b1.equals(b2));
    }
View Full Code Here

     */
    public void testSerialization() {

        final double start = 10.0;
        final double end = 20.0;
        final HistogramBin b1 = new HistogramBin(start, end);
        HistogramBin b2 = null;

        try {
            final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            final ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(b1);
View Full Code Here

     */
    public void testEquals() {
       
        double start = 10.0;
        double end = 20.0;
        HistogramBin b1 = new HistogramBin(start, end);
        HistogramBin b2 = new HistogramBin(start, end);
       
        assertTrue(b1.equals(b2));
        assertTrue(b2.equals(b1));

    }
View Full Code Here

TOP

Related Classes of org.jfree.data.statistics.HistogramBin

Copyright © 2018 www.massapicom. 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.