Dashboards.jl API
Dashboards.Dash — Typestruct Dash <: AnyRepresentation of Dash application
Dashboards.@callid_str — Macro@callid_str"Macro for crating Dash CallbackId. Parse string in form "[{State1[, ...]}] Input1[, ...] => Output1[, ...]"
#Examples
id1 = callid"{inputDiv.children} input.value => output1.value, output2.value"Dashboards.callback! — Functioncallback!(func::Function, app::Dash, id::CallbackId; pass_changed_props = false)Create a callback that updates the output by calling function func.
If pass_changed_props is true then the first argument of callback is an array of changed properties
Examples
app = Dash("Test") do
html_div() do
dcc_input(id="graphTitle", value="Let's Dance!", type = "text"),
dcc_input(id="graphTitle2", value="Let's Dance!", type = "text"),
html_div(id="outputID"),
html_div(id="outputID2")
end
end
callback!(app, CallbackId(
state = [(:graphTitle, :type)],
input = [(:graphTitle, :value)],
output = [(:outputID, :children), (:outputID2, :children)]
)
) do stateType, inputValue
return (stateType * "..." * inputValue, inputValue)
endYou can use macro callid string macro for make CallbackId :
callback!(app, callid"{graphTitle.type} graphTitle.value => outputID.children, outputID2.children") do stateType, inputValue
return (stateType * "..." * inputValue, inputValue)
endUsing changed_props
callback!(app, callid"graphTitle.value, graphTitle2.value => outputID.children", pass_changed_props = true) do changed, input1, input2
if "graphTitle.value" in changed
return input1
else
return input2
end
endDashboards.make_handler — Functionmake_handler(app::Dash; debug = false)Make handler for routing Dash application in HTTP package
#Arguments
app::Dash- Dash applicationdebug::Bool = false- Enable/disable all the dev tools
#Examples
julia> app = Dash("Test") do
html_div() do
html_h1("Test Dashboard")
end
end
julia> handler = make_handler(app)
julia> HTTP.serve(handler, HTTP.Sockets.localhost, 8080)