Interface ChartProvider


@NonNullByDefault public interface ChartProvider
Defines the interface for chart providers. A chart provider interfaces with the persistence store to get the data and receives parameters from the UI chart servlet and returns a chart image object (PNG).
Author:
Chris Jackson - Initial contribution, Holger Reichert - Support for themes, DPI, legend hiding, Jan N. Klug - add y-axis label formatter
  • Method Details

    • getName

      String getName()
      Gets the name of this chart provider.
      Returns:
      String containing the provider name
    • createChart

      BufferedImage createChart(@Nullable String service, @Nullable String theme, ZonedDateTime startTime, ZonedDateTime endTime, int height, int width, @Nullable String items, @Nullable String groups, @Nullable Integer dpi, @Nullable Boolean legend) throws ItemNotFoundException
      Creates a chart object. This sets the initial parameters for the chart before the items are added
      Parameters:
      service - A string containing the name of the persistence service. May be null in which case the chart provider can decide itself which store to use.
      theme - A string containing a theme name for the chart. The provider should store its own themes. May be null to use a default theme.
      startTime - The start time of the chart
      endTime - The end time of the chart
      height - The height of the chart
      width - The width of the chart
      items - The items to display on the chart
      groups - The groups to display on the chart
      dpi - The DPI (dots per inch) value, can be null
      legend - Show the legend? If null, the ChartProvider should make his own decision.
      Returns:
      BufferedImage object if the chart is rendered correctly, otherwise null.
      Throws:
      ItemNotFoundException - if an item or group is not found
      IllegalArgumentException - if an invalid argument is passed
    • createChart

      default BufferedImage createChart(@Nullable String service, @Nullable String theme, ZonedDateTime startTime, ZonedDateTime endTime, int height, int width, @Nullable String items, @Nullable String groups, @Nullable Integer dpi, @Nullable String yAxisDecimalPattern, @Nullable Boolean legend) throws ItemNotFoundException
      Creates a chart object. This sets the initial parameters for the chart before the items are added
      Parameters:
      service - A string containing the name of the persistence service. May be null in which case the chart provider can decide itself which store to use.
      theme - A string containing a theme name for the chart. The provider should store its own themes. May be null to use a default theme.
      startTime - The start time of the chart
      endTime - The end time of the chart
      height - The height of the chart
      width - The width of the chart
      items - The items to display on the chart
      groups - The groups to display on the chart
      dpi - The DPI (dots per inch) value, can be null
      yAxisDecimalPattern - The format pattern for the y-axis labels
      legend - Show the legend? If null, the ChartProvider should make his own decision.
      Returns:
      BufferedImage object if the chart is rendered correctly, otherwise null.
      Throws:
      ItemNotFoundException - if an item or group is not found
      IllegalArgumentException - if an invalid argument is passed
    • getChartType

      ChartProvider.ImageType getChartType()
      Gets the type of data that will be written by the chart.
      Returns:
      ImageType