我想将 Plotly 图表嵌入到我自己的 html 文件中。使用 Dash,我可以在 API 本地服务器中生成相同的图表。
但是对于我自己的 HTML 文件,我没有得到任何解决方案:
我的达世币解决方案:
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div(children=[
html.H1(children='Dash Tutorials'),
dcc.Graph(
id='example',
figure={
'data': [
{'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'y': [9, 6, 2, 1, 5, 4, 6, 8, 1, 3], 'type': 'bar', 'name': 'Boats'},
{'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'y': [19, 36, 12, 1, 35, 4, 6, …Run Code Online (Sandbox Code Playgroud)