Update: version 1.16 has been released since this was posted.
Dash 1.1.0 is a minor release with features and bug fixes for dash, dash-table and dash-core-components.
Changelogs
Highlights
-
Update to Plotly.js 1.49.0
- New
indicator
trace type for gauge and KPI displays. - Lots of tile map improvements:
choroplethmapbox
anddensitymapbox
trace types, numerousstyle
options forscattermapbox
subplots that do not require a Mapbox access token, and more. Examples of the new maps:- Alternative base layers: Mapbox map layers in Python
densitymapbox
: Mapbox density heatmap in Pythonchoroplethmapbox
- GeoJSON choropleths: Mapbox choropleth maps in Python
- New
-
Clearable table columns
-
Hideable table columns
-
Export table content as CSV or XLSX
-
Option to copy over table headers on copy/paste operations outside the table’s browser tab
-
Fixed
fixed_columns
on Safari -
Greatly improved behavior for
dcc.Input
component withtype=number
Additional details
- Hidden table columns
- The
hideable
nested prop incolumns
makes thehide
action button visible in the header - A table can’t be made to have no column and will prevent hiding the last one
hidden_columns
contains the list of all the currently hidden columnshidden_columns
can be used programatically whether the action buttons are made visible or not
- The
Code examples
This table clears / deletes / hides columns:
import dash
from dash_table import DataTable, FormatTemplate
app = dash.Dash(__name__)
app.layout = DataTable(
columns=[{
'name': x,
'id': x,
'hideable': True,
'clearable': True,
'deletable': True
} for x in ['a', 'b', 'c', 'd']],
editable=True,
include_headers_on_copy_paste=True,
data=[{
'a': 'a' + str(x),
'b': 'b' + str(x) + str(x),
'c': 'c' + str(x) + 'c',
'd': 'd' + str(x) + '-' + str(x)
} for x in range(0,100)]
)
if __name__ == '__main__':
app.run_server(debug=True)
This table allows exporting the content of a filtered & sorted table:
import dash
from dash_table import DataTable, FormatTemplate
app = dash.Dash(__name__)
app.layout = DataTable(
columns=[{
'name': x,
'id': x
} for x in ['a', 'b', 'c', 'd']],
export_format='xlsx',
editable=True,
filter_action='native',
sort_action='native',
data=[{
'a': 'a' + str(x),
'b': 'b' + str(x) + str(x),
'c': 'c' + str(x) + 'c',
'd': 'd' + str(x) + '-' + str(x)
} for x in range(0,100)]
)
if __name__ == '__main__':
app.run_server(debug=True)
Using the dcc.Input with type=number
, the value in the callback is a number when valid, None when invalid:
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from dash import exceptions
app = dash.Dash(__name__)
app.layout = html.Div(
[
dcc.Input(
id='dfalse',
type='number',
debounce=False,
value=17,
min=0,
max=100,
step=0.1,
placeholder='debounce=>False',
),
html.Button(id='fbtn'),
html.Div(id='out_false', children=''),
html.Hr(id='bl'),
dcc.Input(
id='dtrue',
type='number',
debounce=True,
value=113,
min=0,
max=20000,
placeholder='debounce=>True',
),
html.Button(id='tbtn'),
html.Div(id='out_true', children=''),
]
)
@app.callback(
[Output('out_false', 'children'), Output('out_true', 'children')],
[Input('dfalse', 'value'), Input('dtrue', 'value')])
def render(fval, tval):
print(fval, tval)
return fval, tval
@app.callback(
Output('dtrue', 'value'),
[Input('tbtn', 'n_clicks')]
)
def tclick(n_clicks):
if n_clicks is None:
raise exceptions.PreventUpdate
return 5
@app.callback(
Output('dfalse', 'value'),
[Input('fbtn', 'n_clicks')]
)
def fclick(n_clicks):
if n_clicks is None:
raise exceptions.PreventUpdate
return 4
if __name__ == '__main__':
app.run_server(debug=True)