git clone --depth 1 https://github.com/crapthings/highcharts-export-server
cd highcharts-export-server
npm i
npm start
const data = await axios.post('http://localhost:3000/export', {
{
format: 'png', // can be png, jpeg, pdf, svg
options: {
chart: {
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
},
exportOptions: {} // this can be override exportChartLocal({ ...exportOptions })
}
})
{
"result": {
"downloadUrl": "/4af6b52009.png"
}
}
support 'png', 'jpeg', 'pdf', 'svg'
format will be override if you specify exportOptions.type
https://www.highcharts.com/docs/getting-started/your-first-chart