【问题标题】:chart drawn by chartist is not shown properly using wkhtmltopdfchartist 绘制的图表未使用 wkhtmltopdf 正确显示
【发布时间】:2018-04-08 18:56:35
【问题描述】:

12.4 生成pdf,图表由chartist绘制,因为chartist是基于svg的。我可以通过 html(test-chartist.html right chart) 在浏览器中看到图表。但是当我使用命令 wkhtmltopdf --dpi 300 --page-size A4 test-chartist.html test3.pdf 时,test3.pdf 中的图表是空白的。然后我添加了流动的js,结果很奇怪size 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);
    };
};

谁能帮帮我?非常感谢

【问题讨论】:

    标签: javascript svg pdf-generation wkhtmltopdf


    【解决方案1】:

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

     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);
    

    我希望它可以帮助别人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-07
      • 1970-01-01
      • 1970-01-01
      • 2022-07-06
      • 2020-06-01
      • 2021-12-14
      • 1970-01-01
      • 2011-09-18
      相关资源
      最近更新 更多