MHong94
September 3, 2021, 12:38am
1
I have a very large choropleth plot similar to something like this but with custom coordinates
I want to plot additional data through scattergeo at 1 second interval on top of the choropleth base. The scattergeo plots fine on its own, but because the choropleth plot takes over 1 second to plot, the entire graph breaks. Is there a way to “preplot” the choropleth data where I don’t replot every time? I do not need to interact with the choropleth in any way.
Emil
September 3, 2021, 6:07am
2
In dash-leaflet you can use different layers (objects) and then just update each layer (object) independently. Maybe the same principle can be used here?
MHong94
September 3, 2021, 4:05pm
3
It could, I don’t think there is a built in functionality for it. The closest I could find is something like this but there was no solution
Hi,
I have a graph with a lot of data, then I add three horizontal lines to view a kind of threshold which can be adjusted by changing the input value of an input box.
The graph itself looks like on the attached picture [Timeline]
When I update to the input value to adjust the thresholds(which is just a line between two datasets), the whole graph have to be updated which takes a couple of seconds.
Is it possible to only update the three lines so the rest of the data stays unchanged and doesn…
Emil
September 4, 2021, 11:47am
4
Here is a small example on how you can do it in Dash leaflet,
import dash_html_components as html
import dash_core_components as dcc
import dash_leaflet as dl
from dash import Dash
from dash.dependencies import Output, Input
app = Dash(update_title=None)
app.layout = html.Div([
dl.Map(center=[39, -98], zoom=4, children=[
dl.TileLayer(),
dl.Marker(id="marker", position=[25, -100]),
dl.GeoJSON(url="/assets/us-states.pbf", format="geobuf")
], style={'width': '100%', 'height': '50vh', 'margin': "auto", "display": "block"}, id="map"),
dcc.Interval(id="trigger", interval=25)
])
# Use a callback to move the marker.
app.clientside_callback("function(i){return [25+i*0.2%25, -100];}", Output("marker", "position"),
Input("trigger", "n_intervals"), prevent_initial_call=True)
if __name__ == '__main__':
app.run_server()
1 Like