use of org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset in project cytoscape-impl by cytoscape.
the class BoxLayer method createDataset.
// ==[ PRIVATE METHODS ]============================================================================================
@Override
protected BoxAndWhiskerCategoryDataset createDataset() {
final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
for (String series : data.keySet()) {
final List<Double> values = data.get(series);
// switch series and category name so labels are displayed for series
dataset.add(values, series, "1");
}
return dataset;
}
use of org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset in project SIMVA-SoS by SESoS.
the class BoxAndWhiskerRendererTest method testBug1572478Vertical.
/**
* A check for bug 1572478 (for the vertical orientation).
*/
@Test
public void testBug1572478Vertical() {
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset() {
@Override
public Number getQ1Value(int row, int column) {
return null;
}
@Override
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;
try {
BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, new ChartRenderingInfo());
g2.dispose();
success = true;
} catch (Exception e) {
success = false;
}
assertTrue(success);
}
use of org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset in project SIMVA-SoS by SESoS.
the class BoxAndWhiskerRendererTest method testDrawWithNullMinOutlier.
/**
* Draws a chart where the dataset contains a null min outlier value.
*/
@Test
public void testDrawWithNullMinOutlier() {
boolean success;
try {
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(0.5), new Double(4.5), null, new Double(5.5), null), "S1", "C1");
CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer());
ChartRenderingInfo info = new ChartRenderingInfo();
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */
chart.createBufferedImage(300, 200, info);
success = true;
} catch (Exception e) {
success = false;
}
assertTrue(success);
}
use of org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset in project SIMVA-SoS by SESoS.
the class BoxAndWhiskerRendererTest method testBug1572478Horizontal.
/**
* A check for bug 1572478 (for the horizontal orientation).
*/
@Test
public void testBug1572478Horizontal() {
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset() {
@Override
public Number getQ1Value(int row, int column) {
return null;
}
@Override
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;
try {
BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, new ChartRenderingInfo());
g2.dispose();
success = true;
} catch (Exception e) {
success = false;
}
assertTrue(success);
}
use of org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset in project SIMVA-SoS by SESoS.
the class BoxAndWhiskerRendererTest method testDrawWithNullMean.
/**
* Draws a chart where the dataset contains a null mean value.
*/
@Test
public void testDrawWithNullMean() {
boolean success;
try {
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(null, 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"), new BoxAndWhiskerRenderer());
ChartRenderingInfo info = new ChartRenderingInfo();
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */
chart.createBufferedImage(300, 200, info);
success = true;
} catch (Exception e) {
success = false;
}
assertTrue(success);
}
Aggregations