[英]Printing Jchartfx chart
I'm not really sure on how to do this. 我不确定如何执行此操作。 I can get it to print by doing the code below however it comes out in black and white and there are 2 of them when I recreate the chart multiple times, but never more than two
我可以通过下面的代码来打印它,但是它以黑色和白色显示,当我多次重新创建图表时有两种,但是从不超过两次
var PrintString = "";
var c = $('.classcontainingChart').find('.jchartfx');
$(c).each(function (i, chart) {
PrintString += $(chart).html();
});
var PrintWindow = window.open('');
PrintWindow.document.write(PrintString);
PrintWindow.print();
PrintWindow.close();
I'm not sure on what you want here but I tried modifying your code snippet: 我不确定您要在这里做什么,但是我尝试修改您的代码段:
var PrintString = "";
var c = $('.classcontainingChart').find('.jchartfx');
$(c).each(function (i, chart) {
PrintString += $(chart).html();
});
var win = window.open("");
var windowContainer = win.document;
windowContainer.open();
windowContainer.write("<!DOCTYPE html><html><head></head><body><div id='div1'>" + PrintString +"</div></body></html>");
windowContainer.close();
win.print();
And when I loaded it, I am able to see all my charts ready for print: 当我加载它时,我可以看到所有准备打印的图表:
Also need to make sure that popups are enabled to do this. 还需要确保启用了弹出窗口来执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.