Class ChartUtils


  • public class ChartUtils
    extends Object
    Helper methods for charts.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Summary

      Constructors 
      Constructor Description
      ChartUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addDiagonal​(org.jfree.data.xy.DefaultXYDataset dataset, double min, double max)
      Adds a diagonal to the dataset.
      static void applyColor​(org.jfree.chart.plot.XYPlot plot, Color plotColor, Color diagonalColor, ColorProvider colorProvider)
      Applies the color to the series.
      static void applyShape​(org.jfree.chart.plot.XYPlot plot, Shape shape)
      Sets the shape for all series except the diagonal.
      static int getDiagonalIndex​(org.jfree.data.general.SeriesDataset dataset)
      Returns the index of the series represnting a diagonal.
      static boolean hasDiagonal​(org.jfree.data.general.SeriesDataset dataset)
      Checks the dataset whether a diagonal series is present.
      static boolean isDiagonal​(org.jfree.data.general.SeriesDataset dataset, int index)
      Checks whether the specified series represents a diagonal.
    • Constructor Detail

      • ChartUtils

        public ChartUtils()
    • Method Detail

      • addDiagonal

        public static void addDiagonal​(org.jfree.data.xy.DefaultXYDataset dataset,
                                       double min,
                                       double max)
        Adds a diagonal to the dataset.
        Parameters:
        dataset - the dataset to add the diagonal to
        min - the minimum Y
        max - the maximum Y
      • getDiagonalIndex

        public static int getDiagonalIndex​(org.jfree.data.general.SeriesDataset dataset)
        Returns the index of the series represnting a diagonal.
        Parameters:
        dataset - the dataset
        Returns:
        the 0-based index, -1 if none present
      • hasDiagonal

        public static boolean hasDiagonal​(org.jfree.data.general.SeriesDataset dataset)
        Checks the dataset whether a diagonal series is present.
        Parameters:
        dataset - the dataset to check
        Returns:
        true if present
      • isDiagonal

        public static boolean isDiagonal​(org.jfree.data.general.SeriesDataset dataset,
                                         int index)
        Checks whether the specified series represents a diagonal.
        Parameters:
        dataset - the dataset to check
        index - the index of the series to check
        Returns:
        true if diagonal
      • applyShape

        public static void applyShape​(org.jfree.chart.plot.XYPlot plot,
                                      Shape shape)
        Sets the shape for all series except the diagonal.
        Parameters:
        plot - the plot to update
        shape - the shape to set, ignored if null
      • applyColor

        public static void applyColor​(org.jfree.chart.plot.XYPlot plot,
                                      Color plotColor,
                                      Color diagonalColor,
                                      ColorProvider colorProvider)
        Applies the color to the series.
        Parameters:
        plot - the plot to update
        plotColor - the plot color to use if just one series (or series with diagonal), ignored if null
        diagonalColor - the color for the diagonal (if present)
        colorProvider - the color provider to get the colors from (is not reset before calling "next()")