簡體   English   中英

如何將交互式儀表板應用程序導出到 html 獨立文件中以將其嵌入您的網站?

[英]How to export an interactive dashboard app into a html standalone file to embed it to your website?

所以我在 python 中使用 plotly 制作了一個交互式儀表板。 我部署了應用程序並將可視化圖轉換為 static 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')],
    [Input(component_id='release_choice', 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='release_choice', component_property='value'),
              Input(component_id='Tech_choice', component_property='value'),
              Input(component_id='date_choice', component_property='start_date'),
              Input(component_id='date_choice', component_property='end_date')], )

我使用 pandas 和 plotly 做了一個類似的破折號,如下所示:
在此處輸入圖像描述

我使用 fig.write_image 來獲取 html 文件,但它再次只是 static。 那么你的建議是什么? 我認為 plotly 不會做預期的工作。 我還能在 python 中使用什么?

您可以使用 html 的 iframe 標簽:

 <iframe src="https://www.w3schools.com" title="W3Schools Free Online Web Tutorials"></iframe>

只需將“src”替換為您網站的 URL,這樣您的 plotly 網站就會嵌入到任何其他 HTML 頁面中。 動態元素仍然有效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM