Class ResultHighchart
- All Implemented Interfaces:
Serializable,Portlet,ComplexCalculationResult
- Direct Known Subclasses:
ResultHighmap
Create an instance with api.buildHighchart(definition) and return it from a logic element. The definition
is a map of maps and arrays that follows the Highcharts API. It is passed to the Highcharts library without
validation. JavaScript functions are not supported.
Example:
def definition = [
chart : [type: "column"],
series: [
[data: [29.9, 71.5, 106.4, 129.2, 144.0]]
]
]
return api.buildHighchart(definition)
The chart can be extended before it is returned. Load more Highcharts modules with addModule(String...),
show the chart data in extra tabs with setShowDataTab(boolean), and react to clicks in the chart with
onPointClick().
- Since:
- 3.5 - Salty Dog
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe menu that opens when the user clicks a point in the chart.static interfaceAn item of the context menu.static interfaceDefines what happens when the user clicks a point in the chart.static interfaceAn event that the chart triggers when the user clicks a point. -
Field Summary
Fields inherited from class AbstractPortletDto
dragDropEnabled, layout, messages, resizingEnabled -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ResultHighchartaddAcceleratorsOnlyJS(String fileName) !By default, these modules are already available: boost, drilldown, exporting, export-data, heatmap, no-data-to-display, treemap.addResultMatrixTab(ResultMatrix matrix) The automatically filled data tab can be replaced by customized ResultMatrix data.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Returns the result type of the chart.booleanDeprecated.BETA
Allows to define events that will be triggered when the user clicks in the chart/map.setDataHeaders(String... headers) To override the default column headers of the data tab table.setDrilldownResultMatrixTabs(String drilldownKey, ResultMatrix... matrices) At least one ResultMatrix is expected for each drilldown series in a chart.setResultMatrixTabs(ResultMatrix... matrices) The automatically filled data tab can be replaced by customized ResultMatrix data.setShowDataTab(boolean show) Show a tab set, with the chart in the first tab, and data grids in the other tabs.Short forsetShowDataTab(true)Methods inherited from class AbstractPortletDto
getLabelOverride, layout, setLabelOverride, setLayout, value, withDragDrop, withError, withHeight, withHeight, withInfo, withLabelOverride, withLayout, withLayout, withLayout, withResizing, withTab, withWarning, withWidth, withWidth
-
Constructor Details
-
ResultHighchart
Not intended for public use. Useapi.buildHighchart()instead.- See Also:
-
-
Method Details
-
getChartDefinition
Deprecated.Not intended for public use, required for JSON serialization. -
addModule
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 = trueExample:
def chart = api.buildHighchart(definition) chart.addModule("variwide") return chart- Parameters:
modules- one or more Highcharts module names, without the path and without the ".js" extension. e.g. "annotations", "funnel", "variwide"- Returns:
- the
ResultHighchartinstance, for convenience - See Also:
-
getModulesList
Deprecated.Not intended for public use, required for JSON serialization. -
addAcceleratorsOnlyJS
! FOR INTERNAL USE ONLY !Adds the name of a file containing custom JavaScript callback functions required by the chart.
If the chart requires custom JavaScript callbacks, specify the file name here.
- Parameters:
fileName- name of the file, without the path and without the ".js" extension.- Returns:
- the
ResultHighchartinstance, for convenience
-
setShowDataTab
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 viasetDataHeaders(), or the whole grid can be provided in aResultMatrixinstance viasetResultMatrixTabs(). Note that for convenience, callingsetDataHeaders(),setResultMatrixTabs(), oraddResultMatrixTab()will set this to true.- Parameters:
show- Data tab will be shown if set to true. Default is false.- Returns:
- the
ResultHighchartinstance, for convenience - Since:
- 3.7 - Bramble
- See Also:
-
showDataTab
Short forsetShowDataTab(true)- Returns:
- the
ResultHighchartinstance, for convenience - Since:
- 3.7 - Bramble
-
getShowDataTab
Deprecated.Not intended for public use, required for JSON serialization. -
setDataHeaders
To override the default column headers of the data tab table. For convenience, this will also callsetShowDataTab(true)- Parameters:
headers- One or more header labels, left to right- Returns:
- the
ResultHighchartinstance, for convenience - Since:
- 3.7 - Bramble
-
getDataHeaders
Deprecated.Not intended for public use, required for JSON serialization. -
setResultMatrixTabs
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 viaResultMatrix.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
ResultHighchartinstance, for convenience - Since:
- 3.7 - Bramble
- See Also:
- This method will overwrite any previously set or added
-
addResultMatrixTab
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 viaResultMatrix.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
ResultHighchartinstance, for convenience - Since:
- 3.7 - Bramble
- See Also:
- This method will not overwrite previously set or added
-
getResultMatrixList
Deprecated.Not intended for public use, required for JSON serialization. -
setDrilldownResultMatrixTabs
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
ResultMatrixfor a specificdrilldownKey - For convenience, this will also call
setShowDataTab(true)
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'sdefinitionmatrices- One or more ResultMatrix instances associated with a key to display in the tab set- Returns:
- the
ResultHighchartinstance, for convenience - Since:
- 14.0 - Caribou Lou
- See Also:
- This method will overwrite previously set
-
getResultType
Returns the result type of the chart.- Specified by:
getResultTypein interfaceComplexCalculationResult- Returns:
- Always
"HIGHCHART".
-
onPointClick
BETA
Allows to define events that will be triggered when the user clicks in the chart/map.
Example:
This allows to refresh an embedded dashboard:def chart = api.buildHighchart(definition) chart.onPointClick().triggerEvent(api.dashboardWideEvent("eventName")) .withNameAsEventDataAttr().withCustomEventDataAttr("value") return chartreturn 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")Instead of triggering events, a click can open a context menu. See
ResultHighchart.OnPointClick.showContextMenu().- Returns:
- the
ResultHighchart.OnPointClickdefinition of this chart - Since:
- 3.7.1 - Bramble
-
getEvents
Deprecated.Not intended for public use, required for JSON serialization.
-