javascript - 应用将图表转换为图像的 jqplot 代码时 Chrome 挂起

标签 javascript jquery google-chrome jqplot

到目前为止,我已经在两个浏览器(Chrome 和 Firefox)上测试了我的代码。该代码在 Firefox 中运行得很好,但在 Chrome 中却挂起(哦,Snap)。我已将有问题的代码隔离到这些行

var imgData1 = jQuery('#graph1').jqplotToImageStr({});
var imgData2 = jQuery('#graph2').jqplotToImageStr({});
var imgData3 = jQuery('#graph3').jqplotToImageStr({});
var imgData4 = jQuery('#graph4').jqplotToImageStr({});

var imgElem1 = jQuery('<img/>').attr('src', imgData1);
var imgElem2 = jQuery('<img/>').attr('src', imgData2);
var imgElem3 = jQuery('<img/>').attr('src', imgData3);
var imgElem4 = jQuery('<img/>').attr('src', imgData4);

jQuery('#imgChart1').append(imgElem1);
jQuery('#imgChart2').append(imgElem2);
jQuery('#imgChart3').append(imgElem3);
jQuery('#imgChart4').append(imgElem4);

我怀疑问题出在 jqplotToImageStr({}); 上。

不幸的是,没有抛出任何错误,所以我对此没有任何可提供的。谷歌搜索显示这是一个已知问题,但据我所知,尚未提供任何解决方案,因此我在这里寻求答案。

到目前为止,我已尝试更新 jqplot 库并确保 jQuery 是最新的,但问题仍然存在。

更新:我发现,当我的主机是本地主机 (127.0.0.1:8000) 但不是来自实时服务器时,它在 Chrome 中工作正常。

最佳答案

所以我的问题的答案可以找到here 。在我看来,最好的答案是@augray 的答案。最新版本的 jqplot 已修复,一旦我将最新的 jqplot 正确上传到服务器,它就可以在 Chrome 上运行,这让我松了一口气。

关于javascript - 应用将图表转换为图像的 jqplot 代码时 Chrome 挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37099302/

相关文章:

javascript - 无法创建在 IE 中工作的日期对象

javascript - 是否可以将光标锁定/聚焦到文本区域的最后一行?

jquery - 如何禁用 jQuery Mobile 滚动到页面顶部?

php - 如何对两个变量求和 : constant and iterated in text input's "name"?

javascript - 在 chrome 83 中悬停时如何从选项中删除黑色边框

google-chrome - 如何在 Chrome 浏览器中使用 HTML5 Canvas 绘制图像阴影

jquery - qTip2在Chrome中的定位

javascript - 如何在数组中的全名后添加逗号?

javascript - 从远程页面关闭jQuery模式对话框

javascript - 使用不带节点图标的 dynaTree