Example usage for org.jfree.data.statistics BoxAndWhiskerItem getMaxRegularValue

List of usage examples for org.jfree.data.statistics BoxAndWhiskerItem getMaxRegularValue

Introduction

In this page you can find the example usage for org.jfree.data.statistics BoxAndWhiskerItem getMaxRegularValue.

Prototype

public Number getMaxRegularValue() 

Source Link

Document

Returns the maximum regular value.

Usage

From source file:gui.TraitViewerDialog.java

@SuppressWarnings("rawtypes")
private ChartPanel getChart(int selectedRow) {

    ArrayList<Float> data = new ArrayList<Float>();
    for (float[] row : tFile.getRows()) {
        if (row[selectedRow + 1] != (float) -99.0) {
            data.add(row[selectedRow + 1]);
        }/*  w ww. java  2  s . co m*/
    }
    BoxAndWhiskerItem a = BoxAndWhiskerCalculator.calculateBoxAndWhiskerStatistics(data);
    java.util.List l = new ArrayList(0);

    a = new BoxAndWhiskerItem(a.getMean(), a.getMedian(), a.getQ1(), a.getQ3(), a.getMinRegularValue(),
            a.getMaxRegularValue(), a.getMinRegularValue(), a.getMaxRegularValue(), l);
    traitstats.setText(showBoxAndWhiskerItem(a));

    DefaultBoxAndWhiskerCategoryDataset ds2 = new DefaultBoxAndWhiskerCategoryDataset();

    ds2.add(a, (Comparable) 1, (Comparable) 1);
    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(null, null, null, ds2, false);

    chart.removeLegend();

    // XYPlot plot = chart.getXYPlot();
    CategoryPlot plot = chart.getCategoryPlot();
    plot.getDomainAxis().setVisible(false);
    BoxAndWhiskerRenderer b = (BoxAndWhiskerRenderer) plot.getRenderer();
    // b.setFillBox(false);
    b.setSeriesPaint(0, new Color(236, 55, 169));
    b.setSeriesOutlinePaint(1, new Color(131, 79, 112));
    b.setBaseOutlineStroke(new BasicStroke(1.0f));
    // b.get
    b.setWhiskerWidth(0.8);
    b.setBaseOutlinePaint(new Color(84, 144, 201));
    b.setDefaultEntityRadius(2);
    b.setMaximumBarWidth(0.18);

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPopupMenu(null);
    return chartPanel;
}

From source file:gui.TraitViewerDialog.java

private String showBoxAndWhiskerItem(BoxAndWhiskerItem a) {
    String r = "";
    r += "mean: " + a.getMean() + "\n";
    r += "median: " + a.getMedian() + "\n";
    r += "25%: " + a.getQ1() + "\n";
    r += "75%: " + a.getQ3() + "\n";
    r += "minreg: " + a.getMinRegularValue() + "\n";
    r += "maxreg: " + a.getMaxRegularValue() + "\n";
    r += "minoutl: " + a.getMinOutlier() + "\n";
    r += "maxoutl: " + a.getMaxOutlier() + "\n";
    if (a.getOutliers() != null) {
        r += "outliers: " + a.getOutliers().toString() + "\n";
    }/*from   ww w  . ja va2 s. c  o  m*/
    return r;
}

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

/**
 * Returns the max-value for the specified series and item.
 *
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The max-value for the specified series and item.
 *///from w  w w .  j  a va2 s.c o  m
@Override
public Number getMaxRegularValue(int series, int item) {
    Number result = null;
    BoxAndWhiskerItem stats = this.items.get(item);
    if (stats != null) {
        result = stats.getMaxRegularValue();
    }
    return result;
}

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

/**
 * Returns the maximum regular (non outlier) value for an item.
 *
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 *
 * @return The maximum regular value.//from   w  w  w. j  a  v  a 2 s . com
 *
 * @see #getItem(int, int)
 */
@Override
public Number getMaxRegularValue(int row, int column) {
    Number result = null;
    BoxAndWhiskerItem item = (BoxAndWhiskerItem) this.data.getObject(row, column);
    if (item != null) {
        result = item.getMaxRegularValue();
    }
    return result;
}

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

/**
 * Returns the maximum regular (non outlier) value for an item.
 *
 * @param rowKey  the row key.// ww  w  .  j a v a2  s.  c om
 * @param columnKey  the column key.
 *
 * @return The maximum regular value.
 *
 * @see #getItem(int, int)
 */
@Override
public Number getMaxRegularValue(Comparable rowKey, Comparable columnKey) {
    Number result = null;
    BoxAndWhiskerItem item = (BoxAndWhiskerItem) this.data.getObject(rowKey, columnKey);
    if (item != null) {
        result = item.getMaxRegularValue();
    }
    return result;
}

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

/**
 * Adds an item to the dataset and sends a {@link DatasetChangeEvent} to
 * all registered listeners./* w w w  . ja  va2s.c om*/
 *
 * @param date  the date (<code>null</code> not permitted).
 * @param item  the item (<code>null</code> not permitted).
 */
public void add(Date date, BoxAndWhiskerItem item) {
    this.dates.add(date);
    this.items.add(item);
    if (this.minimumRangeValue == null) {
        this.minimumRangeValue = item.getMinRegularValue();
    } else {
        if (item.getMinRegularValue().doubleValue() < this.minimumRangeValue.doubleValue()) {
            this.minimumRangeValue = item.getMinRegularValue();
        }
    }
    if (this.maximumRangeValue == null) {
        this.maximumRangeValue = item.getMaxRegularValue();
    } else {
        if (item.getMaxRegularValue().doubleValue() > this.maximumRangeValue.doubleValue()) {
            this.maximumRangeValue = item.getMaxRegularValue();
        }
    }
    this.rangeBounds = new Range(this.minimumRangeValue.doubleValue(), this.maximumRangeValue.doubleValue());
    fireDatasetChanged();
}