highcharts / node-export-server

Highcharts Node.js export server
Other
356 stars 260 forks source link

Is it possible to access the Highcharts object to set dateFormats or load plugins? #54

Closed kryft closed 2 years ago

kryft commented 7 years ago

We would like to use a custom date format as demonstrated in http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/global/dateformats/

Is this possible when exporting a chart with node-export-server? Can we access the Highcharts object somehow in the callback provided via the callback option?

TorsteinHonsi commented 7 years ago

In http://export.highcharts.com/, you would put the custom code in the "JavaScript" textarea at the bottom. The callback options runs too late.

@cvasseng What server argument does this translate to?

cvasseng commented 7 years ago

The customCode body argument runs prior to initializing the chart, so that would be a good bet.

kryft commented 7 years ago

The description for customCode says

When dataOptions is supplied, this is a function to be called with the after applying the data options. Its only argument is the complete options object which will be passed to the Highcharts constructor on return.

I don't really understand what dataOptions does (I couldn't find API documentation on Highcharts.data()), but it sounds like the customCode callback might not get called if dataOptions hasn't been supplied.

According to the description, the customCode callback would get the options object as an argument. How would it get access to the Highcharts(/Highstock) object itself?

jb3-2 commented 7 years ago

Hi, if it's of any help, in my node code I add a function that accesses the Highcharts object before rendering the chart. That works for me. See here (line 89): https://github.com/statabs-test/indikatoren/blob/434316b638cbb253f733d2192808305bb80b5d58/build/exportChartImages.js#L89

PaulDalek commented 2 years ago

Closed by the https://github.com/highcharts/node-export-server/pull/338.