Closed benmann497 closed 7 years ago
Hi,
how are you POSTing to the server? It needs to be formatted as JavaScript rather than JSON for function callbacks to work (i.e. no escaping of properties).
Hi,
Thanks for the response. I am using the Node module, so am passing in a JS object with properties. Below is an example of the chart property, with load event. I have simplified the code for calculating where to draw the line, but even with static values it doesnt show...
chart: {
type: 'column',
backgroundColor: '#F8F9FA',
events: {
load: function () {
const renderer = this.renderer;
const lineWidth = 2;
const xPlotPoint = 50;
const yStartPlotPoint = 150;
const yEndPlotPoint = 250;
renderer.path(['M', xPlotPoint, yStartPlotPoint, 'L', xPlotPoint, yEndPlotPoint])
.attr({
'stroke-width': lineWidth,
stroke: 'red',
dashstyle: 'solid',
zIndex: 5
})
.add();
}
}
}
Thanks.
Unfortunatly, function when using the export server as a node module is not fully supported.
This has to do with having to serialize the options to pass them to phantomjs.
While we do have this kind of support on our radar, I can't give you an ETA right now on when/if it may be imlemented.
The only workaround currently is using either customCode
or callback
- the former may work for you.
Also, if you manage to transform your options into to a JavaScript string and pass that in as the options, everything should work as expected.
Hi, if it's of any help: Actually I have just managed to have the export server export charts with quite elaborate functions in the load event. I do this by using export server's 'infile' property to load the chart options file which contains the functions.
Thanks for these, I will give them a go shortly.
Hello,
I was able to get this working by passing null as the dataOptions and customCode to add the load event.
Thanks for your help.
Great, thanks for letting getting back on this!
Hello, we're adding a line to a chart using the chart.events.load function. This works fine in the browser, but isn't rendering when using the node export server.
Is there an alternative or a setting to make the load event fire?
Thanks.