使用回调更新Dash Plotly Table会绘制图形而不是表格

时间:2019-10-08 17:16:44

标签: python plotly plotly-dash plotly-python

  • 请看下面的代码
  • 它绘制一个xy图形而不是破折号上的表格
  • 我尝试更改参数,但不确定这里出了什么问题
  • 人们尝试了不更新时间间隔,并且似乎可以正常工作
import dash_html_components as html
import plotly.graph_objs as go
import dash
import sys

from dash.dependencies import Output, Input

from collections import deque 

import dash_table_experiments as dtable
import dash_table 


app = dash.Dash()


app.layout = html.Div([

    dcc.Interval(id='graph-update', interval=1*500),
    dcc.Graph(id='visitors1',figure = go.Figure(data = [trace]))
])




@app.callback(Output('visitors1', 'figure'), [Input('graph-update', 'n_intervals')]) 
def cope_some(n):
    trace=[go.Table(type = 'table',
        columnorder = [1,2,3],
        columnwidth=[10,30,5],
        header=dict(values=['A Scores', 'B Scores', 'C Scores']),
        cells=dict(values=[[100, 90, 80, 90],[95, 85, 75, 95],[95, 85, 75, 95]]))]
    layout = go.Layout(title=f"Entry Draft", height=600)

    return {'data': [trace],"layout": layout}


app.run_server(debug=False, port=8050)```

0 个答案:

没有答案