Skip to content

Commit

Permalink
Merge pull request #509 from theosanderson/theosanderson-patch-47
Browse files Browse the repository at this point in the history
Update Key.jsx
  • Loading branch information
theosanderson committed Aug 23, 2023
2 parents 50949d8 + 7166767 commit 2213cee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions taxonium_component/src/components/Key.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ const Key = ({
colorByPosition,
config,
}) => {
const numLegendEntries = 10;
const [collapsed, setCollapsed] = useState(window.innerWidth < 800);
// sort by item.count in descending order
const sortedKeyStuff = keyStuff.sort((a, b) => b.count - a.count);
// truncate to 10 items
const isTruncated = sortedKeyStuff.length > 10;
const topTenKeyStuff = sortedKeyStuff.slice(0, 10);
const isTruncated = sortedKeyStuff.length > numLegendEntries;
const topTenKeyStuff = sortedKeyStuff.slice(0, numLegendEntries);
// if there is an item with value of "", remove it
const filteredKeyStuff = topTenKeyStuff.filter((item) => item.value !== "");
if (colorByField === "None") {
Expand Down

1 comment on commit 2213cee

@vercel
Copy link

@vercel vercel bot commented on 2213cee Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.