-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #789 from gemini-hlsw/enhancement/set-plotly-theme
Enhancement: Extend settings to set default plotly theme.
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,5 +1,18 @@ | ||
from django.apps import AppConfig | ||
from django.conf import settings | ||
import plotly.io as pio | ||
|
||
|
||
class TomCommonConfig(AppConfig): | ||
name = 'tom_common' | ||
|
||
def ready(self): | ||
# Set default plotly theme on startup | ||
valid_themes = ['plotly', 'plotly_white', 'plotly_dark', 'ggplot2', 'seaborn', 'simple_white', 'none'] | ||
|
||
# Get the theme from settings, default to "plotly_white". | ||
plotly_theme = getattr(settings, 'PLOTLY_THEME', 'plotly_white') | ||
if plotly_theme not in valid_themes: | ||
plotly_theme = 'plotly_white' | ||
|
||
pio.templates.default = plotly_theme |
This file contains 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