1

I am using reportlab in python to render a pdf server side.

I really like the look of highcharts graphs. But I am building a pdf server side which needs to include some graphs. The server side graphing (reportlab and matplotlib) do not have nearly as much choices for formatting / design.

Is there a way I can run a client side javascript graphing solution (highcharts) from the server side?

Here is a post with that request and this is what they said: You feed this Java tool a URL, it fires up its internal WebKit browser, executes the JavaScript code and dumps the rendered page to PDF.

I am looking for resources on how this could be accomplished in python.

4

2 回答 2

2

我有类似的要求,但找不到现有的解决方案,所以我在这里创建了一个小的概念验证解决方案。

这个实现通过让 python 进程创建一个节点子进程来工作,该节点子进程使用highchart-export-server节点模块,而节点模块又产生一个 PhantomJS 实例来呈现图表。那里有几个俄罗斯娃娃,但它确实有效。

于 2017-07-22T16:54:43.483 回答
-2
  1. 在服务器上打开 Web 浏览器。

  2. highcharts将 Web 浏览器指向加载和呈现图表的预制页面。

  3. 获取浏览器的输出。

  4. 将其发送给客户。

哪些步骤看起来令人困惑?

请注意,这将比仅使用 慢得多matplotlib,因为您需要启动一个完整的 Web 浏览器来渲染图形。我快速浏览了您链接的 highcharts 页面,我认为您可能可以在 matplotlib 中重现该页面。

于 2010-09-23T21:05:54.303 回答