Class JFreeChartHelper

java.lang.Object
net.simplace.ui.jfreechart.JFreeChartHelper

public class JFreeChartHelper extends Object
Helper for JFreeChart: fuzzy membership charts and category datasets from arrays.
Author:
Andreas Enders
  • Constructor Details

    • JFreeChartHelper

      public JFreeChartHelper()
  • Method Details

    • fuzzyChart

      public static org.jfree.chart.ChartPanel fuzzyChart(JFreeChartHelper.FuzzyType aType, Integer aX1, Integer aX2, Integer aX3, Integer aX4, String aAxisLabelX)
      Creates a chart of a fuzzy membership function (0 to 1) through the given x values, extended by 20% of the x range on both sides. The axis labels are localized.
      Parameters:
      aType - shape of the function
      aX1 - first junction point, required
      aX2 - second junction point, required
      aX3 - third junction point, required for JFreeChartHelper.FuzzyType.UP_DOWN and JFreeChartHelper.FuzzyType.DOWN_UP
      aX4 - fourth junction point, optional for JFreeChartHelper.FuzzyType.UP_DOWN and JFreeChartHelper.FuzzyType.DOWN_UP
      aAxisLabelX - locale key (and default) of the x axis label
      Returns:
      panel with the chart
      Throws:
      IllegalArgumentException - if the type is null
      IllegalStateException - if required points are missing or not in ascending order
    • createCatagoryDataset

      public static org.jfree.data.category.CategoryDataset createCatagoryDataset(Comparable[] category, Comparable[] dataDesc, Object[]... data)
      Creates a CategoryDataset from an Array of numbers
      Parameters:
      category - (horizontal) categories of the data (if null the array indices are used)
      dataDesc - descriptions of the data rows (if null the array indices are used)
      data - the series
      Returns:
      the dataset
      Throws:
      UnsupportedOperationException - if a value is not a number
    • createCatagoryDataset

      public static org.jfree.data.category.CategoryDataset createCatagoryDataset(double catOffset, double catFactor, Comparable[] dataDesc, Object[]... data)
      Creates a CategoryDataset from an Array of numbers. The categories are generated automatically from the array indices: category = catOffset + idx*catFactor
      Parameters:
      catOffset - Offset added to the data arrays index
      catFactor - Factor the data arrays index is multiplied with
      dataDesc - descriptions of the data rows (if null the array indices are used)
      data - the series
      Returns:
      the dataset
      Throws:
      UnsupportedOperationException - if a value is not a number