Dash.jl
Dash.jl copied to clipboard
Write (python) dash vs Dash.jl feature comparison table
and put it in the Dash.jl README.md somewhere?
Resources:
- python dash changelog: https://github.com/plotly/dash/blob/dev/CHANGELOG.md
- Dash.jl assets: https://github.com/plotly/DashCoreResources
Tentative list
Things that are missing from Dash.jl since before Dash.jl v1 (and dash v1.15.0)
taken from the TODO items in https://github.com/plotly/Dash.jl/projects/1
- User-defined routes https://github.com/plotly/Dash.jl/issues/35
- Debug logging https://github.com/plotly/Dash.jl/issues/13
Things that are missing from Dash.jl from dash v1.x
- from dash v1.16.0,
app.csp_hashes() - from dash v1.19.0 input-output callbacks
- from dash v1.20.0
app(; extra_hot_reload_paths=#= =#)
Things that are missing from Dash.jl since dash v2
note the dash v2 was released on 2021-08-03 :upside_down_face:
- background (fka long) callbacks
- native pages
- make
app(; compress=false)by default - options / value positional arguments for dash core components https://dash.plotly.com/flexible-callback-signatures
- components as arguments for
Input,StateandOutput - helpers
get_relative_path,strip_relative_path,get_asset_url - improved callback context
- dash
Patch allow_duplicateto Output argumentsdash(; include_pages_meta=true)
Things that maybe just work using resources from dash >= v2.10.2
Dash.jl resources were updated in https://github.com/plotly/Dash.jl/pull/212 after an 18+ month hiatus. The update resources are set to be released as part of the upcoming Dash.jl v1.3.0.
TODO, check if
- [x]
dcc_geolocation - [x] Promise in clientside callbacks
- [x] Mathjax in
dcc_markdownanddcc_graph - [x] Component as props - update: does not work, more info below :x:
- [x]
dcc_dropdownsearch prop andmaxHeight - [x] new prop
disable_n_clicks - [x]
dcc_locationrefresh="callback-nav"- update: does not work, more info below :x:
work in Dash.jl.
Update
dcc_geolocationjust works :heavy_check_mark: :tada: :champagne:
Tested with https://dash.plotly.com/dash-core-components/geolocation translated in Julia as:
see Julia snippet
using Dash
app = dash()
app.layout = html_div() do
html_button("Update Position"; id = "update_btn"),
dcc_geolocation(; id = "geolocation"),
html_div(; id="text_position")
end
callback!(app,
Output("geolocation", "update_now"),
Input("update_btn", "n_clicks")) do click
return !isnothing(click) && (click > 1)
end
callback!(app,
Output("text_position", "children"),
Input("geolocation", "local_date"),
Input("geolocation", "position")) do date, pos
isnothing(pos) && return "No position data available"
return html_p("As of $date your location was:
lat $(pos.lat), lon $(pos.lon), accuracy $(pos.accuracy) meters")
end
run_server(app, "0.0.0.0", 8080)
Update
dcc_locationrefresh="callback-nav"
does not work :x:
Translating this "callback-nav" test
see Julia snippet
using Dash
app = dash()
app.layout = html_div() do
dcc_location(; id = "url", refresh = false),
dcc_location(; id = "callback-url", refresh = "callback-nav"),
html_button("click"; id = "callback-btn", n_clicks=0),
html_div(; id = "content")
end
callback!(app,
Output("content", "children"),
Input("url", "pathname")) do pathname
return if isnothing(pathname) || pathname == "/page-1"
html_div("1"; id = "div1")
elseif pathname == "/"
html_div("base", id = "div0")
else
"404"
end
end
callback!(app,
Output("callback-url", "pathname"),
Input("callback-btn", "n_clicks")) do n
return if n > 0
"/page-1"
else
no_update()
end
end
run_server(app)
gives
Screencast from 2023-07-11 11-32-18.webm
where the app hangs after pressing the back button.
Update
Component as props does not work :x:
using Dash
app = dash()
app.layout = html_div() do
dcc_checklist(; id="checklist",
options=[(label=html_h2("H2 label"), value="h2"),
(label="plain label", value="plain")])
end
run_server(app, "0.0.0.0", 8080; debug=true)
lead to