Example usage for org.jfree.data.statistics DefaultBoxAndWhiskerCategoryDataset getColumnCount

List of usage examples for org.jfree.data.statistics DefaultBoxAndWhiskerCategoryDataset getColumnCount

Introduction

In this page you can find the example usage for org.jfree.data.statistics DefaultBoxAndWhiskerCategoryDataset getColumnCount.

Prototype

@Override
public int getColumnCount() 

Source Link

Document

Returns the number of columns in the table.

Usage

From source file:org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDatasetTest.java

/**
 * Some basic checks for the constructor.
 */// w ww. j av a 2 s.  com
@Test
public void testConstructor() {
    DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
    assertEquals(0, dataset.getColumnCount());
    assertEquals(0, dataset.getRowCount());
    assertTrue(Double.isNaN(dataset.getRangeLowerBound(false)));
    assertTrue(Double.isNaN(dataset.getRangeUpperBound(false)));
}

From source file:adapters.BoxSeriesCollectionAdapter.java

/**
 * Returns the range (<SPAN CLASS="MATH"><I>y</I></SPAN>-coordinates) min and max values.
 *
 * @return range min and max values.// w  w w.  j a v  a  2 s  . c om
 *
 */
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;
}

From source file:umontreal.iro.lecuyer.charts.BoxSeriesCollection.java

/**
 * Adds a data series into the series collection. Vector <TT>data</TT> represents
 *    a point set. Only <SPAN  CLASS="textit">the first</SPAN> <TT>numPoints</TT> of 
 *    <TT>data</TT> will be added to the new series.
 * //from w w  w .  j  a va  2s.c om
 * @param data Point set
 * 
 *    @param numPoints Number of points to add
 * 
 *    @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;
}

From source file:adapters.BoxSeriesCollectionAdapter.java

/**
 * Modified Method: change label from serie to Cluster plus the number of instances in the cluster
 *
 * Adds a data series into the series collection. Vector <TT>data</TT> represents
 *    a point set. Only <SPAN  CLASS="textit">the first</SPAN> <TT>numPoints</TT> of
 *    <TT>data</TT> will be added to the new series.
 *
 * @param data Point set// w  w w.  j a  v  a  2 s.c  om
 *
 *    @param numPoints Number of points to add
 *
 *    @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();

    // "count + 1" since the cluster label should start with 1 instead of 0
    tempSeriesCollection.add(list, 0, "[ " + numPoints + " ]");
    return count;
}