Class BaseChart<T>

java.lang.Object
com.jbstrap.ui.components.charts.BaseChart<T>
Type Parameters:
T - A chart típusa
Direct Known Subclasses:
BulletChart, SeriesBasedChart

public abstract class BaseChart<T> extends Object
Since:
4.0
Author:
JBStrap
  • Field Details

    • NAME

      protected static final String NAME
      Parameter name with the chart’s name.
      See Also:
    • DATA

      protected static final String DATA
      Parameter name with the chart’s name.
      See Also:
    • params

      protected Parameters params
      A class containing chart parameters.
    • canvas

      protected ChartCanvas canvas
      Chart canvas instance containing the chart. If the chart is not yet placed anywhere, the parameter value is null.
    • supportedTooltipTypes

      protected final com.google.common.collect.ImmutableList<TooltipType> supportedTooltipTypes
      Supported tooltip types.
    • defaultTooltipType

      protected final TooltipType defaultTooltipType
      Default tooltip type.
    • handlers

      protected Map<EventType,List<BrowserEventHandler>> handlers
    • zoomable

      protected boolean zoomable
      Checks if the zoom feature is enabled on the chart.
    • brushable

      protected boolean brushable
      Checks if the brush feature is enabled on the chart.
    • tooltipType

      protected TooltipType tooltipType
      The chart’s tooltip type.
    • tooltipContent

      protected Component<?> tooltipContent
      Custom tooltip component added to the chart. If there is no custom tooltip component added to the chart, then r null.
  • Constructor Details

    • BaseChart

      protected BaseChart(String name, TooltipType defaultTooltipType, com.google.common.collect.ImmutableList<TooltipType> supportedTooltipTypes)
      Parameters:
      name - Chart name (required)
      defaultTooltipType - The default tooltip type
      supportedTooltipTypes - list of souuprted tooltip types
      Throws:
      NullPointerException - Thrown if the name of the chart or the parameter class is null
      IllegalArgumentException - Thrown if there is a DataDescriptor specified for the chart, but the DataDescriptor does not contain the column specified in the parameter categoryColumnName or the parameter categoryColumnName is not specified and in the DataDescriptor there is no column by the name CATEGORY
  • Method Details

    • getName

      public String getName()
      Gets the chart name.
      Returns:
      Chart name
    • refreshData

      protected T refreshData()
      Updates the chart data.
      Returns:
      Chart
    • runJs

      protected void runJs(String script)
      Calls a JavaScript method on the chart.
      Parameters:
      script - JavaScript code
    • setParent

      protected void setParent(ChartCanvas canvas)
      Sets the canvas that displays the chart.
      Parameters:
      canvas - Canvas instance If the chart was removed from the canvas, specify null.
    • getCanvas

      public ChartCanvas getCanvas()
      Gets the ChartCanvas instance that displays the chart.
      Returns:
      The ChartCanvas instance associated with the chart or null, if the chart is not associated with a canvas or has been removed from the canvas
    • init

      protected abstract void init()
      Chart initialization.
    • getDefaultTooltipType

      public TooltipType getDefaultTooltipType()
      Gets the chart’s default tooltip type.
      Returns:
      The chart’s default tooltip type
    • getSupportedTooltipTypes

      public com.google.common.collect.ImmutableList<TooltipType> getSupportedTooltipTypes()
      Gets the supported tooltip types.
      Returns:
      A list containing all supported tooltip types
    • generateJSON

      protected String generateJSON()
      Generates a JSON object containing the chart settings.
      Returns:
      JSON object containing the chart settings
    • getHandlers

      public final List<BrowserEventHandler> getHandlers(EventType eventType)
      Gets the handlers of the specified event type
      Parameters:
      eventType - The event type. For a list of types, see the EventType enum.
      Returns:
      A list containing the handlers, or null if no applicable handlers were found.