Version
5.30
Link to Minimal Reproduction
No response
Steps to Reproduce
Hi, I am currently replicating this server side rendering example provided for canvas and facing this issue where I'm unable to pass in the Canvas object into the echarts.init function due to a type mismatch
Am using nodeJS:
Code portion:
import * as echarts from "echarts";
import { createCanvas } from "canvas";
const canvas = createCanvas(800, 600);
// ECharts can use the Canvas instance created by node-canvas as a container directly
const chart = echarts.init(canvas);
chart.setOption({
xAxis: {
type: "category",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
},
yAxis: {
type: "value",
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
type: "bar",
},
],
});
Current versions:
"canvas": "^2.9.0",
"echarts": "^5.3.0",
It seems that the error is caused by type mismatch between the input and the accepted parameters for Typescript. Looking for anyone to advise on this issue, thanks!
Current Behavior
Error line:
const chart = echarts.init(canvas);
Error:
Argument of type 'Canvas' is not assignable to parameter of type 'HTMLElement'.
Type 'Canvas' is missing the following properties from type 'HTMLElement': accessKey, accessKeyLabel, autocapitalize, dir, and 277 more.ts(2345)
Expected Behavior
No issue with inserting Canvas object into echarts.init function, as stated here
Mentioned in the code sample
// ECharts can use the Canvas instance created by node-canvas as a container directly
Environment
- OS: Windows 10 Pro
- Browser:
- Framework: ts-node
Any additional comments?
No response
Version
5.30
Link to Minimal Reproduction
No response
Steps to Reproduce
Hi, I am currently replicating this server side rendering example provided for canvas and facing this issue where I'm unable to pass in the Canvas object into the echarts.init function due to a type mismatch
Am using nodeJS:
Code portion:
Current versions:
It seems that the error is caused by type mismatch between the input and the accepted parameters for Typescript. Looking for anyone to advise on this issue, thanks!
Current Behavior
Error line:
const chart = echarts.init(canvas);Error:
Expected Behavior
No issue with inserting Canvas object into echarts.init function, as stated here
Mentioned in the code sample
// ECharts can use the Canvas instance created by node-canvas as a container directly
Environment
Any additional comments?
No response