diff --git a/packages/api/src/controllers/files.js b/packages/api/src/controllers/files.js index 6b916130d..672d81672 100644 --- a/packages/api/src/controllers/files.js +++ b/packages/api/src/controllers/files.js @@ -203,10 +203,10 @@ module.exports = { }, exportChart_meta: true, - async exportChart({ filePath, title, config, image }) { + async exportChart({ filePath, title, config, image, plugins }) { const fileName = path.parse(filePath).base; const imageFile = fileName.replace('.html', '-preview.png'); - const html = getChartExport(title, config, imageFile); + const html = getChartExport(title, config, imageFile, plugins); await fs.writeFile(filePath, html); if (image) { const index = image.indexOf('base64,'); diff --git a/packages/api/src/utility/getChartExport.js b/packages/api/src/utility/getChartExport.js index b70d4e8e2..53331c5a9 100644 --- a/packages/api/src/utility/getChartExport.js +++ b/packages/api/src/utility/getChartExport.js @@ -1,4 +1,12 @@ -const getChartExport = (title, config, imageFile) => { +const getChartExport = (title, config, imageFile, plugins) => { + const PLUGIN_TAGS = { + zoom: '', + dataLabels: + '', + outlabels: + '', + }; + return ` @@ -8,7 +16,7 @@ const getChartExport = (title, config, imageFile) => { - + ${plugins.map(plugin => PLUGIN_TAGS[plugin] ?? '')}