/**
* Saves the chart as a PNG format file in the temporary directory.
*
* @param chart the JFreeChart to be saved.
* @param width the width of the chart.
* @param height the height of the chart.
* @param session the HttpSession of the client (if <code>null</code>, the
* temporary file is marked as "one-time" and deleted by
* the {@link DisplayChart} servlet right after it is
* streamed to the client).
*
* @return The filename of the chart saved in the temporary directory.
*
* @throws IOException if there is a problem saving the file.
*/
/**
* Saves the chart as a JPEG format file in the temporary directory.
* <p>
* SPECIAL NOTE: Please avoid using JPEG as an image format for charts,
* it is a "lossy" format that introduces visible distortions in the
* resulting image - use PNG instead. In addition, note that JPEG output
* is supported by JFreeChart only for JRE 1.4.2 or later.
*
* @param chart the JFreeChart to be saved.
* @param width the width of the chart.
* @param height the height of the chart.
* @param session the HttpSession of the client (if <code>null</code>, the
* temporary file is marked as "one-time" and deleted by
* the {@link DisplayChart} servlet right after it is
* streamed to the client).
*
* @return The filename of the chart saved in the temporary directory.
*
* @throws IOException if there is a problem saving the file.
*/
public static String [[#variable18becd20]](JFreeChart chart, int width, int height, HttpSession session) throws IOException {
return ServletUtilities. [[#variable18becd20]](chart, width, height, null, session);
}
/**
* Saves the chart as a PNG format file in the temporary directory and
* populates the {@link ChartRenderingInfo} object which can be used to
* generate an HTML image map.
*
* @param chart the chart to be saved (<code>null</code> not permitted).
* @param width the width of the chart.
* @param height the height of the chart.
* @param info the ChartRenderingInfo object to be populated
* (<code>null</code> permitted).
* @param session the HttpSession of the client (if <code>null</code>, the
* temporary file is marked as "one-time" and deleted by
* the {@link DisplayChart} servlet right after it is
* streamed to the client).
*
* @return The filename of the chart saved in the temporary directory.
*
* @throws IOException if there is a problem saving the file.
*/
/**
* Saves the chart as a JPEG format file in the temporary directory and
* populates the <code>ChartRenderingInfo</code> object which can be used
* to generate an HTML image map.
* <p>
* SPECIAL NOTE: Please avoid using JPEG as an image format for charts,
* it is a "lossy" format that introduces visible distortions in the
* resulting image - use PNG instead. In addition, note that JPEG output
* is supported by JFreeChart only for JRE 1.4.2 or later.
*
* @param chart the chart to be saved (<code>null</code> not permitted).
* @param width the width of the chart
* @param height the height of the chart
* @param info the ChartRenderingInfo object to be populated
* @param session the HttpSession of the client (if <code>null</code>, the
* temporary file is marked as "one-time" and deleted by
* the {@link DisplayChart} servlet right after it is
* streamed to the client).
*
* @return The filename of the chart saved in the temporary directory
*
* @throws IOException if there is a problem saving the file.
*/
public static String [[#variable18becd20]](JFreeChart chart, int width, int height, ChartRenderingInfo info, HttpSession session) throws IOException {
if (chart == null) {
throw new IllegalArgumentException("Null \'chart\' argument.");
}
ServletUtilities.createTempDir();
String prefix = ServletUtilities.tempFilePrefix;
if (session == null) {
prefix = ServletUtilities.tempOneTimeFilePrefix;
}
File tempFile = File.createTempFile(prefix, [[#variable1a801140]], new File(System.getProperty("java.io.tmpdir")));
ChartUtilities. [[#variable18becd20]](tempFile, chart, width, height, info);
if (session != null) {
ServletUtilities.registerChartForDeletion(tempFile, session);
}
return tempFile.getName();
}
|