You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, the issue has been resolved. Just need to change the echarts settings to the following content. I will keep this problem open for others to reference. (Attention: You must use echarts with base64 only)
echarts.setPlatformAPI({
createCanvas() {
return createCanvas();
},
loadImage(src, onload, onerror) {
const img = new Image();
// No need to bind context, echarts fixed it.
// img.onload = onload.bind(img);
// img.onerror = onerror.bind(img);
// The problem lies here: Echarts believes that it should be base64, but @napi-rs/canvas operates with Buffer. (works fine with node-canvas)
img.src = src;
return img;
}
});
when pass it with base64, it throws Error: Failed to create reference from Buffer
when pass it with Buffer, it throws Error: Unsupported image type
The text was updated successfully, but these errors were encountered:
echarts.setPlatformAPI({
createCanvas() {
return createCanvas();
},
loadImage(src, onload, onerror) {
const img = new Image();
// No need to bind context, echarts fixed it.
// img.onload = onload.bind(img);
// img.onerror = onerror.bind(img);
// The problem lies here: Echarts believes that it should be base64, but @napi-rs/canvas operates with Buffer. (works fine with node-canvas)
img.src = src;
return img;
}
});
when pass it with base64, it throws Error: Failed to create reference from Buffer when pass it with Buffer, it throws Error: Unsupported image type
@napi-rs/canvas comes with loadImage function which supports base64
Hey, the issue has been resolved. Just need to change the echarts settings to the following content. I will keep this problem open for others to reference. (Attention: You must use echarts with base64 only)
Old:
when pass it with base64, it throws
Error: Failed to create reference from Buffer
when pass it with Buffer, it throws
Error: Unsupported image type
The text was updated successfully, but these errors were encountered: