您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

以交互模式在qwebview中打开绘图

以交互模式在qwebview中打开绘图

好的,我应该找到问题所在。

似乎QWebView加载本地文件有些困难,因为它太重了(简单绘图大约2mb)。

所以我用的选项, 包括javascript保存本地文件时,并加载javascript在第二时刻的感谢,作为描述在这里

换句话说,创建初始的html标签包括通过plotly生成的图形结果而没有整个javascript代码,并包括javascript的链接

这样,文件非常轻便,QWebView没有问题可以打开它。

# create the initial html code
raw_html = '<head><Meta charset="utf-8" /></head>''<head><Meta charset="utf-8" /><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head>'

# call the plot method without all the javascript code
raw_html += plotly.offline.plot(fig, filename = fn, include_plotlyjs=False)

# close the body and html tags
raw_html += '</body></html>'
其他 2022/1/1 18:46:33 有567人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶