public static void main(final String[] args) { log.info("start to write demo charts..."); Demo demo = new Demo(); demo.createBarChart("./output/barchart.png"); demo.createStackedBarChart("./output/stackedbarchart.png"); demo.createLineChart("./output/linechart.png"); demo.createXYLineChart("./output/xylinechart.png"); demo.createXYLogLogLineChart("./output/xylineloglogchart.png"); demo.createXYScatterChart("./output/xyscatterchart.png"); log.info("charts written to output directory at ./output/!"); } }
/** * Test that a file was really generated, and that the image, when loaded, has the specified size. * @throws IOException possible exception when reading the image for validation */ public void testLineChartDemo() throws IOException { String imageFilename = getOutputDirectory() + "linechart.png"; Demo demo = new Demo(); demo.createLineChart(imageFilename); File imagefile = new File(imageFilename); assertTrue(imagefile.exists()); BufferedImage image = ImageIO.read(imagefile); assertEquals(800, image.getWidth(null)); assertEquals(600, image.getHeight(null)); }
/** * Test that a file was really generated, and that the image, when loaded, has the specified size. * @throws IOException possible exception when reading the image for validation */ public void testBarChartDemo() throws IOException { System.setProperty("java.awt.headless", "true"); String imageFilename = getOutputDirectory() + "barchart.png"; Demo demo = new Demo(); demo.createBarChart(imageFilename); File imagefile = new File(imageFilename); assertTrue(imagefile.exists()); BufferedImage image = ImageIO.read(imagefile); assertEquals(800, image.getWidth(null)); assertEquals(600, image.getHeight(null)); }
/** * Test that a file was really generated, and that the image, when loaded, has the specified size. * @throws IOException possible exception when reading the image for validation */ public void testXYScatterChartDemo() throws IOException { String imageFilename = getOutputDirectory() + "xyscatterchart.png"; Demo demo = new Demo(); demo.createXYScatterChart(imageFilename); File imagefile = new File(imageFilename); assertTrue(imagefile.exists()); BufferedImage image = ImageIO.read(imagefile); assertEquals(800, image.getWidth(null)); assertEquals(600, image.getHeight(null)); }
/** * Test that a file was really generated, and that the image, when loaded, has the specified size. * @throws IOException possible exception when reading the image for validation */ public void testXYLineChartDemo() throws IOException { String imageFilename = getOutputDirectory() + "xylinechart.png"; Demo demo = new Demo(); demo.createXYLineChart(imageFilename); File imagefile = new File(imageFilename); assertTrue(imagefile.exists()); BufferedImage image = ImageIO.read(imagefile); assertEquals(800, image.getWidth(null)); assertEquals(600, image.getHeight(null)); }