Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Exception for callback while creating figure

$
0
0

Hi,

I’m trying to create a figure for path of some entity (car, plane, etc…).

This is my code:


app.layout = html.Div([
    # auto update every 60 msec
    dcc.Interval(id='graph-update', interval=5000),
    html.Div([
        html.Div([
            html.H3("Path", style={'text-align': 'center'}),
            dcc.Graph(id='Path', figure={})],
            className="six columns"),  # see https://codepen.io/chriddyp/pen/bWLwgP

        html.Div([
            html.H3("Bearing-Depression", style={'text-align': 'center'}),
            dcc.Graph(id='Bearing-Depression', figure={})],
            className="six columns"),
    ]),
])

@ app.callback([Output('Path', 'figure'),
               [Input('graph-update', 'n_intervals')])
def draw_path(n):
     db_connectoin = sqlite3.connect(config.DB_LOCATION)
	df = pd.read_sql('Select Lat Long rom all data', db_connection)
	
	
	fig = px.scatter_mapbox(df, lat="Lat", lon="Long")
	fig.update_layout(mapbox_style = "white-bg",
					mapbox_layers=[{
									"below": 'traces',
									"sourcetype": 'raster'
									"source": ["http://127.0.0.1:9000/static/tiles/{z}/{x}/{y}.png"],
					}]	
	)
	
	fig.update_scenes(aspectmode="cube")
	
	return fig

When there is a callback, I’m receiving an error as follows:

dash.exceptions.InvalidCallbackReturnValue: The callback …Path.figure… is a multi-output. Expected the output type to be a list or tuple but got Figure … Exception on /_dash-update-component [POST]

How to solve this issue?

Regards,
BMWE

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles