Open parallelepiped12 opened 8 months ago
Changing the colour of CircleMarker objects in a callback does not seem to work in 1.0.11, but it works correctly in 0.1.23. Minimal example:
from dash import Dash, html, callback, Output, Input import dash_leaflet as dl # Initialize the app app = Dash(__name__) # App layout app.layout = html.Div([ html.Div(children="Weird Behaviour"), html.Hr(), dl.Map(center=[0, 0], zoom=10, style={'height': '90vh'}, id='map'), html.Button('Break It!', id='break-button') ]) @callback( Output(component_id='map', component_property='children'), Input(component_id='break-button', component_property='n_clicks') ) def break_map(n_clicks): if n_clicks is None: map_components = [ dl.TileLayer(), dl.CircleMarker(radius=2, center=(0, 0), color='rgb(255, 0, 0)' ), dl.CircleMarker(radius=2, center=(0.1, 0), color='rgb(0, 255, 0)' ), dl.CircleMarker(radius=2, center=(0, 0.1), color='rgb(0, 0, 255)' ), ] else: map_components = [ dl.TileLayer(), dl.CircleMarker(radius=2, center=(0, 0), color='rgb(255, 0, 0)' ), dl.CircleMarker(radius=2, center=(0, 0.1), color='rgb(0, 0, 255)' ), ] return map_components # Run the app if __name__ == '__main__': app.run(debug=True)
The marker will have the same colour as the marker in the corresponding position in map_components initially.
I have the same problem.
Changing the colour of CircleMarker objects in a callback does not seem to work in 1.0.11, but it works correctly in 0.1.23. Minimal example:
The marker will have the same colour as the marker in the corresponding position in map_components initially.