图表师绘制的图表未使用 wkhtmltopdf 正确显示

chart drawn by chartist is not shown properly using wkhtmltopdf

12.4生成pdf,图表由chartist绘制,因为chartist是基于svg的。我可以通过 html(test-chartist.html right chart).But When I user the command wkhtmltopdf --dpi 300 --page-size A4 test-chartist.html test3.pdf, chart is blank in the test3.pdf. And then I add the flowing js , the result is weirdsize is not right and direction is not right too

在浏览器中查看图表

Function.prototype.bind = Function.prototype.bind || function (thisp) {
    var fn = this;
    return function () {
        return fn.apply(thisp, arguments);
    };
};

有人可以帮助我吗?非常感谢

好吧,我突然找到答案了。 如果我在图表的选项中添加宽度和高度,一切都很好,如下所示:

 var options = {
  width: 800,
  height: 150,
  donut: true,
  donutWidth: 30,
 startAngle: 240,
  total: 30,
  showLabel: true,
  animation:false
};

new Chartist.Pie('#mainImg', {
  series: [10,10]
},options);

希望对大家有所帮助