From 07b0e18bd6e68cf536e0d3a2686678c4c03f75fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B0=D0=B5=D0=B2=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Wed, 10 May 2023 18:26:24 +0300 Subject: [PATCH] feat(Highcharts plugin): add config.onSeriesClick property --- .../highcharts/renderer/helpers/config/config.js | 4 ++++ src/plugins/highcharts/types/widget.ts | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/plugins/highcharts/renderer/helpers/config/config.js b/src/plugins/highcharts/renderer/helpers/config/config.js index 3e1dad5b..6b5f0687 100644 --- a/src/plugins/highcharts/renderer/helpers/config/config.js +++ b/src/plugins/highcharts/renderer/helpers/config/config.js @@ -1673,6 +1673,10 @@ export function prepareConfig(data, options, isMobile, holidays) { } else { fixTooltipOnClick.bind(this)(event, {options}); } + + if (options.onSeriesClick) { + options.onSeriesClick({event, series: this}); + } }, }, point: { diff --git a/src/plugins/highcharts/types/widget.ts b/src/plugins/highcharts/types/widget.ts index b464d1e3..9a124ee6 100644 --- a/src/plugins/highcharts/types/widget.ts +++ b/src/plugins/highcharts/types/widget.ts @@ -89,16 +89,23 @@ export type HighchartsWidgetData = { drillDown?: DrillDownConfig; enableSum?: boolean; unsafe?: boolean; - /** - * Used to modify tooltip data - */ - manageTooltipConfig?: HighchartsManageTooltipConfig; /** * Tooltip config */ tooltip?: { pinable?: boolean; }; + /** + * Used to modify tooltip data + */ + manageTooltipConfig?: HighchartsManageTooltipConfig; + /** + * Highcharts series click handler + */ + onSeriesClick?: (args: { + event: Highcharts.SeriesClickEventObject; + series: Highcharts.Series; + }) => void; }; libraryConfig: Highcharts.Options; params?: StringParams;