如何打印flot图 [英] How to print flot graph

查看:152
本文介绍了如何打印flot图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮我查一下,如何打印动态图作为flot生成的例子。
我试过这个,但它打印整页,但我只想要图表部分。

Can any body help me to find out, how to print dynamic graph as example generated by flot. I tried this one but it's printing whole page, but I want only graph portion.

function printGraph(){
    $('<img src="../images/button_refresh.png" alt="Print Graph" style="">').appendTo(controlholder).click(function (e) {                        
        //Canvas2Image.saveAsPNG(document.getElementById('placeholder'));
        //canvas.toDataURL("image/png");
        window.print('placeholder');
    });
}


推荐答案

文章描述了如何复制画布到正常 img ,然后可以轻松打印或保存为图像。



重要部分:

This article describes how to copy the canvas to a normal img which can then easily be printed or saved as an image.

The important part:

img.src = canvas.toDataURL();

查看精彩的回答了解更多详情。

See the great answer below from Ignacio Correia for more details.

这篇关于如何打印flot图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆