Class ResultHighchart

Object
AbstractPortletDto
ResultHighchart
All Implemented Interfaces:
Serializable, Portlet, ComplexCalculationResult
Direct Known Subclasses:
ResultHighmap

public class ResultHighchart extends AbstractPortletDto implements ComplexCalculationResult
See Also:
  • Constructor Details

  • Method Details

    • getChartDefinition

      @Deprecated public Map<String,?> getChartDefinition()
      Deprecated.
      Not intended for public use, required for JSON serialization.
    • addModule

      public ResultHighchart addModule(String... modules)
      By default, these modules are already available: boost, drilldown, exporting, export-data, heatmap, no-data-to-display, treemap. If your chart requires additional modules, they can be specified here. The application ensures the files load only once.

      Note regarding the "boost" module: The Highcharts documentation states that it is enabled by default, but in Pricefx you will need to explicitly set the option boost.enabled = true

      Parameters:
      modules - one or more Highcharts module names, without the path and without the ".js" extension. e.g. "annotations", "funnel", "variwide"
      Returns:
      the ResultHighchart instance, for convenience
      See Also:
    • getModulesList

      @Deprecated public List<String> getModulesList()
      Deprecated.
      Not intended for public use, required for JSON serialization.
    • setShowDataTab

      public ResultHighchart setShowDataTab(boolean show)
      Show a tab set, with the chart in the first tab, and data grids in the other tabs. By default, a single grid will be shown by extracting the data using the native JavaScript Highcharts API. The headers of this grid can be customized via setDataHeaders(), or the whole grid can be provided in a ResultMatrix instance via setResultMatrixTabs(). Note that for convenience, calling setDataHeaders(), setResultMatrixTabs(), or addResultMatrixTab() will set this to true.
      Parameters:
      show - Data tab will be shown if set to true. Default is false.
      Returns:
      the ResultHighchart instance, for convenience
      See Also:
    • showDataTab

      public ResultHighchart showDataTab()
      Short for setShowDataTab(true)
      Returns:
      the ResultHighchart instance, for convenience
    • getShowDataTab

      @Deprecated public boolean getShowDataTab()
      Deprecated.
      Not intended for public use, required for JSON serialization.
    • setDataHeaders

      public ResultHighchart setDataHeaders(String... headers)
      To override the default column headers of the data tab table. For convenience, this will also call setShowDataTab(true)
      Parameters:
      headers - One or more header labels, left to right
      Returns:
      the ResultHighchart instance, for convenience
    • getDataHeaders

      @Deprecated public List<String> getDataHeaders()
      Deprecated.
      Not intended for public use, required for JSON serialization.
    • setResultMatrixTabs

      public ResultHighchart setResultMatrixTabs(ResultMatrix... matrices)
      The automatically filled data tab can be replaced by customized ResultMatrix data. It's even possible to add multiple tabs by providing multiple ResultMatrix instances. Make sure to set a title via ResultMatrix.setTitle() as this will be used for the tab label. Note that:
      • This method will overwrite any previously set or added ResultMatrix
      • For convenience, this will also call setShowDataTab(true)
      Parameters:
      matrices - One or more ResultMatrix instances to display in the tab set
      Returns:
      the ResultHighchart instance, for convenience
      See Also:
    • addResultMatrixTab

      public ResultHighchart addResultMatrixTab(ResultMatrix matrix)
      The automatically filled data tab can be replaced by customized ResultMatrix data. It's even possible to add multiple tabs by providing multiple ResultMatrix instances. Make sure to set a title via ResultMatrix.setTitle() as this will be used for the tab label. Note that:
      • This method will not overwrite previously set or added ResultMatrix
      • For convenience, this will also call setShowDataTab(true)
      Parameters:
      matrix - Add one ResultMatrix instance to display in its own tab
      Returns:
      the ResultHighchart instance, for convenience
      See Also:
    • getResultMatrixList

      @Deprecated public List<ResultMatrix> getResultMatrixList()
      Deprecated.
      Not intended for public use, required for JSON serialization.
    • setDrilldownResultMatrixTabs

      public ResultHighchart setDrilldownResultMatrixTabs(String drilldownKey, ResultMatrix... matrices)
      At least one ResultMatrix is expected for each drilldown series in a chart. ResultMatrix object(s) must be provided with a key, for aligning of a chart state and a corresponding data tab(s) contents, when drilling down the chart. Note that:
      • This method will overwrite previously set ResultMatrix for a specific drilldownKey
      • For convenience, this will also call setShowDataTab(true)
      Example:
      
      
       def hc = api.buildHighchart(chartDefinition).addResultMatrixTab(dataMatrix)
      
      if (rawData.negativeData.itemCount > 0) {
      hc.setDrilldownResultMatrixTabs(rawData.negativeData.name, generateDrilldownResultMatrix(rawData.negativeData.drilldown))
      }
      if (rawData.lowData.itemCount > 0) {
      hc.setDrilldownResultMatrixTabs(rawData.lowData.name, generateDrilldownResultMatrix(rawData.lowData.drilldown))
      }
      if (rawData.mediumData.itemCount > 0) {
      hc.setDrilldownResultMatrixTabs(rawData.mediumData.name, generateDrilldownResultMatrix(rawData.mediumData.drilldown))
      }
      if (rawData.highData.itemCount > 0) {
      hc.setDrilldownResultMatrixTabs(rawData.highData.name, generateDrilldownResultMatrix(rawData.highData.drilldown))
      }
      
      return hc
      }
      ...
      
      ResultMatrix generateDrilldownResultMatrix(List rawData) {
      List drilldownMatrixColumns = [
             "name",
             "number",
      ]
      ResultMatrix matrix = api.newMatrix(drilldownMatrixColumns)
      if (!rawData) return matrix
      rawData.each { Map item ->
         matrix.addRow([
                 "name" : item."name",
                 "number" : item."label",
         ])
      }
      return matrix
      }
      
      
       
      Parameters:
      drilldownKey - A key corresponding to the drilldown series id within the chart's definition
      matrices - One or more ResultMatrix instances associated with a key to display in the tab set
      Returns:
      the ResultHighchart instance, for convenience
      Since:
      14.0 - Caribou Lou
      See Also:
    • getResultType

      public String getResultType()
      Specified by:
      getResultType in interface ComplexCalculationResult
    • onPointClick

      public ResultHighchart.OnPointClick onPointClick()
      BETA
      Allows to define events that will be triggered when the user clicks in the chart/map.
      Example:
      
           def chart = api.buildHighchart(definition)
           chart.onPointClick().triggerEvent(api.dashboardWideEvent("eventName"))
               .withNameAsEventDataAttr().withCustomEventDataAttr("value")
           return chart
       
      This allows to refresh an embedded dashboard:
      
           return api.dashboard("embeddedDashboardName")
               //.setParam("country_name", input.Country)
               //.setParam("country_revenue", input.Revenue)
               .showEmbedded()
               .andRecalculateOn(api.dashboardWideEvent("eventName"))
               .withEventDataAttr("name").asParam("country_name)
               .withEventDataAttr("value").asParam("country_revenue")
       
    • getEvents

      @Deprecated public List<Map<String,String>> getEvents()
      Deprecated.
      Not intended for public use, required for JSON serialization.