use of org.jfree.data.statistics.BoxAndWhiskerItem in project tdq-studio-se by Talend.
the class TOPChartService method createDefaultBoxAndWhiskerCategoryDataset.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.service.ITOPChartService#createDefaultBoxAndWhiskerCategoryDataset(java.lang.Double,
* java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double)
*/
@Override
public Object createDefaultBoxAndWhiskerCategoryDataset(Double mean, Double median, Double q1, Double q3, Double minRegularValue, Double maxRegularValue) {
DefaultBoxAndWhiskerCategoryDataset dataset = ChartDatasetUtils.createBoxAndWhiskerDataset();
BoxAndWhiskerItem item = ChartDatasetUtils.createBoxAndWhiskerItem(mean, median, q1, q3, minRegularValue, maxRegularValue, null);
// $NON-NLS-1$ //$NON-NLS-2$
dataset.add(item, "0", "");
@SuppressWarnings("rawtypes") List zerolist = new ArrayList();
// $NON-NLS-1$ //$NON-NLS-2$
dataset.add(zerolist, "1", "");
// $NON-NLS-1$ //$NON-NLS-2$
dataset.add(zerolist, "2", "");
// $NON-NLS-1$ //$NON-NLS-2$
dataset.add(zerolist, "3", "");
// $NON-NLS-1$ //$NON-NLS-2$
dataset.add(zerolist, "4", "");
// $NON-NLS-1$ //$NON-NLS-2$
dataset.add(zerolist, "5", "");
// $NON-NLS-1$ //$NON-NLS-2$
dataset.add(zerolist, "6", "");
return dataset;
}
use of org.jfree.data.statistics.BoxAndWhiskerItem in project tdq-studio-se by Talend.
the class ChartDatasetUtils method createBoxAndWhiskerItem.
public static BoxAndWhiskerItem createBoxAndWhiskerItem(Double mean, Double median, Double q1, Double q3, Double minRegularValue, Double maxRegularValue, List outliers) {
// MOD scorreia 2008-06-05 automatic computation of outliers limits
// see http://en.wikipedia.org/wiki/Box_plot
Double xIQR = (q1 != null && q3 != null) ? OUTLIER_FACTOR * (q3 - q1) : null;
Double minOutlier = xIQR != null ? q1 - xIQR : null;
Double maxOutlier = xIQR != null ? q3 + xIQR : null;
// enhance bounds of graphics when needed
if (minOutlier != null && minRegularValue != null) {
minOutlier = Math.min(minOutlier, minRegularValue);
}
if (maxOutlier != null && maxRegularValue != null) {
maxOutlier = Math.max(maxOutlier, maxRegularValue);
}
BoxAndWhiskerItem item = new BoxAndWhiskerItem(mean, median, q1, q3, minRegularValue, maxRegularValue, minOutlier, maxOutlier, outliers);
return item;
}
use of org.jfree.data.statistics.BoxAndWhiskerItem in project SIMVA-SoS by SESoS.
the class BoxAndWhiskerRendererTest method testDrawWithNullQ1.
/**
* Draws a chart where the dataset contains a null Q1 value.
*/
@Test
public void testDrawWithNullQ1() {
boolean success;
try {
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), null, 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);
}
use of org.jfree.data.statistics.BoxAndWhiskerItem in project SIMVA-SoS by SESoS.
the class BoxAndWhiskerRendererTest method testDrawWithNullMedian.
/**
* Draws a chart where the dataset contains a null median value.
*/
@Test
public void testDrawWithNullMedian() {
boolean success;
try {
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(new Double(1.0), null, 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);
}
use of org.jfree.data.statistics.BoxAndWhiskerItem in project SIMVA-SoS by SESoS.
the class BoxAndWhiskerRendererTest method testDrawWithNullQ3.
/**
* Draws a chart where the dataset contains a null Q3 value.
*/
@Test
public void testDrawWithNullQ3() {
boolean success;
try {
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), null, 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