Description
The vals property is not updated when accessed through a callback (unlike other properties such as cols and rows).
This would be really useful to maintain state between updates to the data of the pivot table. Currently, vals always has the original value.
Steps/Code to Reproduce
Run the following code and change the quantity being plotted from "Total Bill" to "Tips". The output vals quantity will not change and will continue to report "Total Bill".
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_pivottable
from data import data
app = dash.Dash(__name__)
app.title = 'My Dash example'
app.layout = html.Div([
dash_pivottable.PivotTable(
id='table',
data=data,
cols=['Day of Week'],
colOrder="key_a_to_z",
rows=['Party Size'],
rowOrder="key_a_to_z",
rendererName="Grouped Column Chart",
aggregatorName="Average",
vals=["Total Bill"],
valueFilter={'Day of Week': {'Thursday': False}}
),
html.Div(
id='output'
)
])
@app.callback(Output('output', 'children'),
[Input('table', 'cols'),
Input('table', 'rows'),
Input('table', 'rowOrder'),
Input('table', 'colOrder'),
Input('table', 'aggregatorName'),
Input('table', 'rendererName'),
Input('table', 'vals')])
def display_props(cols, rows, row_order, col_order, aggregator, renderer, vals):
return [
html.P(str(cols), id='columns'),
html.P(str(rows), id='rows'),
html.P(str(row_order), id='row_order'),
html.P(str(col_order), id='col_order'),
html.P(str(aggregator), id='aggregator'),
html.P(str(renderer), id='renderer'),
html.P(str(vals), id='vals'),
]
if __name__ == '__main__':
app.run_server(debug=True)
Versions
Dash 1.19.0
Dash Core Components 1.1.2
Dash HTML Components 1.15.0
Dash Renderer 1.9.0
Dash Pivot Table 0.0.2
Description
The
valsproperty is not updated when accessed through a callback (unlike other properties such ascolsandrows).This would be really useful to maintain state between updates to the data of the pivot table. Currently,
valsalways has the original value.Steps/Code to Reproduce
Run the following code and change the quantity being plotted from "Total Bill" to "Tips". The output
valsquantity will not change and will continue to report "Total Bill".Versions
Dash 1.19.0
Dash Core Components 1.1.2
Dash HTML Components 1.15.0
Dash Renderer 1.9.0
Dash Pivot Table 0.0.2