我是Dash的新手,我必须构建一个Web应用程序,在其中打印一些从麦克风和加速度计读取的数据。
现在,我试图了解如何设置各种图形和信息。我正在遵循Dash用户指南中给出的示例。
错误发生在第23行,这是我设置数据和布局的行。看来他不喜欢],但说实话我不知道该如何解决。
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={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name':
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name':
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
为什么会出现这种错误?
P.s .:用户指南(第一个示例)-> https://dash.plot.ly/getting-started
答案 0 :(得分:1)
尝试一下:
<TouchableNativeFeedback background={TouchableNativeFeedback.SelectableBackground()} delayPressIn={0}>
</TouchableNativeFeedback>
输出
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={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name':'a'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name':'b'}
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)