SVG 图表被 Canvg 转换错误

问题描述

当我尝试使用 Canvg 转换 svg 图表时,char 的条形丢失了。我认为问题可能是在执行条形动画之前将 svg 附加到画布上。

  const canvas = document.createElement('canvas');
  canvas.width = svgElement.clientWidth;
  canvas.height = svgElement.clientHeight;

  const svg = new XMLSerializer().serializetoString(svgElement);

  const ctx = canvas.getContext('2d');
  ctx.fillRect(0,canvas.width,canvas.height);

  const canvgView = await Canvg.fromString(ctx,svg);
  await canvgView.render();

Missing bars

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)