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

CDD-2140: Update plotly hover template date format #2092

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion metrics/interfaces/charts/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,17 @@ def _apply_hover_label_styling(self):
)

def _apply_hover_template_to_all_plots(self):
"""
Note:
the plots hovertemplate property is used by plotly react
on the front-end to control hover text formatting.

To format dates using the hovertemplate you can use
`D3-time-format` specifiers. examples can be found at:
https://d3js.org/d3-time-format
"""
for plot in self.figure.data:
plot.hovertemplate = "%{y} <extra></extra>"
plot.hovertemplate = "%{y} (%{x|%d %b %Y})<extra></extra>"

def _disable_clicks_on_legend(self):
self.figure.layout.legend.itemclick = False
Expand Down
Loading