Hi, will you be able to share how to generate the callbacks between parallel coordinates and table ? I want to do the same and struggle a little bit. Thanks, Matthieu
Hi, I tried but unfortunately by selecting on a parcoord axis, the callback is not activated. Is there a way for you to share with me an example ? Regards, Matthieu
Is it possible to use restyleData when we unselect the filter from parcoords axis?
I’ve tried any graph properties including restyleData, but it doesn’t trigger new output. The output still showing the last {dimension,constraintrange} we selected.
# Handle parallel coordinates constraintrange (restyleData)
elif triggered_id == 'parallel-coordinates-plot' and parallel_restyle_data:
constrained_df = df.copy() # Start with the full dataframe
# Track selections progressively by applying constraints from parallel coordinates plot
if parallel_restyle_data:
for item in parallel_restyle_data:
if isinstance(item, dict): # Ensure item is a dictionary
for key, value in item.items():
if 'constraintrange' in key:
# Extract dimension index and label
dimension_index = int(key.split('[')[1].split(']')[0])
dimension_label = explained_columns[dimension_index]
# Apply constraints
constrain_range = value
if isinstance(constrain_range[0], list):
mask = np.logical_or.reduce([constrained_df[dimension_label].between(r[0], r[1]) for r in constrain_range])
else:
mask = constrained_df[dimension_label].between(constrain_range[0], constrain_range[1])
constrained_df = constrained_df[mask]
# Get the unique countries that meet the new axis constraints
selected_countries_from_parallel = constrained_df['Country name'].unique().tolist()
# Intersect the newly selected countries with the previously selected countries
if selected_countries:
selected_countries = list(set(selected_countries).intersection(set(selected_countries_from_parallel)))
else:
selected_countries = selected_countries_from_parallel
# Print the selected countries for debugging
print(f"Selected countries from parallel coordinates plot: {selected_countries}")
# Filter based on updated selected countries
filtered_df = df[df['Country name'].isin(selected_countries)]
else:
filtered_df = df