微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何将交互式仪表板应用程序导出为 html 独立文件以将其嵌入您的网站?

如何解决如何将交互式仪表板应用程序导出为 html 独立文件以将其嵌入您的网站?

所以我在 python 中使用 plotly 制作了一个交互式仪表板。我部署了该应用程序并将可视化图转换为静态 html 文件。但是,如果我也想嵌入包括非静态组件在内的整个仪表板,该怎么办。我的目标是开发一个简单的交互式仪表板,它以 csv 作为输入,并将文本中的几行数据可视化,以后可以将其作为一个整体嵌入到预先存在的 xml/html 页面中。像这样:

enter image description here

我使用回调为最终用户提供了一些交互式过滤器:

@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 做了一个类似的破折号,如下所示:

enter image description here

我使用 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 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?