Skip to content

Commit cb4bf4a

Browse files
committed
Fix formatting
1 parent 41b9507 commit cb4bf4a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dashboard/utils.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,14 @@ def hover_section(title, cols, hover_data):
212212
if not cols:
213213
return []
214214
section = [f"<br><b>{title}</b>"]
215-
section += [
216-
f"{col}=%{{customdata[{hover_data.index(col)}]:.4g}}"
217-
for col in cols
218-
]
215+
for col in cols:
216+
# Check if column is "date"
217+
if col == "date":
218+
# For string/date columns, use no format specifier (displays as-is)
219+
section.append(f"{col}=%{{customdata[{hover_data.index(col)}]}}")
220+
else:
221+
# Use numeric formatting for numeric columns
222+
section.append(f"{col}=%{{customdata[{hover_data.index(col)}]:.4g}}")
219223
return section
220224

221225
# Determine which data is shown when hovering over the plot
@@ -263,6 +267,7 @@ def hover_section(title, cols, hover_data):
263267
)
264268

265269
# Attach customdata:
270+
print('df_copy_filtered["date"].values:', df_copy_filtered['date'].values)
266271
exp_fig.update_traces(customdata=df_copy_filtered[hover_customdata].values)
267272
hovertemplate = "<br>".join(hover_template_lines) + "<extra></extra>"
268273
# Apply hovertemplate

0 commit comments

Comments
 (0)