Skip to content
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

Feature/plotly theming #6

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

Feature/plotly theming #6

wants to merge 32 commits into from

Conversation

GedionT
Copy link
Member

@GedionT GedionT commented Oct 14, 2024

Summary

This request mainly adds theming functionality for Plotly charts by adding a custom theme to Plotly and a prebuilt wrapper for a few plot types. A new integration page is also introduced to the demo application to showcase the new Plotly theme feature.

Furthermore, this request addresses the link animation on-hover effect (#4), visited URL style, and checkbox state issue (#5 (comment)).

New Features

  • Added a custom Plotly theme
  • Added UNDP-themed color schemes
  • An integration demo page to showcase Plotly charts with custom themes
  • Added an expander component in the text tab on the standard page

Bug Fixes

  • Fixed checkbox issue that used to automatically trigger checked state on mouse enter event
  • Fixed link animation effect on hover
  • Fixed visited link style from red to standard grey color

Checklist

  • I have read the contributing guidelines.
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the required dependencies to pyproject.toml and updated poetry.lock (if applicable).
  • I have updated the documentation (if applicable).
  • I have included any necessary screenshots or examples of the new functionality.

Screenshots / Examples

image

Additional Notes

None

@GedionT GedionT self-assigned this Oct 21, 2024
Copy link
Contributor

@mykolaskrynnyk mykolaskrynnyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the package scoped to Streamlit with plotly theming being a small extra, rather than trying to provide plotting-like functionality. We also don't need to store large dictionaries, these can go to data folder as JSONs. Some code parts can be significantly improved. See the comments elsewhere.

Copy link
Contributor

@mykolaskrynnyk mykolaskrynnyk Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overly verbose. Some of the keys in undp_colors are used only once (or not at all).

  • Write the configuration explicitly in the dictionary inside custom_template.layout.update (even if this requires repetition).
  • Remove undp_colours.
  • Move the template dictionary to data/ as a JSON file, them read it back here with utils.read_file.
  • Call the template "undp" instead of "undp_template".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed undp_colors from plotly_themes and placed it in data/ for reference although it is currently not used.

st_undp/plotly_components.py Outdated Show resolved Hide resolved
st_undp/main.scss Show resolved Hide resolved
st_undp/__init__.py Show resolved Hide resolved
pages/standard.py Show resolved Hide resolved
pages/integrations.py Outdated Show resolved Hide resolved
pages/custom.py Show resolved Hide resolved
app.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants