Python中的动态绘图可视化(或图像)
我有一个html格式的绘图可视化('viz.html')。我使用Flask的Python中的动态绘图可视化(或图像),python,flask,plotly,Python,Flask,Plotly,我有一个html格式的绘图可视化('viz.html')。我使用Flask的url\u for()语法将其嵌入到我的网页中,引用静态文件夹: <iframe id="igraph" scrolling="no" style="border:none;" seamless="seamless" src="{{ url_for('static', filename='viz.html') }}"
url\u for()
语法将其嵌入到我的网页中,引用静态文件夹:
<iframe id="igraph" scrolling="no" style="border:none;" seamless="seamless" src="{{ url_for('static', filename='viz.html') }}" height="400" width="120%"></iframe>
在html页面上禁用浏览器缓存()
我想知道,我想做的是可能的吗
如果可能的话,我该怎么做呢?谢谢你的建议 我不是一名web开发人员,但我与一些人密切合作了3年。据我所知,没有办法控制其他浏览器保存为缓存的内容。如果我的浏览器在缓存中保存了一个版本,它将使用该版本。通常,浏览器会检查是否所有的文件都被更新,最终,它会为每个人刷新。事实上,我听到开发人员被问到“为什么你不修正我告诉你的东西?”他们说,“我有,只是硬刷新。”所以我认为没有办法。IDK,如果有什么新的东西在那里。我不是一个网络开发人员,但我与一些人密切合作了3年。据我所知,没有办法控制其他浏览器保存为缓存的内容。如果我的浏览器在缓存中保存了一个版本,它将使用该版本。通常,浏览器会检查是否所有的文件都被更新,最终,它会为每个人刷新。事实上,我听到开发人员被问到“为什么你不修正我告诉你的东西?”他们说,“我有,只是硬刷新。”所以我认为没有办法。IDK如果有什么新的东西在那里。我想出来了 不要将绘图
fig
写入viz.html
文件,而是在烧瓶中执行viz=Markup(fig)
:
@app.route("/index/",methods=["POST", "GET"])
def foo():
from flask import Markup
# include_plotlyjs = True builds in the js library
# output_type = 'div' outputs the html code
viz = plot(fig, include_plotlyjs = True, output_type = 'div')
# Markup directly renders the html code
viz = Markup(viz)
return render_template('foo.html', viz = viz)
在foo.html
中,您可以直接使用viz
,如下所示:
<html>
<body>
viz
</body>
<html>
即
中提琴 我想出来了
不要将绘图fig
写入viz.html
文件,而是在烧瓶中执行viz=Markup(fig)
:
@app.route("/index/",methods=["POST", "GET"])
def foo():
from flask import Markup
# include_plotlyjs = True builds in the js library
# output_type = 'div' outputs the html code
viz = plot(fig, include_plotlyjs = True, output_type = 'div')
# Markup directly renders the html code
viz = Markup(viz)
return render_template('foo.html', viz = viz)
在foo.html
中,您可以直接使用viz
,如下所示:
<html>
<body>
viz
</body>
<html>
即
中提琴 是的,我认为你是对的,我没有将其写入缓存的.html文件,而是在我的应用程序中呈现可视化效果。问题解决了!是的,我认为你是对的,我没有将其写入缓存的.html文件,而是在我的应用程序中呈现可视化效果。问题解决了!
<html>
<body>
viz
</body>
<html>