Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.

License

NotificationsYou must be signed in to change notification settings

plotly/Dash.jl

Juila testsCircleCIGitHubGitHub commit activity

Maintained by the Plotly Community

Create beautiful, analytic applications in Julia

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.

Other resources

Project Status

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!

Installation

To install the most recently released version:

pkg> add Dash

To install the latest (stable) development version instead:

pkg> add Dash#dev

Usage

Basic application

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!

Basic Callback

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 thecallback! function.
  • Outputs and inputs (and states, see below) of callback can beOutput,Input,State objects 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.

States and Multiple Outputs

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)

Comparison with original Python syntax

Component naming

  • Python:
importdashdash.html.Divdash.dcc.Graphdash.dash_table.DataTable
  • Dash.jl:
using Dashhtml_divdcc_graphdash_datatable

Component creation

Just 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

Application and layout

  • 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

Callbacks

  • 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

JSON

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 arrays
  • Dicts 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

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    Languages


    [8]ページ先頭

    ©2009-2025 Movatter.jp