* generate chart at defined folder of datatable
*************************************************************************************/
private void createChart(Boolean inShowAverage) {
imageUrl = System.currentTimeMillis() + ".png";
IRenderer renderer = null;
if (dataTable.isShowableInPieChart()) {
renderer = new PieChartRenderer();
} else {
ChartRenderer crenderer = new ChartRenderer();
crenderer.setShowMeanValues(inShowAverage);
renderer = crenderer;
}
if (myQuestion.isRendererInverted(renderer)) {
renderer.setDataTable(dataTable.getDataTableInverted());
} else {
renderer.setDataTable(dataTable);
}
File outputfile = new File(localImagePath + imageUrl);
BufferedImage image = (BufferedImage) renderer.getRendering();
try {
ImageIO.write(image, "png", outputfile);
} catch (IOException e) {
logger.error(e);
}