Class AbstractChartBuilder<C extends AbstractChartBuilder<C>>

Object
ObjectIdentity
AbstractBuilder
AbstractChartBuilder<C>
All Implemented Interfaces:
Portlet, Portlet
Direct Known Subclasses:
BarLineChart, BoxplotChart, BubbleChart, DataTableChart, DetailedTimeSeriesChart, HeatmapChart, HistogramChart, PieChart, ScatterChart, TimeSeriesChart, TimeSeriesScatterChart, WaterfallChart, WaterfallComparisonChart

public abstract class AbstractChartBuilder<C extends AbstractChartBuilder<C>> extends AbstractBuilder implements Portlet
  • Field Details

    • layout

      protected Map<String,Object> layout
    • queryBuilderState

      protected Map<String,Object> queryBuilderState
    • messages

      protected Map<String,List<PortletMessage>> messages
    • dragDropEnabled

      protected boolean dragDropEnabled
    • resizingEnabled

      protected boolean resizingEnabled
  • Constructor Details

    • AbstractChartBuilder

      protected AbstractChartBuilder(String classId, IdGenerator idGenerator, Invocations<MethodInvocation> invocations)
  • Method Details

    • addInvocation

      protected String addInvocation(String methodName, Object... arguments)
      Overrides:
      addInvocation in class ObjectIdentity
    • getThis

      protected C getThis()
    • getDictionary

      public final Dictionary<C> getDictionary()
    • invokeGetOptions

      protected String invokeGetOptions()
    • getOptions

      public abstract AbstractChartOptions<C,?> getOptions()
    • invokeAddSeries

      protected String invokeAddSeries()
    • invokeGetSeries

      protected String invokeGetSeries()
    • addAuxLine

      protected AuxLine<C> addAuxLine()
    • onRowClick

      public ChartEvents.OnRowClick<C> onRowClick()
    • onCellClick

      public ChartEvents.OnCellClick<C> onCellClick()
    • build

      protected ChartBuilderResult build(ChartType type)
    • withWidth

      public Portlet withWidth(int width, String unit)
      Description copied from interface: Portlet
      Builder style method for setting the width in supported units.

      Example – setting the width using the 12-column system (grid):

      
       portlet.withWidth(12, "grid")
       
      Example – setting the width using pixels:
      
       portlet.withWidth(400, "px") // == portlet.withWidth(400)
       
      Specified by:
      withWidth in interface Portlet
      Parameters:
      width - Specifies the width of the portlet (in unit).
      unit - Specifies the unit of the width (grid, px). If the unit is not specified then px is used as default.
      Returns:
      The current portlet object of the specified size.
      See Also:
    • withHeight

      public Portlet withHeight(int height, String unit)
      Description copied from interface: Portlet
      Builder style method for setting the height in supported units.

      Example – setting the height using the 12-column system (grid):

      
       portlet.withHeight(12, "grid")
       
      Example – setting the height using pixels:
      
       portlet.withHeight(800, "px") // == portlet.withHeight(800)
       
      Specified by:
      withHeight in interface Portlet
      Parameters:
      height - Specifies the height of the portlet (in unit).
      unit - Specifies the unit of the height (grid, px). If the unit is not specified then px is used as default.
      Returns:
      The current portlet object of the specified size.
      See Also:
    • withLayout

      public Portlet withLayout(int width, int height, String unit)
      Description copied from interface: Portlet
      Builder style method for setting width and height in specified units.

      Example - sets the portlet size to the specified grid size:

      
       def matrix = api.newMatrix("column1", "column2", "column3")
            matrix.addRow(1, "a", "f")
            matrix.addRow(2, "b", "g")
            matrix.withLayout(3, 3, "grid")
      
       return matrix
       
      Specified by:
      withLayout in interface Portlet
      Parameters:
      width - Specifies the width of the portlet.
      height - Specifies the height of the portlet.
      unit - Specifies a unit of the layout (grid, px).
      Returns:
      The current portlet object of the specified size.
      See Also:
    • withInfo

      public Portlet withInfo(String code, String userMsg, String techMsg)
      Description copied from interface: Portlet
      Adds an info message to the given portlet. One portlet can have multiple messages. It is a different concept than yellow/red alerts.
      Example:
      
       portlet.withInfo("101", "Chart data may be outdated", "Bubble Chart data is outdated, because of ...")
       
      Specified by:
      withInfo in interface Portlet
      Parameters:
      code - Info code allows to pinpoint the place of the related issue in code.
      userMsg - Info message is displayed to a user in UI.
      techMsg - Technical message is hidden by default, only for the investigation purposes.
    • withWarning

      public Portlet withWarning(String code, String userMsg, String techMsg)
      Description copied from interface: Portlet
      Adds a warning message to the given portlet. One portlet can have multiple messages. It is a different concept than yellow/red alerts.
      Example:
      
       portlet.withWarning("102", "Chart data is missing", "Bubble Chart data is missing, because of ...")
       
      Specified by:
      withWarning in interface Portlet
      Parameters:
      code - Warning code allows to pinpoint the place where the warning is thrown in code.
      userMsg - Warning message is displayed to a user in UI.
      techMsg - Technical message is hidden by default, only for the investigation purposes.
    • withError

      public Portlet withError(String code, String userMsg, String techMsg)
      Description copied from interface: Portlet
      Adds an error message to the given portlet. One portlet can have multiple messages. It is a different concept than yellow/red alerts.
      Example:
      
       portlet.withError("103", "Chart was not found", "Bubble Chart could not be found, because of ...")
       
      Specified by:
      withError in interface Portlet
      Parameters:
      code - Error code allows to pinpoint the place where the error is thrown in code.
      userMsg - Error message is displayed to a user in UI.
      techMsg - Technical message is hidden by default, only for the investigation purposes.
    • withLayout

      public Portlet withLayout(int width, int height, String wUnit, String hUnit)
    • value

      protected Map<String,Object> value(int value, String unit)
    • withWidth

      public Portlet withWidth(int width)
      Description copied from interface: Portlet
      Builder style method for setting the width in pixels.
      Specified by:
      withWidth in interface Portlet
      Parameters:
      width - specify the width of the portlet (in pixels)
      Returns:
      The current portlet object of the specified size.
      See Also:
    • withHeight

      public Portlet withHeight(int height)
      Description copied from interface: Portlet
      Builder style method for setting the height in pixels.
      Specified by:
      withHeight in interface Portlet
      Parameters:
      height - specify the height of the portlet (in pixels)
      Returns:
      The current portlet object of the specified size.
      See Also:
    • withLayout

      public Portlet withLayout(int width, int height)
      Description copied from interface: Portlet
      Builder style method for setting width and height in pixels.
      Specified by:
      withLayout in interface Portlet
      Parameters:
      width - specify the width of the portlet (in pixels)
      height - specify the height of the portlet (in pixels)
      Returns:
      The current portlet object of the specified size.
      See Also:
    • layout

      protected Map<String,Object> layout()
    • fromQueryBuilderState

      public C fromQueryBuilderState(Map<String,Object> state)
      Configures a DataTableChart based on the output of the QueryBuilder Dashboard input.
      Note: So far the only supported chart type is DataTable, which will show a separate tab for each series configured in the QueryBuilder input.

      Example:

      
       def qbState = input.MyQueryBuilder
       api.newChartBuilder()
           .newDataTable()
           .fromQueryBuilderState(qbState)
           .build()
       
      Parameters:
      state - Properties Map as returned by the QueryBuilder input
      Returns:
      self
      Since:
      11.0 Paper Plane for DataTableChart, 12.0 Clover Club experimental for all other chart types
    • withDragDrop

      public Portlet withDragDrop(boolean enabled)
      Description copied from interface: Portlet
      Enables or disables the drag&drop feature for portlets. Set to false to disable the drag&drop option. Default state is ENABLED.

      Example - disables the drag&drop of the Result Matrix portlet:

      
       def matrix = api.newMatrix("column1", "column2", "column3")
            matrix.addRow(1, "a", "f")
            matrix.addRow(2, "b", "g")
            matrix.withDragDrop(false)
      
       return matrix
       
      Specified by:
      withDragDrop in interface Portlet
      Parameters:
      enabled - on/off switch. Default = true.
      Returns:
      this Portlet instance
    • withResizing

      public Portlet withResizing(boolean enabled)
      Description copied from interface: Portlet
      Enables or disables the resizing feature for portlets. Set to false to disable the resizing of the portlet. Default state is ENABLED.

      Example - disables the resizing option of the Result Matrix portlet:

      
       def matrix = api.newMatrix("column1", "column2", "column3")
            matrix.addRow(1, "a", "f")
            matrix.addRow(2, "b", "g")
            matrix.withResizing(false)
      
       return matrix
       
      Specified by:
      withResizing in interface Portlet
      Parameters:
      enabled - on/off switch. Default = true.
      Returns:
      this Portlet instance