@ SuppressWarnings ( "nls" ) public void dumpChart ( File chartFile , boolean autoRange , boolean withLegend , int imageWidth , int imageHeight ) throws IOException { JFreeChart chart = ChartFactory . createXYLineChart ( title , xLabel , yLabel , collection , PlotOrientation . VERTICAL , withLegend , false , false ) ; XYPlot plot = ( XYPlot ) chart . getPlot ( ) ; // plot.setDomainPannable(true); // plot.setRangePannable(true); // plot.setForegroundAlpha(0.85f); NumberAxis yAxis = ( NumberAxis ) plot . getRangeAxis ( ) ; yAxis . setStandardTickUnits ( NumberAxis . createStandardTickUnits ( ) ) ; if ( autoRange ) { double delta = ( max - min ) * 0.1 ; yAxis . setRange ( min - delta , max + delta ) ; // TODO reactivate if newer jfree is used // yAxis.setMinorTickCount(4); // yAxis.setMinorTickMarksVisible(true); } // ValueAxis xAxis = plot.getDomainAxis(); // xAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US)); // XYItemRenderer renderer = plot.getRenderer(); // renderer.setDrawBarOutline(false); // // flat bars look best... // renderer.setBarPainter(new StandardXYBarPainter()); // renderer.setShadowVisible(false); if ( ! chartFile . getName ( ) . endsWith ( ".png" ) ) { chartFile = FileUtilities . substituteExtention ( chartFile , "png" ) ; } if ( imageWidth == - 1 ) { imageWidth = IMAGEWIDTH ; } if ( imageHeight == - 1 ) { imageHeight = IMAGEHEIGHT ; } BufferedImage bufferedImage = chart . createBufferedImage ( imageWidth , imageHeight ) ; ImageIO . write ( bufferedImage , "png" , chartFile ) ; }
Creates the chart image and dumps it to file .