Skip to content

Commit

Permalink
MatchCountsTable: give substitle example in same order as bars
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCrews committed Jan 22, 2025
1 parent 91d901c commit 7cc8d54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mismo/_find/_find_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def chart(self) -> alt.Chart:

n_title = "Number of Records"
key_title = "Number of Matches"
mins = self.order_by(_.n_records.desc()).limit(2).execute()
mins = self.order_by(_.n_matches.asc()).limit(2).execute()
if len(mins) > 1:
subtitle = f"eg '{mins.n_records[0]:,} records had {mins.n_matches[0]} matches, {mins.n_records[1]:,} had {mins.n_matches[1]} matches, ...'" # noqa: E501
elif len(mins) == 1:
Expand All @@ -52,6 +52,8 @@ def chart(self) -> alt.Chart:
)
.mark_bar()
.encode(
# if we ever change this sorting, keep the subtitle example
# to be in sync of the same order as the bars go left to right.
alt.X("n_matches:O", title=key_title, sort="x"),
alt.Y(
"n_records:Q",
Expand Down

0 comments on commit 7cc8d54

Please sign in to comment.