Skip to content

Commit 2cba999

Browse files
committed
Merge branch 'main' of https://github.com/RolnickLab/ami-platform into 543-summarize-all-todos-in-the-codebase
2 parents d0c17cc + f4807a1 commit 2cba999

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

ami/main/charts.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ def event_top_taxa(event_pk: int, top_n: int = 10):
279279
else:
280280
taxa, counts = [], []
281281

282+
# Restrict number of top species if too many
283+
MAX_SPECIES = 10
284+
if len(taxa) > MAX_SPECIES:
285+
taxa = taxa[:MAX_SPECIES]
286+
counts = counts[:MAX_SPECIES]
287+
282288
return {
283289
"title": "Top species",
284290
"data": {"x": counts, "y": taxa},

ui/src/design-system/components/plot/plot.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ const Plot = ({
3434
marker: {
3535
color: markerColor,
3636
},
37-
hovertemplate,
37+
hovertemplate:
38+
type === 'bar' && orientation === 'h'
39+
? '%{x}'
40+
: type === 'bar'
41+
? '%{y}'
42+
: '<b>%{x}</b>: %{y}',
43+
name: '', // Remove ‘trace 0’ next to hover
3844
},
3945
]}
4046
config={{

0 commit comments

Comments
 (0)