I am looking into writing a Dash wrapper layer for the react leaflet GeoJSON component. Some of its properties, e.g. style
, are of the type Function
. Is there a recommended approach to set such properties from Dash?
I guess the only option is to evaluate the functions in the Python layer prior to the construction of the GeoJSON object. I can then pass the resulting values as a non-functional property, e.g. a dict of <feature_id, function_value>, from which the functions can be created in the javascript layer. Do you agree @chriddyp, @alexcjohnson?
Yeah that’s it exactly. Another guide to check out is our D3 + React + Dash documentation (Integrating D3.js into Dash Components | Dash for Python Documentation | Plotly). In these examples, there might be D3 functions, but at the top-level is a declarative description of what you’d like displayed.
2 Likes