free.org/jfreechart/" target="_blank">JFreeChart. When executed this Result will write the given chart as a PNG or JPG to the servlet output stream.
This result type takes the following parameters: - value - the name of the JFreeChart object on the ValueStack, defaults to 'chart'.
- type - the render type for this chart. Can be jpg (or jpeg) or png. Defaults to png.
- width (required) - the width (in pixels) of the rendered chart.
- height (required) - the height (in pixels) of the rendered chart.
Example: public class ExampleChartAction extends ActionSupport { private JFreeChart chart; public String execute() throws Exception { // chart creation logic... XYSeries dataSeries = new XYSeries(new Integer(1)); // pass a key for this serie for (int i = 0; i <= 100; i++) { dataSeries.add(i, RandomUtils.nextInt()); } XYSeriesCollection xyDataset = new XYSeriesCollection(dataSeries); ValueAxis xAxis = new NumberAxis("Raw Marks"); ValueAxis yAxis = new NumberAxis("Moderated Marks"); // set my chart variable chart = new JFreeChart( "Moderation Function", JFreeChart.DEFAULT_TITLE_FONT, new XYPlot( xyDataset, xAxis, yAxis, new StandardXYItemRenderer(StandardXYItemRenderer.LINES)), false); chart.setBackgroundPaint(java.awt.Color.white); return SUCCESS; } // this method will get called if we specify <param name="value">chart</param> public JFreeChart getChart() { return chart; } } <result name="success" type="chart"> <param name="value">chart</param> <param name="type">png</param> <param name="width">640</param> <param name="height">480</param> </result>