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
Scatter chart #7164
Scatter chart #7164
Conversation
…ting the orig DF.
…ill land in another PR.
# through trial-and-error I found this value to be a good enough middle ground. | ||
# See e2e/scripts/st_arrow_scatter_chart.py for some alignment tests. | ||
COLOR_LEGEND_SETTINGS = dict(titlePadding=5, offset=5, orient="bottom") | ||
SIZE_LEGEND_SETTINGS = dict(titlePadding=0.5, offset=5, orient="bottom") |
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.
I think same here.
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.
I moved all I could to CustomTheme.tsx, but I need to leave the titlePadding here in Python because there's no way to set a different value for one encoding (i.e. color
) vs another encoding (size
).
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.
Actually, I just realized that by moving this we broke some existing behavior.
When you create an Altair/Vega chart by hand, we used to (1) apply Streamlit colors, but (2) NOT move the legend to the bottom. With this change, we now DO move the legend to the bottom.
I need to double-check whether #2
was the desired behavior or just a bug.
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.
I don't think there's anything glaring about this PR so I'm going to give approval. However, please fix all of the comments please :)
QA request filed! |
FWIW re: Python test failures: |
* Add color support to charts, and refactor things a bit. * Fix tests and types. * Fix types in type_util * Removin unnecessary DF cloning, and add test to ensure we're not mutating the orig DF. * Fix tests in latest Pandas and Arrow. * Revert st_arrow_add_rows test to avoid too many changes in this PR. Will land in another PR. * Remove snaps that should be regenerated. * Don't show labels when no x or y specified (to match existing behavior). * Update snapshots (need to regenerate) * Fix bug where x axis was sometimes quantitative rather than temporal. * Implement st.scatter_chart * Fix x enc when no x_column. * Add more scatter tests * Fix tests. * Revert to melting data by hand since Snowflake doesn't include Altair 4.2 * Improve error messages. * Fix MyPy types * Update snapshots * Fix empty check * Revert setup.py * Remove dead code. * simple rename * Remove more dead code * Address comments. * Address comments. * Updating screenshot * Fix snapshots * Fix stupid copy/paste bug >_< * Fix stupid copy/paste bug >_< * Fix merge issues * Add snapshots * Small cleanup. Always use str() around dataset ids. Should be a no-op since JSON stringifies keys anyways, but this is cleaner. * Fix doc bug. * REALLY fix the doc bug * Improve docstrings * Address comments. Move legend settings to CustomTheme.tsx * Rename test images. * Address comments. Fixed test. * Undo move of legend config to CustomTheme.tsx as it broke existing behavior. * Fix tests * Fix legend test.
* Add color support to charts, and refactor things a bit. * Fix tests and types. * Fix types in type_util * Removin unnecessary DF cloning, and add test to ensure we're not mutating the orig DF. * Fix tests in latest Pandas and Arrow. * Revert st_arrow_add_rows test to avoid too many changes in this PR. Will land in another PR. * Remove snaps that should be regenerated. * Don't show labels when no x or y specified (to match existing behavior). * Update snapshots (need to regenerate) * Fix bug where x axis was sometimes quantitative rather than temporal. * Implement st.scatter_chart * Fix x enc when no x_column. * Add more scatter tests * Fix tests. * Revert to melting data by hand since Snowflake doesn't include Altair 4.2 * Improve error messages. * Fix MyPy types * Update snapshots * Fix empty check * Revert setup.py * Remove dead code. * simple rename * Remove more dead code * Address comments. * Address comments. * Updating screenshot * Fix snapshots * Fix stupid copy/paste bug >_< * Fix stupid copy/paste bug >_< * Fix merge issues * Add snapshots * Small cleanup. Always use str() around dataset ids. Should be a no-op since JSON stringifies keys anyways, but this is cleaner. * Fix doc bug. * REALLY fix the doc bug * Improve docstrings * Address comments. Move legend settings to CustomTheme.tsx * Rename test images. * Address comments. Fixed test. * Undo move of legend config to CustomTheme.tsx as it broke existing behavior. * Fix tests * Fix legend test.
* Add color support to charts, and refactor things a bit. * Fix tests and types. * Fix types in type_util * Removin unnecessary DF cloning, and add test to ensure we're not mutating the orig DF. * Fix tests in latest Pandas and Arrow. * Revert st_arrow_add_rows test to avoid too many changes in this PR. Will land in another PR. * Remove snaps that should be regenerated. * Don't show labels when no x or y specified (to match existing behavior). * Update snapshots (need to regenerate) * Fix bug where x axis was sometimes quantitative rather than temporal. * Implement st.scatter_chart * Fix x enc when no x_column. * Add more scatter tests * Fix tests. * Revert to melting data by hand since Snowflake doesn't include Altair 4.2 * Improve error messages. * Fix MyPy types * Update snapshots * Fix empty check * Revert setup.py * Remove dead code. * simple rename * Remove more dead code * Address comments. * Address comments. * Updating screenshot * Fix snapshots * Fix stupid copy/paste bug >_< * Fix stupid copy/paste bug >_< * Fix merge issues * Add snapshots * Small cleanup. Always use str() around dataset ids. Should be a no-op since JSON stringifies keys anyways, but this is cleaner. * Fix doc bug. * REALLY fix the doc bug * Improve docstrings * Address comments. Move legend settings to CustomTheme.tsx * Rename test images. * Address comments. Fixed test. * Undo move of legend config to CustomTheme.tsx as it broke existing behavior. * Fix tests * Fix legend test.
Describe your changes
Add support for st.scatter_chart!
This is PR 4 in the work to:
(PR 1 was a no-op that added the color_util.py library, which is used in this and the next PRs)
GitHub Issue Link (if applicable)
Testing Plan
N/A - Explanation of why no additional tests are needed
✅ Unit Tests (JS and/or Python)
✅ E2E Tests
Any manual testing needed?
Yes. I'll request this from the QA team soon.
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.