How to save current chart in ChartPanel as PNG programmatically?
The solution was to use a method ChartUtilities.writeChartAsPNG
Example:
try {
OutputStream out = new FileOutputStream(chartName);
ChartUtilities.writeChartAsPNG(out,
aJFreeChart,
aChartPanel.getWidth(),
aChartPanel.getHeight());
} catch (IOException ex) {
logger.error(ex);
}