Sure. Here is what I’m doing.
I use restyleData
as input to the callback function. Something like this
@app.callback(Output('parallel-coord-graph', 'figure'),
[Input('par-coord-dropdown', 'value'),
Input('parallel-coord-graph', 'restyleData')],
[State('parallel-coord-graph', 'figure'),
State('metric-range', 'children')])
def update_par_coord_graph(dropdown_input, restyledata, par_coord_data,
metric_info):
par_coord_data = par_coord_data['data'][0]
curr_dims = par_coord_data.get('dimensions', None)
# Relevant restyleData Code
# Update the constraint ranges for the new restyled dimension
# Format of resytledata: [{'dimension[0].constraintrange': [0,1]}]
if restyledata:
for key, val in restyledata[0].items():
dim = int(re.split(r'\[|\]', key)[1])
updated_constraints[dropdown_input[dim]] = val[0]
Note the format of restyledata which is a dict.
To update the table, I use figure attribute to extract the state of the parallel coordinate chart. Something like this -
@app.callback(Output('table', 'children'),
[Input('parallel-coord-graph', 'figure')])
def test_me(par_coord_data):
par_coord_data = par_coord_data['data'][0]
curr_dims = par_coord_data.get('dimensions', None)
Hope this helps!
Lakshay