gpt4 book ai didi

javascript - Uncaught Error : unsupported number: 00940155. 184155.1840040

转载 作者:行者123 更新时间:2023-11-30 15:06:49 28 4
gpt4 key购买 nike

我正在使用 React 开发一个 Web 应用程序。我想将图表和数据导出到单个 PDF 页面。尝试执行此操作时,我收到以下错误

pdfmake.js:29058 Uncaught Error: unsupported number: 00940155.184155.1840040
at t.number (pdfmake.js:29058)
at r.lineTo (pdfmake.js:37584)
at d (pdfmake.js:2733)
at f (pdfmake.js:2601)
at r.createPdfKitDocument (pdfmake.js:2392)
at i._createDoc (pdfmake.js:104)
at i.getBuffer (pdfmake.js:242)
at i.getDataUrl (pdfmake.js:222)
at Object.toPDF (export.min.js:1)
at Object.<anonymous> (TestLineChart.jsx:105)

这是什么原因?

代码如下

TestLineChart.jsx

chart.export.capture({}, function () {
this.toJPG({}, function (data) {
let chartHeder = document.getElementById('chartHeder').innerText;

images.push({
"text": chartHeder,
"fontSize": 15
});

images.push({
'image': data,
"fit": [523.28, 769.89]
});

images.push({
"text": '\n\n',
"fontSize": 15
});

images.push({
"table": {
"headerRows": 1,
"widths": columnStyleArray,
"body": [ //chart.dataProvider
["DATE VARIANCE", "CURRENT YEAR VARIANCE", "LAST YEAR VARIANCE"],
["5000", "4500", "5100"],
["5000", "4500", "5100"],
["5000", "4500", "5100"],
]
}
});

chart.export.toPDF({
content: images
}, function (data) {
let fileName = chartHeder.split(' /')[0] + '_' + chart.dataProvider[0].date + ' - ' + chart.dataProvider[chart.dataProvider.length - 1].date;
this.download(data, "application/pdf", fileName + ".pdf");
});
});
});

第105行是chart.export.toPDF,我用this开发此代码的示例。

这是jsfiddle

最佳答案

看看你的jsfiddle,这很有趣,但你唯一的问题是,在你的表中,你的第一个宽度值缺少,所以将其更改为“40%” “

我在这里更新了您的jsfiddle

注意我只更改了表格的宽度属性从 "widths": ["40", "30%", "30%"]"widths": ["40%", "30%", "30%"]% 添加到第一个值。

关于javascript - Uncaught Error : unsupported number: 00940155. 184155.1840040,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45627742/

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