Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does WeasyPrint supports Charts? #755

Closed
wally-yu opened this issue Dec 17, 2018 · 2 comments
Closed

Does WeasyPrint supports Charts? #755

wally-yu opened this issue Dec 17, 2018 · 2 comments

Comments

@wally-yu
Copy link

wally-yu commented Dec 17, 2018

Dear WeasyPrint team,

Thanks for working out such a useful tool, it helps me quite a lot :)

May i ask if it would be possible if my HTML includes charts rendered by either highcharts or echarts and can be included in PDF generation?
I tried using echarts (rendered as SVG) but seems like the charts finally didn't show in the generated PDF file.
Could you please help suggest if that would be possible to do that?

Thanks in advance.

Wally

Here comes the sample code of svg echarts:

<script src="https://cdn.bootcss.com/echarts/4.2.0-rc.2/echarts.min.js"></script>
<div id="main" style="width: 600px;height:400px;"></div>

        <script type="text/javascript">
            // 基于准备好的dom,初始化echarts实例
            var myChart = echarts.init(document.getElementById('main'), null, {renderer: 'svg'});

            // 指定图表的配置项和数据
            var option = {
                title: {
                    text: 'ECharts 入门示例'
                },
                tooltip: {},
                legend: {
                    data:['销量']
                },
                xAxis: {
                    data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
                },
                yAxis: {},
                series: [{
                    name: '销量',
                    type: 'bar',
                    data: [5, 20, 36, 10, 10, 20]
                }]
            };

            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
        </script>```
@Tontyna
Copy link
Contributor

Tontyna commented Dec 17, 2018

WeasyPrint doesn't execute JavaScript. The <script> is igored and no SVG produced if you feed your HTML directly to WeasyPrint.

See #454, #739.

@wally-yu
Copy link
Author

i see, thanks for your quick reply, seems the only way is to render everything from server side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants