def update_output(value): mapUpdate = [] setDate(value) ctg = [ "{}+".format(mark, marks[i + 1]) for i, mark in enumerate(marks[:-1]) ] + ["{}+".format(marks[-1])] colorbar = dlx.categorical_colorbar( categories=["0+", "5+", "10+", "15+", "20+", "25+", "30+", "35+"], colorscale=colorscale, width=300, height=30, position="bottomleft") options = dict(hoverStyle=dict(weight=5, color='#666', dashArray=''), zoomToBoundsOnClick=True) geojson = dlx.geojson(data, id="geojson", defaultOptions=options, style=get_style2) info = html.Div(children=get_info(), id="info", className="info", style={ "position": "absolute", "top": "10px", "right": "10px", "z-index": "1000", "background": "white" }) mapUpdate = [dl.TileLayer(), geojson, colorbar, info] return mapUpdate
def update_radio(input_value): if input_value != None: print("update_radio", input_value) def get_style(feature): color = [ colorscale[i] for i, item in enumerate(marks) if feature["properties"][input_value] > item ][-1] return dict(fillColor=color, weight=2, opacity=1, color='white', dashArray='3', fillOpacity=0.7) options = dict(hoverStyle=dict(weight=5, color='#666', dashArray=''), zoomToBoundsOnClick=True) geojson = dlx.geojson(data, id="geojson", defaultOptions=options, style=get_style) return html.Div([ dl.Map(children=[dl.TileLayer(), geojson], center=[51.51, -0.083], zoom=11) ], style={ 'width': '150%', 'height': '75vh' }, id="map")
] # Create colorbar. ctg = ["{}+".format(mark, marks[i + 1]) for i, mark in enumerate(marks[:-1])] + ["{}+".format(marks[-1])] colorbar = dlx.categorical_colorbar(categories=ctg, colorscale=colorscale, width=300, height=30, position="bottomleft") # Create geojson. options = dict(hoverStyle=dict(weight=5, color='#666', dashArray=''), zoomToBoundsOnClick=True) geojson = dlx.geojson(data, id="geojson", defaultOptions=options, style=get_style) # Create info control. info = html.Div(children=get_info(), id="info", className="info", style={ "position": "absolute", "top": "10px", "right": "10px", "z-index": "1000" }) infotwo = html.Div(children=get_info(), id="infotwo", className="info",