Java Code Examples for org.jfree.chart.ChartFactory#createBoxAndWhiskerChart()
The following examples show how to use
org.jfree.chart.ChartFactory#createBoxAndWhiskerChart() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XYBoxAndWhiskerRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * A test for bug report 2909215. */ @Test public void test2909215() { DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset( "Series"); d1.add(new Date(1L), 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), null, null, null)); JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X", "Y", d1, true); try { BufferedImage image = new BufferedImage(400, 200, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 2
Source File: XYBoxAndWhiskerRendererTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * A test for bug report 2909215. */ @Test public void test2909215() { DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset( "Series"); d1.add(new Date(1L), 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), null, null, null)); JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X", "Y", d1, true); try { BufferedImage image = new BufferedImage(400, 200, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 3
Source File: XYBoxAndWhiskerRendererTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * A test for bug report 2909215. */ @Test public void test2909215() { DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset( "Series"); d1.add(new Date(1L), 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), null, null, null)); JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X", "Y", d1, true); try { BufferedImage image = new BufferedImage(400, 200, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 4
Source File: XYBoxAndWhiskerRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * A test for bug report 2909215. */ @Test public void test2909215() { DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset( "Series"); d1.add(new Date(1L), 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), null, null, null)); JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X", "Y", d1, true); try { BufferedImage image = new BufferedImage(400, 200, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 5
Source File: XYBoxAndWhiskerRendererTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * A test for bug report 2909215. */ @Test public void test2909215() { DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset( "Series"); d1.add(new Date(1L), 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), null, null, null)); JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X", "Y", d1, true); try { BufferedImage image = new BufferedImage(400, 200, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 6
Source File: SimpleBox.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
public JFreeChart createChart(DatasetMap datasetMap) { BoxAndWhiskerCategoryDataset dataset=(BoxAndWhiskerCategoryDataset)datasetMap.getDatasets().get("1"); JFreeChart chart = ChartFactory.createBoxAndWhiskerChart( name, categoryLabel, valueLabel, dataset, false); TextTitle title =setStyleTitle(name, styleTitle); chart.setTitle(title); if(subName!= null && !subName.equals("")){ TextTitle subTitle =setStyleTitle(subName, styleSubTitle); chart.addSubtitle(subTitle); } CategoryPlot plot = (CategoryPlot) chart.getPlot(); BoxAndWhiskerRenderer renderer=(BoxAndWhiskerRenderer)plot.getRenderer(); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(new Color(Integer.decode("#c0c0c0").intValue())); plot.setDomainGridlinePaint(Color.WHITE); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); renderer.setFillBox(true); renderer.setArtifactPaint(Color.BLACK); renderer.setSeriesPaint(0,new Color(Integer.decode("#0000FF").intValue())); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setRange(min, max); return chart; }
Example 7
Source File: ServerWideReportManagerImpl.java From sakai with Educational Community License v2.0 | 5 votes |
private byte[] generateBoxAndWhiskerChart (BoxAndWhiskerCategoryDataset dataset, int width, int height) { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart (null, null, null, dataset, false); // set background chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); // set chart border chart.setPadding (new RectangleInsets (10, 5, 5, 5)); chart.setBorderVisible (true); chart.setBorderPaint (parseColor ("#cccccc")); // set anti alias chart.setAntiAlias (true); CategoryPlot plot = (CategoryPlot) chart.getPlot (); plot.setDomainGridlinePaint (Color.white); plot.setDomainGridlinesVisible (true); plot.setRangeGridlinePaint (Color.white); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); domainAxis.setLowerMargin (0.0); domainAxis.setUpperMargin (0.0); BufferedImage img = chart.createBufferedImage (width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
Example 8
Source File: ChartJFreeChartOutputScatter.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void createChart(final IScope scope) { super.createChart(scope); jfreedataset.add(0, new XYIntervalSeriesCollection()); PlotOrientation orientation = PlotOrientation.VERTICAL; if (reverse_axes) { orientation = PlotOrientation.HORIZONTAL; } switch (type) { case SERIES_CHART: case XY_CHART: case SCATTER_CHART: chart = ChartFactory.createXYLineChart(getName(), "", "", (XYIntervalSeriesCollection) jfreedataset.get(0), orientation, true, false, false); break; case BOX_WHISKER_CHART: { chart = ChartFactory.createBoxAndWhiskerChart(getName(), "Time", "Value", (BoxAndWhiskerCategoryDataset) jfreedataset.get(0), true); chart.setBackgroundPaint(new Color(249, 231, 236)); break; } } }
Example 9
Source File: ServerWideReportManagerImpl.java From sakai with Educational Community License v2.0 | 5 votes |
private byte[] generateBoxAndWhiskerChart (BoxAndWhiskerCategoryDataset dataset, int width, int height) { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart (null, null, null, dataset, false); // set background chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); // set chart border chart.setPadding (new RectangleInsets (10, 5, 5, 5)); chart.setBorderVisible (true); chart.setBorderPaint (parseColor ("#cccccc")); // set anti alias chart.setAntiAlias (true); CategoryPlot plot = (CategoryPlot) chart.getPlot (); plot.setDomainGridlinePaint (Color.white); plot.setDomainGridlinesVisible (true); plot.setRangeGridlinePaint (Color.white); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); domainAxis.setLowerMargin (0.0); domainAxis.setUpperMargin (0.0); BufferedImage img = chart.createBufferedImage (width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }