Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork42
Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.
License
plotly/Dash.jl
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Built on top of Plotly.js, React and HTTP.jl,Dash ties modern UI elements like dropdowns, sliders, and graphs directly to your analytical Julia code.
Just getting started? Check out theDash for Julia User Guide! If you can't find documentation there, then check out the unofficialcontributed examples or check out source code fromdemo applications in Python and then reference the Julia syntax style.
- https://community.plotly.com/c/plotly-r-matlab-julia-net/julia/23
- https://discourse.julialang.org/tag/dash
Julia components can be generated in tandem with Python and R components. Interested in getting involved with the project? Sponsorship is a great way to accelerate the progress of open source projects like this one; please feel free toreach out to us!
To install the most recently released version:
pkg> add DashTo install the latest (stable) development version instead:
pkg> add Dash#dev
using Dashapp=dash(external_stylesheets= ["https://codepen.io/chriddyp/pen/bWLwgP.css"])app.layout=html_div()dohtml_h1("Hello Dash"),html_div("Dash.jl: Julia interface for Dash"),dcc_graph(id="example-graph", figure= ( data= [ (x= [1,2,3], y= [4,1,2], type="bar", name="SF"), (x= [1,2,3], y= [2,4,5], type="bar", name="Montréal"), ], layout= (title="Dash Data Visualization",) ))endrun_server(app)
then go tohttp://127.0.0.1:8050 in your browser to view the Dash app!
using Dashapp=dash(external_stylesheets= ["https://codepen.io/chriddyp/pen/bWLwgP.css"])app.layout=html_div()dodcc_input(id="my-id", value="initial value", type="text"),html_div(id="my-div")endcallback!(app,Output("my-div","children"),Input("my-id","value"))do input_value"You've entered$(input_value)"endrun_server(app)
- You can make your Dash app interactive by registering callbacks with the
callback!function. - Outputs and inputs (and states, see below) of callback can be
Output,Input,Stateobjects or splats / vectors of this objects. - Callback functions must have the signature
(inputs..., states...), and provide a return value with the same number elements as the number ofOutputs to update.
using Dashapp=dash(external_stylesheets= ["https://codepen.io/chriddyp/pen/bWLwgP.css"])app.layout=html_div()dodcc_input(id="my-id", value="initial value", type="text"),html_div(id="my-div"),html_div(id="my-div2")endcallback!(app,Output("my-div","children"),Output("my-div2","children"),Input("my-id","value"),State("my-id","type"))do input_value, state_valuereturn ("You've entered$(input_value) in input with type$(state_value)","You've entered$(input_value)")endrun_server(app)
- Python:
importdashdash.html.Divdash.dcc.Graphdash.dash_table.DataTable
- Dash.jl:
using Dashhtml_divdcc_graphdash_datatableJust as in Python, functions for declaring components have keyword arguments, which are the same as in Python.html_div(id = "my-id", children = "Simple text").
For components which declarechildren, two additional signatures are available:
(children; kwargs..)and(children_maker::Function; kwargs...)
So one can writehtml_div("Simple text", id = "my-id") for simple elements, or choose an abbreviated syntax withdo syntax for complex elements:
html_div(id="outer-div")dohtml_h1("Welcome"),html_div(id="inner-div")do#= inner content=#endend
- Python:
app=dash.Dash(external_stylesheets=["https://codepen.io/chriddyp/pen/bWLwgP.css"])app.layout=html.Div(children=[....])
- Dash.jl:
app=dash(external_stylesheets= ["https://codepen.io/chriddyp/pen/bWLwgP.css"])app.layout=html_div()do#= inner content=#end
- Python:
@app.callback(Output('output','children'),Input('submit-button','n_clicks')],State('state-1','value'),State('state-2','value'))defupdate_output(n_clicks,state1,state2):# logic
- Dash.jl:
callback!(app,Output("output","children"),Input("submit-button","n_clicks")],State("state-1","value"),State("state-2","value"))do n_clicks, state1, state2# logicend
Dash apps transfer data between the browser (aka the frontend) and the Julia process running the app (aka the backend) in JSON.Dash.jl usesJSON3.jl for JSON serialization/deserialization.
Note that JSON3.jl converts
Vectors andTuples to JSON arraysDicts andNamedTuples to JSON objects
About
Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
