Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在短划线/绘图中使用iframe?(Python/HTML)_Python_Html_Iframe_Dashboard_Plotly Dash - Fatal编程技术网

如何在短划线/绘图中使用iframe?(Python/HTML)

如何在短划线/绘图中使用iframe?(Python/HTML),python,html,iframe,dashboard,plotly-dash,Python,Html,Iframe,Dashboard,Plotly Dash,我正在创建一个仪表板,我想使用这个交互式地图 网页链接: 嵌入式代码: 现在我不知道有多少HTML,但这是我到目前为止所知道的。我知道布局是错误的,但我已经被困了很长一段时间了,有人能告诉我正确的方向吗。非常感谢 import dash import dash_core_components as dcc import dash_html_components as html import plotly.express as px import pandas as pd from dash.d

我正在创建一个仪表板,我想使用这个交互式地图

网页链接:

嵌入式代码:

现在我不知道有多少HTML,但这是我到目前为止所知道的。我知道布局是错误的,但我已经被困了很长一段时间了,有人能告诉我正确的方向吗。非常感谢

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
from dash.dependencies import Input, Output

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)


#H1 = biggest heading,  Div = a box containhg info
app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

    html.Div(children='''
        Dash: A web application framework for Python.
    '''),

    dcc.Graph(
        id='example-graph',
        figure=fig
        
    <iframe height="1067px" width="100%" src="https://www.ons.gov.uk/visualisations/dvc914/map/index.html"></iframe>
    )
])

if __name__ == '__main__':
    app.run_server(debug=True,port=8049,host='127.0.0.1')
导入破折号
将仪表板核心组件作为dcc导入
将dash_html_组件导入为html
将plotly.express导入为px
作为pd进口熊猫
从dash.dependencies导入输入,输出
外部_样式表=['https://codepen.io/chriddyp/pen/bWLwgP.css']
app=dash.dash(名称,外部样式表=外部样式表)
#H1=最大标题,Div=包含hg信息的框
app.layout=html.Div(子项)=[
H1(children='Hello Dash'),
html.Div(子类=“”'
Dash:Python的web应用程序框架。
'''),
图(
id='example-graph',
图=图
)
])
如果uuuu name uuuuuu='\uuuuuuu main\uuuuuuu':
app.run_服务器(debug=True,port=8049,host='127.0.0.1')

你就快到了。只需将iframe元素的语法替换为用于其他元素的破折号语法

import dash
import dash_core_components as dcc
import dash_html_components as html

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

    html.Div(children='''
        Dash: A web application framework for Python.
    '''),

    dcc.Graph(
        id='example-graph',
        # figure=fig  # commented out to make the example runnable
    ),

    html.Iframe(src="https://www.ons.gov.uk/visualisations/dvc914/map/index.html",
                style={"height": "1067px", "width": "100%"})
])

if __name__ == '__main__':
    app.run_server(debug=True, port=8049, host='127.0.0.1')