-
Notifications
You must be signed in to change notification settings - Fork 242
[Feat] Enable new dcc components from dash==4.0.0rc6
#1462
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
Draft
petar-qb
wants to merge
25
commits into
main
Choose a base branch
from
tidy/backend_for_v4_dd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3f4c494
Backend support for Dropdown in dash==4.0.0rc2 (without tests)
petar-qb 95a7dab
Remove dropdown.test.js
petar-qb af983cf
Minor
petar-qb bf14837
Merge branch 'main' into tidy/backend_for_v4_dd
huong-li-nguyen cdf2b19
[Tidy] Update styling of `dcc` components in `dash>=4` (#1489)
huong-li-nguyen eb2f092
Remove unit tests related to optionHeight and All logic (as removed)
huong-li-nguyen d3c9553
Delete js tests for sliders as functionality embedded by `dcc`
huong-li-nguyen 728825c
Merge branch 'main' into tidy/backend_for_v4_dd
huong-li-nguyen 9b7bb0c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] be080b4
Lint
huong-li-nguyen a3291e4
Turon on dots and simplify CSS
huong-li-nguyen ef5726b
Tidy
huong-li-nguyen e99a11f
Merge branch 'tidy/backend_for_v4_dd' of https://github.com/mckinsey/…
huong-li-nguyen fb5e2dd
Fix unit tests and linting
huong-li-nguyen a72c80e
Lint
huong-li-nguyen 003b0bf
Merge main with the feature branch
petar-qb 157641a
Update hatch.toml and pyproject.toml dependencies to dash==4.0.0rc5
petar-qb da132e1
Merge main into the feature branch
petar-qb ca867be
Upgrade to dash==4.0.0rc6
petar-qb b7f2af0
Revert type changes in Dropdown
petar-qb a55cf88
Add scratch with all selectors
petar-qb 6697df0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 4e37ec9
Merge branch 'main' into tidy/backend_for_v4_dd
huong-li-nguyen 3c56946
Fix dropdowns
huong-li-nguyen 9fe737d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,78 @@ | ||
| import vizro.plotly.express as px | ||
| import numpy as np | ||
| import pandas as pd | ||
| import vizro.models as vm | ||
| import vizro.plotly.express as px | ||
| from dash_ag_grid import AgGrid | ||
| from vizro import Vizro | ||
| from vizro.models.types import capture | ||
| from vizro.managers import data_manager | ||
|
|
||
| data_manager["static_df"] = px.data.iris() | ||
| data_manager["dynamic_df"] = lambda number_of_points=10: px.data.iris().head(number_of_points) | ||
|
|
||
|
|
||
| SPECIES_COLORS = {"setosa": "#00b4ff", "versicolor": "#ff9222", "virginica": "#3949ab"} | ||
|
|
||
| df = px.data.iris() | ||
|
|
||
| page_1 = vm.Page( | ||
| title="BUG theme switch doesn't work with Flex layout", | ||
| layout=vm.Flex(), | ||
| title="Single/Multi static DD", | ||
| components=[ | ||
| vm.Graph(figure=px.scatter(data_frame=df, x="sepal_width", y="sepal_length")), | ||
| vm.Graph(figure=px.scatter(data_frame=df.head(10), x="sepal_width", y="sepal_length")), | ||
| vm.Card(text="test"), | ||
| vm.Graph( | ||
| figure=px.scatter( | ||
| "static_df", x="sepal_width", y="sepal_length", color="species", color_discrete_map=SPECIES_COLORS | ||
| ) | ||
| ) | ||
| ], | ||
| controls=[ | ||
| vm.Filter(column="species", selector=vm.Dropdown(multi=True)), | ||
| vm.Filter(column="species", selector=vm.Dropdown(multi=False)), | ||
| ], | ||
| ) | ||
|
|
||
| dashboard = vm.Dashboard(pages=[page_1]) | ||
| page_2 = vm.Page( | ||
| title="Single/Multi dynamic DD", | ||
| components=[ | ||
| vm.Graph( | ||
| id="graph_2", | ||
| figure=px.scatter( | ||
| "dynamic_df", x="sepal_width", y="sepal_length", color="species", color_discrete_map=SPECIES_COLORS | ||
| ), | ||
| ) | ||
| ], | ||
| controls=[ | ||
| # TODO-REVIEWER: To a bug with the standard _build_dynamic_placeholder: | ||
| # 1. Replace vm.Dropdown._build_dynamic_placeholder with vm.Checklist._build_dynamic_placeholder implementation | ||
| # 2. Run the app and open page_2 | ||
| # 3. Select values ["setosa", "versicolor"] in the multi Dropdown, and "versicolor" in the single Dropdown | ||
| # 4. Refresh the page. | ||
| vm.Filter(column="species", selector=vm.Dropdown(multi=True)), | ||
| vm.Filter(column="species", selector=vm.Dropdown(multi=False)), | ||
| vm.Parameter( | ||
| targets=["graph_2.data_frame.number_of_points"], selector=vm.Slider(min=10, max=150, step=10, value=10) | ||
| ), | ||
| ], | ||
| ) | ||
|
|
||
|
|
||
| long_df = pd.DataFrame( | ||
| { | ||
| # TODO-UI: By setting max width of the Dropdown seems like option height is automatically adjusted. | ||
| "long_string": [ | ||
| # List of 100 strings with variable number (1 -> 101) of characters "A"(95%) or space " "(5%). | ||
| "Value " + "".join(" " if np.random.rand() < 0.05 else "A" for _ in range(length)) | ||
| for length in range(1, 101) | ||
| ], | ||
| "x": range(1, 101), | ||
| "y": range(101, 201), | ||
| } | ||
| ) | ||
|
|
||
| page_3 = vm.Page( | ||
| title="Long values in Dropdown", | ||
| components=[vm.Graph(figure=px.scatter(long_df, x="x", y="y"))], | ||
| controls=[vm.Filter(column="long_string")], | ||
| ) | ||
|
|
||
| dashboard = vm.Dashboard(pages=[page_1, page_2, page_3]) | ||
| if __name__ == "__main__": | ||
| Vizro().build(dashboard).run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.