We’re pleased to announce that Dash 1.19.0 is out
pip install dash==1.19.0
Dash 1.19.0 is backwards compatible feature release that:
- Adds support for circular callbacks that within the same callback. Thanks to
@chadaeschliman
for the contribution! - Adds a
drag_value
property todcc.Slider
to fire callbacks from dragging and releasing. - Adds a much needed close button to close the Dash Dev Tools. Many thanks to @AnnMarieW for the contribution
- Upgrades plotly.js, the graphing library behind
dcc.Graph
from1.58.2
to1.58.4
. - Dedents error messages more carefully.
- Various other bug fixes.
Circular Callbacks
This section is adapted from the Dash circular callback examples in the documentation.
These circular updates work within the same callback. Circular callback chains that involve multiple callbacks are not supported. Circular callbacks can be used to keep multiple inputs synchronized with each other.
Common examples include:
Synchronizing a Slider with an Input
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(
[
dcc.Slider(
id="slider", min=0, max=20,
marks={i: str(i) for i in range(21)},
value=3
),
dcc.Input(
id="input", type="number", min=0, max=20, value=3
),
]
)
@app.callback(
Output("input", "value"),
Output("slider", "value"),
Input("input", "value"),
Input("slider", "value"),
)
def callback(input_value, slider_value):
ctx = dash.callback_context
trigger_id = ctx.triggered[0]["prop_id"].split(".")[0]
value = input_value if trigger_id == "input" else slider_value
return value, value
app.run_server(debug=True)
Synchronizing Two Inputs with Different Units (Unit Conversion)
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
html.Div('Convert Temperature'),
'Celsius',
dcc.Input(
id="celsius",
value=0.0,
type="number"
),
' = Fahrenheit',
dcc.Input(
id="fahrenheit",
value=32.0,
type="number",
),
])
@app.callback(
Output("celsius", "value"),
Output("fahrenheit", "value"),
Input("celsius", "value"),
Input("fahrenheit", "value"),
)
def sync_input(celsius, fahrenheit):
ctx = dash.callback_context
input_id = ctx.triggered[0]["prop_id"].split(".")[0]
if input_id == "celsius":
fahrenheit= None if celsius is None else (float(celsius) * 9/5) + 32
else:
celsius = None if fahrenheit is None else (float(fahrenheit) - 32) * 5/9
return celsius, fahrenheit
if __name__ == "__main__":
app.run_server(debug=True)
Synchronizing Two Checklists Together
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
options = [
{"label": "New York City", "value": "NYC"},
{"label": "Montréal", "value": "MTL"},
{"label": "San Francisco", "value": "SF"},
]
all_cities = [option["value"] for option in options]
app.layout = html.Div(
[
dcc.Checklist(
id="all-checklist",
options=[{"label": "All", "value": "All"}],
value=[],
labelStyle={"display": "inline-block"},
),
dcc.Checklist(
id="city-checklist",
options=options,
value=[],
labelStyle={"display": "inline-block"},
),
]
)
@app.callback(
Output("city-checklist", "value"),
Output("all-checklist", "value"),
Input("city-checklist", "value"),
Input("all-checklist", "value"),
)
def sync_checklists(cities_selected, all_selected):
ctx = dash.callback_context
input_id = ctx.triggered[0]["prop_id"].split(".")[0]
if input_id == "city-checklist":
all_selected = ["All"] if set(cities_selected) == set(all_cities) else []
else:
cities_selected = all_cities if all_selected else []
return cities_selected, all_selected
if __name__ == "__main__":
app.run_server(debug=True)
Previous Releases
Dash 1.18.1 Release - Faceted and Animated Images and Heatmaps, DataTable Bootstrap Support, Inside Tick Labels, Better Axis Type Detection
Dash 1.17.0 Released - DataTable Header Tooltips, dcc.Graph Subplot images, shapes, and annotations, and several bug fixes
Dash 1.16.3 Released - Fixes Performance Degradation from Flask-Compress Dependency
Dash 1.16.2 Released - Devtools & Callbacks Bug Fixes
Dash 1.16.1 Released - dcc.Graph prependData & Bug Fixes
Dash 1.16.0 - Brand New Debugging & Performance Tools, Improved Callback Graph, Date-Axis & Timeline Improvements, Faster Images, Content Security Policy, and Community Contributions
Dash v1.15.0 Released - Julia Components, Simplified Callback Syntax, Fixed Table Tooltips and Copy & Paste, fixed dcc.Loading styling
Dash v1.14.0 Released - Update the Tab’s Title, Removing the “Updating…” Messages, Updated DataTable Link Behavior
Dash v1.13.4 Release: Fixes regression with loading states from callbacks with multiple outputs
Dash v1.13.3 Release: Improved performance, clientside callback_context, many dcc.Graph & DataTable bug fixes
Dash v1.12.0 Release - Pattern-Matching Callbacks Fixes, Shape-drawing, new DataTable conditional formatting options, prevent_initial_call, and more
Dash v1.11.0 Release - Introducing Pattern-Matching Callbacks
Dash v1.10.0 Release - New dcc.Graph features, updated dcc.Link, React upgrade and bug fixes
Dash v1.9.0 release - Bug fixes
Dash v1.8.0 release - dcc.Graph updates, markdown & link support in DataTable, and more
Dash v1.7.0 released - Async component fixes, inline clientside callbacks, and bug fixes
Dash 1.6.0 released - dcc.Graph updates, async performance improvements, improved caching