What's slightly annoying is that JFreeChart has these methods:
chart.doSaveAs();
File dir = chart.getDefaultDirectoryForSaveAs();
chart.setDefaultDirectoryForSaveAs(dir);
but doSaveAs() returns void so you can't find out what path was selected in the file chooser. getDefaultDirectoryForSaveAs() only returns what is set with setDefaultDirectoryForSaveAs().
But I don't want to set an arbitrary directory, I want to have the last directory saved to remembered! Short of trying to find a static hook in JFileChooser or somewhere else in the Java class library, I don't know whether this can be done at all!
The most recent version of JFreeChart (1.0.14in 2011) has no change to this API that I can see. There is a however a new development version on github so that needs to be explored.
What can be done however, is just to use a different method to write an image and a regular JFileChooser, e.g.
What's slightly annoying is that JFreeChart has these methods:
chart.doSaveAs();
File dir = chart.getDefaultDirectoryForSaveAs();
chart.setDefaultDirectoryForSaveAs(dir);
but doSaveAs() returns void so you can't find out what path was selected in the file chooser. getDefaultDirectoryForSaveAs() only returns what is set with setDefaultDirectoryForSaveAs().
But I don't want to set an arbitrary directory, I want to have the last directory saved to remembered! Short of trying to find a static hook in JFileChooser or somewhere else in the Java class library, I don't know whether this can be done at all!
The most recent version of JFreeChart (1.0.14in 2011) has no change to this API that I can see. There is a however a new development version on github so that needs to be explored.
What can be done however, is just to use a different method to write an image and a regular JFileChooser, e.g.
ChartUtilities.saveChartAsPNG(File file, JFreeChart chart, ...)
Fixed in 2.15.1