-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/dynamic filter #879
base: main
Are you sure you want to change the base?
Feat/dynamic filter #879
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…h minimal loading - tests pass
…ter.pre_build - tests pass
for more information, see https://pre-commit.ci
# Conflicts: # vizro-core/src/vizro/models/_controls/filter.py
…_manager to the Filter.pre_build data_manager _multi_load
View the example dashboards of the current commit live on PyCafe ☕ 🚀Updated on: 2024-11-15 13:53:42 UTC Link: vizro-core/examples/dev/ Link: vizro-core/examples/scratch_dev |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
# Choose from 0-50 | ||
setosa: 5 | ||
versicolor: 10 | ||
virginica: 15 | ||
|
||
# Choose from: 4.8 to 7.4 | ||
min: 5 | ||
max: 7 | ||
|
||
# Choose from: | ||
# 2020-01-01 to 2020-05-29 | ||
date_min: 2024-01-01 | ||
date_max: 2024-05-29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusting these values, the input data is changed for the scratch/app.py
example.
control_targets = [] | ||
control_targets_targets = [] | ||
figure_targets = [] | ||
for target in targets: | ||
target_obj = model_manager[target] | ||
if isinstance(target_obj, Filter): | ||
control_targets.append(target) | ||
control_targets_targets.extend(target_obj.targets) | ||
else: | ||
figure_targets.append(target) | ||
|
||
# Retrieving only figure_targets data_frames from _multi_load is not the best solution. | ||
# In that way, we assume that Filter.targets are the subset of the action's targets. This works for the | ||
# on_page_load, but will not work if targets are explicitly set. | ||
# For example, in future, if Parameter is targeting only a single Filter. | ||
_get_unfiltered_data_targets = list(set(figure_targets + control_targets_targets)) | ||
|
||
figure_targets_unfiltered_data: dict[ModelID, pd.DataFrame] = _get_unfiltered_data( | ||
ctds_parameter=ctds_parameter, targets=_get_unfiltered_data_targets | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this code can be removed. It's here only to support future cases like when the dynamic Filter is the Parameter direct target.
@@ -22,9 +22,15 @@ def _on_page_load(targets: list[ModelID], **inputs: dict[str, Any]) -> dict[Mode | |||
Dict mapping target chart ids to modified figures e.g. {'my_scatter': Figure({})} | |||
""" | |||
return _get_modified_page_figures( | |||
print("\nON PAGE LOAD - START") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder to myself to remove all print
statements before merge.
… into feat/dynamic-filter
Description
Screenshot
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":