Package org.jfree.data.statistics

Examples of org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset


    */
   public BoxSeriesCollection (double[] data, int numPoints)  {
      renderer = new BoxAndWhiskerRenderer();

      ((BoxAndWhiskerRenderer)renderer).setMaximumBarWidth(BARWIDTH);
      seriesCollection = new DefaultBoxAndWhiskerCategoryDataset ();

      DefaultBoxAndWhiskerCategoryDataset tempSeriesCollection =
            (DefaultBoxAndWhiskerCategoryDataset)seriesCollection;

      final List<Double> list = new ArrayList<Double>();
      for (int i = 0; i < numPoints; i ++)
         list.add(data[i]);

      tempSeriesCollection.add(list, 0, 0);
   }
View Full Code Here


    *
    *
    */
   public BoxSeriesCollection (double[]... data)  {
      renderer = new BoxAndWhiskerRenderer();
      seriesCollection = new DefaultBoxAndWhiskerCategoryDataset ();

      DefaultBoxAndWhiskerCategoryDataset tempSeriesCollection =
            (DefaultBoxAndWhiskerCategoryDataset)seriesCollection;

      for (int i = 0; i < data.length; i ++) {
         if (data[i].length == 0)
            throw new IllegalArgumentException("Unable to render the plot. data["
                                                   + i +"] contains no row");
         final List<Double> list = new ArrayList<Double>();
         for (int j = 0; j < data[i].length-1; j ++)
            list.add(data[i][j]);
         tempSeriesCollection.add(list, 0, "Serie " + i);
         list.clear();
      }
      ((BoxAndWhiskerRenderer)renderer).setMaximumBarWidth(BARWIDTH);
   }
View Full Code Here

    *
    *    @return Integer that represent the new point set's position in the JFreeChart <TT>DefaultBoxAndWhiskerXYDataset</TT> object.
    *
    */
   public int add (double[] data, int numPoints)  {
      DefaultBoxAndWhiskerCategoryDataset tempSeriesCollection =
            (DefaultBoxAndWhiskerCategoryDataset)seriesCollection;

      final List<Double> list = new ArrayList<Double>();
      for (int i = 0; i < numPoints; i ++)
         list.add(data[i]);

      int count = tempSeriesCollection.getColumnCount();
      tempSeriesCollection.add(list, 0, "Serie " + count);
      return count;
   }
View Full Code Here

    * @return range min and max values.
    *
    */
   public double[] getRangeBounds()  {
      double max=0, min=0;
      DefaultBoxAndWhiskerCategoryDataset tempSeriesCollection =
            (DefaultBoxAndWhiskerCategoryDataset)seriesCollection;

      if(tempSeriesCollection.getColumnCount() != 0 && tempSeriesCollection.getRowCount() != 0) {
         max = tempSeriesCollection.getItem(0, 0).getMaxOutlier().doubleValue() ;
         min = tempSeriesCollection.getItem(0, 0).getMinOutlier().doubleValue() ;
      }

      for(int i = 0; i < tempSeriesCollection.getRowCount(); i++) {
         for( int j = 0; j < tempSeriesCollection.getColumnCount(); j++) {
            max = Math.max(max, tempSeriesCollection.getItem(i, j).getMaxOutlier().doubleValue() );
            min = Math.min(min, tempSeriesCollection.getItem(i, j).getMinOutlier().doubleValue() );
         }
      }

      double[] retour = {min, max};
      return retour;
View Full Code Here

                    }
                }
            }

            // molecular mass plot
            DefaultBoxAndWhiskerCategoryDataset mwPlotDataset = new DefaultBoxAndWhiskerCategoryDataset();

            HashMap<String, XYDataPoint> molecularWeights = peptideShakerGUI.getSearchParameters().getFractionMolecularWeightRanges();
            ArrayList<String> spectrumFiles = peptideShakerGUI.getIdentification().getOrderedSpectrumFileNames();

            for (int i = 0; i < spectrumFiles.size(); i++) {

//                Double mw = null;
//
//                if (molecularWeights != null) {
//                    mw = molecularWeights.get(spectrumFiles.get(i));
//                }
                //mwPlotDataset.addValue(mw, "Expected MW", "" + (i + 1));
                try {
                    if (peptideShakerGUI.getMetrics().getObservedFractionalMassesAll().containsKey(spectrumFiles.get(i))) {
                        mwPlotDataset.add(peptideShakerGUI.getMetrics().getObservedFractionalMassesAll().get(spectrumFiles.get(i)), "Observed MW (kDa)", "" + (i + 1));
                    } else {
                        mwPlotDataset.add(new ArrayList<Double>(), "Observed MW (kDa)", "" + (i + 1));
                    }
                } catch (ClassCastException e) {
                    // do nothing, no data to show
                }
            }
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
       
        final DefaultBoxAndWhiskerCategoryDataset d1 = new DefaultBoxAndWhiskerCategoryDataset();
        d1.add(
            new BoxAndWhiskerItem(
                new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0),
                new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0),
                new ArrayList()
            ), "ROW1", "COLUMN1"
        );
        final DefaultBoxAndWhiskerCategoryDataset d2 = new DefaultBoxAndWhiskerCategoryDataset();
        d2.add(
            new BoxAndWhiskerItem(
                new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0),
                new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0),
                new ArrayList()
            ), "ROW1", "COLUMN1"
        );
        assertTrue(d1.equals(d2));
        assertTrue(d2.equals(d1));

    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        final DefaultBoxAndWhiskerCategoryDataset d1 = new DefaultBoxAndWhiskerCategoryDataset();
        d1.add(
            new BoxAndWhiskerItem(
                new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0),
                new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0),
                new ArrayList()
            ), "ROW1", "COLUMN1"
        );
        DefaultBoxAndWhiskerCategoryDataset d2 = null;
       
        try {
            final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            final ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(d1);
View Full Code Here

     * no exceptions are thrown (particularly by code in the renderer).
     */
    public void testDrawWithNullInfo() {
        boolean success = false;
        try {
            DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
            dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                    new Double(0.0), new Double(4.0), new Double(0.5),
                    new Double(4.5), new Double(-0.5), new Double(5.5),
                    null), "S1", "C1");
            CategoryPlot plot = new CategoryPlot(dataset,
                    new CategoryAxis("Category"), new NumberAxis("Value"),
View Full Code Here

   
    /**
     * A check for bug 1572478 (for the vertical orientation).
     */
    public void testBug1572478Vertical() {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset() {
               
            public Number getQ1Value(int row, int column) {
                return null;
            }

            public Number getQ1Value(Comparable rowKey, Comparable columnKey) {
                return null;
            }
        };
        List values = new ArrayList();
        values.add(new Double(1.0));
        values.add(new Double(10.0));
        values.add(new Double(100.0));
        dataset.add(values, "row", "column");
        CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"),
                new NumberAxis("y"), new BoxAndWhiskerRenderer());
        JFreeChart chart = new JFreeChart(plot);
        boolean success = false;

View Full Code Here

    /**
     * A check for bug 1572478 (for the horizontal orientation).
     */
    public void testBug1572478Horizontal() {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset() {
               
            public Number getQ1Value(int row, int column) {
                return null;
            }

            public Number getQ1Value(Comparable rowKey, Comparable columnKey) {
                return null;
            }
        };
        List values = new ArrayList();
        values.add(new Double(1.0));
        values.add(new Double(10.0));
        values.add(new Double(100.0));
        dataset.add(values, "row", "column");
        CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"),
                new NumberAxis("y"), new BoxAndWhiskerRenderer());
        plot.setOrientation(PlotOrientation.HORIZONTAL);
        JFreeChart chart = new JFreeChart(plot);
        boolean success = false;
View Full Code Here

TOP

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

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.