打印Dygraph图表

时间:2013-01-18 14:06:49

标签: javascript dygraphs

我正在尝试打印包含dygraph的Div,如下所示:

的javascript:

<script type="text/javascript">
            function PrintElem(elem)
            {               
                Popup(document.getElementById(elem).innerHTML);
            }

            function Popup(data) 
            {
                var mywindow = window.open('', 'my div', 'height=400,width=800');
                mywindow.document.write('<html><head><title>my div</title>');                
                mywindow.document.write('</head><body >');
                console.log(data);
                mywindow.document.write(data);
                mywindow.document.write('</body></html>');

                mywindow.print();
                mywindow.close();

                return true;
            }    
        </script>

在HTML中:

<input type="button" value="Print Div" onclick="PrintElem('divName')" />

问题陈述:

dygraph(“divName”)包含一个脚本,用于绘制HTML中的实际图表。 在尝试打印innerHTML时,打印功能无法满足此要求。

还有其他办法吗? 谢谢!

0 个答案:

没有答案