Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anthonycoffey/256d21b2a60b7aed49075880fe37e705 to your computer and use it in GitHub Desktop.
Save anthonycoffey/256d21b2a60b7aed49075880fe37e705 to your computer and use it in GitHub Desktop.
Implementation of Custom Highcharts Export Module
const express = require('express');
const router = express.Router();
const exportCharts = require('./modules/export-charts.js'); // this is my export module
router.post('/mbd', async function(req,res){
exportCharts.initPool();
const chartOptions = req.body;
const exportSettings = {
type: 'jpeg',
options: chartOptions,
scale: 2,
};
const chart = await exportCharts.export(exportSettings)
.then(response => {
return response;
})
.catch(error => {
return error;
});
exportCharts.killPool();
res.status(200).send({chart});
});
module.exports = router
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment