簡體   English   中英

jqplot html無法在新窗口中正確呈現

[英]jqplot html not rendering properly in new window

我有一個使用jqplot生成一些圖的應用程序,我希望能夠打印該圖,並且僅打印該圖。

因此,我編寫了一個簡單的函數,它打開了一個新窗口,其中包含應用程序主頁中graphdiv的代碼。 我的問題是該圖形無法在新窗口中正確顯示。 有任何想法嗎??

function newwindow() {

    var windowObject = window.open('', 'windowObject', 'arguments...');
    windowObject.document.write("<html> <head><link rel='stylesheet' type='text/css' href='jquery.jqplot.css' /></head> <body onload=''><div class='jqplot-target'>" + $('#chartdiv').html() + "</div></body></html>");
    windowObject.document.close();


}

謝謝。

創建一個這樣的函數,以便打開的圖像將具有dataUrl。

var img = $('#chartdiv').jqplotToImage(50, 0);
  if (img) {
    open(img.toDataURL("image/png"));
  } 

可以在此鏈接中找到此圖像的jqplot https://github.com/lsiden/export-jqplot-to-png

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM