From 57787f4e135c6b0a164e1dc35cc3b7edfea01d81 Mon Sep 17 00:00:00 2001 From: Dietrich Streifert Date: Wed, 31 Jul 2024 15:53:03 +0200 Subject: [PATCH 1/3] Make userOptions of the chart available within customCode context Make the chart options available again in the customCode context which is compatible to the previous, phantomjs/node export server. Fixes https://github.com/highcharts/node-export-server/issues/548 --- lib/highcharts.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/highcharts.js b/lib/highcharts.js index 76afd976..e82a2213 100644 --- a/lib/highcharts.js +++ b/lib/highcharts.js @@ -41,11 +41,6 @@ export async function triggerExport(chartOptions, options, displayErrors) { // prevent from polluting other exports that can happen on the same page Highcharts.setOptionsObj = merge(false, {}, getOptions()); - // Trigger custom code - if (options.customLogic.customCode) { - new Function(options.customLogic.customCode)(); - } - // By default animation is disabled const chart = { animation: false @@ -100,6 +95,11 @@ export async function triggerExport(chartOptions, options, displayErrors) { const userOptions = options.export.strInj ? new Function(`return ${options.export.strInj}`)() : chartOptions; + + // Trigger custom code + if (options.customLogic.customCode) { + new Function('options', options.customLogic.customCode)(userOptions); + } // Merge the globalOptions, themeOptions, options from the wrapped // setOptions function and user options to create the final options object From 7be35f42eceab35ed4ec11efc9b5f306b2bfa8a4 Mon Sep 17 00:00:00 2001 From: Dietrich Streifert Date: Fri, 2 Aug 2024 15:07:58 +0200 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be50937b..10f9ee88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 4.1.0 + +_Fixes:_ + +- Made chart userOptions available within `customCode` as variable `options` [(#551)](https://github.com/highcharts/node-export-server/issues/551). + # 4.0.0 _Breaking Changes:_ From ca80ae083a58c5a97d6f4fb0b5eb6c787ef0f7ef Mon Sep 17 00:00:00 2001 From: PawelDalek Date: Mon, 5 Aug 2024 11:23:46 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b84f0216..2ebff2f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 4.1.0 +# 4.0.2 _Fixes:_