With highcharts, we have a built-in button to download the current chart (example: http://www.highcharts.com/demo/, this button: arrow). We can save it as PNG, JPEG, PDF or SVG.
Instead of downloading it on client side i want to download image on server and sent that image to particular user through email How could I do that using Node.js ?
I got this solution, but getting TypeError: chartExporter.export is not a function:-
const fs = require("fs");
const chartExporter = require("highcharts-export-server");
chartExporter.initPool();
let chartOptions = highchart chart option
chartExporter.export({
type: "svg",
outfile: "./output-file.svg",
options: chartOptions
}, (err, res) => {
console.log(`The chart has been succesfully generated as SVG at ${res.filename}!`);
chartExporter.killPool();
});
How to resolve this issue or anyone has any other solution to fulfil my requirement
2
Answers
According to your description,
So your requirement is to fetch the image in to your NodeJS backend app and then send the image to the frontend/client.
To achieve this, you need to make HTTP request from you NodeJS application to highcharts and you can use AXIOS or NodeJS HTTP module. Once you get the image into your application the second part is to send the image to your client. There are main two possible scenarios to do this as below,
I think you got some wrong documentation the name of function is
startExport
Please try the code below