gpt4 book ai didi

node.js - 无法在实时服务器上的 highcharts-export-server 中获取数据标签

转载 作者:太空宇宙 更新时间:2023-11-03 21:52:00 26 4
gpt4 key购买 nike

  1. 我正在使用 highcharts-export-server 导出图表并将其以 PDF 格式发送到电子邮件
  2. 当我尝试在本地导出它时,它工作正常,但在实时服务器上,当我尝试导出所有图表数据标签消失时。

    this is the image from which was exporting from live server.

enter image description here

and here is the image which was exporting locally.

enter image description here

Here is my Code

exports.getPieChartImg = (seriesData, xOrLength, innersize, showLegend, width, height) => {
var chartOpts = {
chart: {
type: 'pie',
width: width,
height: height,
},
plotOptions: {
pie: {
innerSize: innersize || 80,
depth: 25,
allowPointSelect: true,
dataLabels: {
enabled: false,
format: '<b>{point.name}</b>: {point.percentage:.2f} %'
},
showInLegend: showLegend || false,
},
series: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: '#6f6f6f',
format: '{point.percentage:.2f}',
crop: false,
overflow: "none",
},
pointWidth: 30,
}
},
legend: {
labelFormat: '<b>{name}</b> ({percentage:.2f})%',
useHTML: true,
},
series: [{
data: seriesData
}]
};

var exportSettings = generateExportSettings(chartOpts, 'Pie');
return generateBase64Chart(exportSettings)
}

function generateExportSettings(chartOpts, constr) {
return {
// b64: true,
instr: JSON.stringify(chartOpts),
noDownload: true,
constr,
globalOptions: {
colors: ['#3BB9DA', '#0F89A8', '#0B8F8B', '#1DB1AD', '#68E3DF', '#FFB469', '#F58B1F', '#D16900', '#FC3C3C', '#FF6666', '#FC8D8D', '#FCC0C0'],
lang: {
thousandsSep: ','
}
},
scale: false,
styledMode: false,
type: "image/png",
width: false,
};
}

function generateBase64Chart(exportSettings) {
return new Promise((resolve, reject) => {
highchartsExporter.export(exportSettings, function (err, res) {
if (err) {
return reject({
code: '1',
err,
msg: 'Error in stock chart',
exportSettings
})
}
return resolve({
code: '0',
msg: 'success',
data: 'data:image/png;base64,' + res.data,
})
});
})
}

最佳答案

  1. 删除node_module并重新安装。
  2. 如果未安装 libfontconfig,则安装'sudo apt-get install libfontconfig'

关于node.js - 无法在实时服务器上的 highcharts-export-server 中获取数据标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51491090/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com