如何解决如何将交互式仪表板应用程序导出为 html 独立文件以将其嵌入您的网站?
所以我在 python 中使用 plotly 制作了一个交互式仪表板。我部署了该应用程序并将可视化图转换为静态 html 文件。但是,如果我也想嵌入包括非静态组件在内的整个仪表板,该怎么办。我的目标是开发一个简单的交互式仪表板,它以 csv 作为输入,并将文本中的几行数据可视化,以后可以将其作为一个整体嵌入到预先存在的 xml/html 页面中。像这样:
我使用回调为最终用户提供了一些交互式过滤器:
@app.callback(
Output(component_id='release_choice',component_property='options'),[Input(component_id='Tech_choice',component_property='value')])
def get_options(Tech_choice):
dff = df[df.Technology == Tech_choice]
return [{'label': i,'value': i} for i in dff['SystemRelease'].unique()]
@app.callback(
Output(component_id='release_choice',component_property='value'),[Input(component_id='release_choice',component_property='options')])
def get_values(release_choice):
return [k['value'] for k in release_choice][1]
@app.callback(
[Output(component_id='date_choice',component_property='start_date'),Output(component_id='date_choice',component_property='end_date')],component_property='value')])
def get_options(date_choice):
dff = df[df.date2 == date_choice]
return [{'label': i,'value': i} for i in dff['date2']]
@app.callback(Output(component_id='my-graph',component_property='figure'),Input(component_id='Tech_choice',Input(component_id='date_choice',)
我使用 pandas 和 plotly 做了一个类似的破折号,如下所示:
我使用 fig.write_image 来获取 html 文件,但它又是静态的。那么你有什么建议呢?我认为 plotly 不会做预期的工作。我还可以在 python 中使用什么?
解决方法
您可以使用 html 的 iframe 标签:
<iframe src="https://www.w3schools.com" title="W3Schools Free Online Web Tutorials"></iframe>
只需将“src”替换为您网站的 URL,这样您就可以将您的情节网站嵌入到任何其他 HTML 页面中。动态元素仍然有效。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。