最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Convert jqplot chart to image - Stack Overflow

programmeradmin3浏览0评论

I'm trying to convert the entire jqplot bar chart, including it's legend and chart title, to image. However, using toDataURL and steps in this post (Convert canvas to image and open in new window using ruby on rails and javascript), I'm only able to convert the chart with it's axis and axis label to image.

As the legend and chart title is not rendered on the canvas, they are not being converted.

Can someone tell me how to convert the chart title and legend with the canvas please?

I'm trying to convert the entire jqplot bar chart, including it's legend and chart title, to image. However, using toDataURL and steps in this post (Convert canvas to image and open in new window using ruby on rails and javascript), I'm only able to convert the chart with it's axis and axis label to image.

As the legend and chart title is not rendered on the canvas, they are not being converted.

Can someone tell me how to convert the chart title and legend with the canvas please?

Share Improve this question edited May 23, 2017 at 12:04 CommunityBot 11 silver badge asked Jun 8, 2011 at 9:39 MichMich 2571 gold badge3 silver badges9 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

Since the title and axes are div and not img or canvas I think the only solution would be to write every text in a canvas with the fillText() function. Then convert this to picture.

You can write in canvas like that : fillText("Hello World!", x, y);

Now you can also add this to jQplot as a plugin :)

Good luck

I have been working on a bare implementation. It is linked here https://bitbucket/cleonello/jqplot/issue/14/export-capabilities#ment-554274 It should support every example that is distributed with jqplot.

发布评论

评论列表(0)

  1. 暂无评论