problem description
const jsdom = require ("jsdom");
const echarts = require ("echarts")
var d3 = require (" d3");
const {JSDOM} = jsdom;
const html2canvas = require ("html2canvas")
const {createCanvas} = require (" canvas")
require ("zrender/lib/svg/svg");
const myPDFcanvas = createCanvas(600, 800)
echarts.setCanvasCreator(() => myPDFcanvas)
console.log(containerDom,"containerDom")
const chart = echarts.init(containerDom, null, {
renderer:"canvas",
})
the environmental background of the problems and what methods you have tried
in this way, the terminal keeps reporting an error "
dyld: lazy symbol binding failed: Symbol not found: _ ZN2v87Isolate19CheckMemoryPressureEv"
related codes
/ / Please paste the code text below (do not replace the code with pictures)
/ / Linear chart
const jsdom = require ("jsdom");
const echarts = require ("echarts")
var D3 = require (" d3");
const {JSDOM} = jsdom;
const html2canvas = require ("html2canvas")
const {createCanvas} = require (" canvas")
require ("zrender/lib/svg/svg");
const PNG = require (". / png.js")
const myPDFcanvas = createCanvas(600, 800)
echarts.setCanvasCreator(() => myPDFcanvas)
console.log(containerDom,"containerDom")
const chart = echarts.init(containerDom, null, {
renderer:"canvas",
})
var option = {
backgroundColor: "white",
title: {
text: "ECharts "
},
animation:false,
tooltip: {},
legend: {
data: ["11"]
},
xAxis: {
data: ["121", "1212", "1212", "121212", "12121212", "121212"]
},
yAxis: {},
series: [{
name: "112",
type: "bar",
data: [5, 20, 36, 10, 10, 20]
}]
};
chart.setOption(option);
doc.image(chart.getDataURL(), 54, 168, {width:500,height:300}).stroke();
// html2canvas(chart, {
// onrendered: function(canvas) {
// console.log(canvas,"canvas")
// document.body.appendChild(canvas);
// }
// });
}
module.exports = {
chart
}