Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 4.0.2

_Fixes:_

- Made chart userOptions available within `customCode` as variable `options` [(#551)](https://github.com/highcharts/node-export-server/issues/551).

# 4.0.1

_Hotfix_:
Expand Down
10 changes: 5 additions & 5 deletions lib/highcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down