Class ImageUtils

java.lang.Object
org.moeaframework.analysis.plot.ImageUtils

public class ImageUtils extends Object
Utility for creating images from charts.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a list of supported image formats.
    static void
    save(org.jfree.chart.JFreeChart chart, File file)
    Saves the chart to an image file.
    static void
    save(org.jfree.chart.JFreeChart chart, File file, int width, int height)
    Saves the chart to an image file.
    static void
    save(org.jfree.chart.JFreeChart chart, File file, ImageFileType fileType, int width, int height)
    Saves the chart to an image file.
    static void
    save(org.jfree.chart.JFreeChart chart, String filename)
    Saves the chart to an image file.
    static boolean
    Returns true if saving to the SVG format is supported.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • save

      public static void save(org.jfree.chart.JFreeChart chart, String filename) throws IOException
      Saves the chart to an image file. The type of image is determined from the filename extension, which must match one of the supported file types in ImageFileType.
      Parameters:
      chart - the chart to save
      filename - the filename
      Throws:
      IOException - if an I/O error occurred
    • save

      public static void save(org.jfree.chart.JFreeChart chart, File file) throws IOException
      Saves the chart to an image file. The type of image is determined from the filename extension, which must match one of the supported file types in ImageFileType.
      Parameters:
      chart - the chart to save
      file - the file
      Throws:
      IOException - if an I/O error occurred
    • save

      public static void save(org.jfree.chart.JFreeChart chart, File file, int width, int height) throws IOException
      Saves the chart to an image file. The format must match one of the supported file types in ImageFileType.
      Parameters:
      chart - the chart to save
      file - the file
      width - the image width
      height - the image height
      Throws:
      IOException - if an I/O error occurred
    • save

      public static void save(org.jfree.chart.JFreeChart chart, File file, ImageFileType fileType, int width, int height) throws IOException
      Saves the chart to an image file.
      Parameters:
      chart - the chart to save
      file - the file
      fileType - the image file format
      width - the image width
      height - the image height
      Throws:
      IOException - if an I/O error occurred
    • supportsSVG

      public static boolean supportsSVG()
      Returns true if saving to the SVG format is supported. This requires the JFreeSVG library to be setup on the classpath.
      Returns:
      true if saving to the SVG format is supported; false otherwise
    • getSupportedImageFormats

      public static List<ImageFileType> getSupportedImageFormats()
      Returns a list of supported image formats.
      Returns:
      a list of supported image formats