Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson committed Feb 16, 2023
1 parent cd87c5c commit 102bc0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,14 @@ const SingleRow = ({ parsedSequence, rowStart, rowEnd, setHoveredInfo, rowId, in
// Calculate dimensions and tick interval
const width = rowSequence.length * sep; // 10 pixels per character
let height = 70 + featureBlocks.length * 20;
const approxNumTicks = Math.ceil(width / 60); // One tick every 60 pixels
// if rowStart is more than 5 digits, then we need more spacing
const spacing = rowStart > 10000 ? 60 : 40;
const approxNumTicks = Math.ceil(width / spacing); // One tick every 60 pixels
let tickInterval = Math.ceil(rowSequence.length / approxNumTicks);
const options = [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000, 5000000, 10000000];
// find nearest option to tickInterval
tickInterval = options.reduce((prev, curr) => (Math.abs(curr - tickInterval) < Math.abs(prev - tickInterval) ? curr : prev));
// find option just larger than tickInterval

tickInterval = options.find((option) => option >= tickInterval);
const modulus = rowStart % tickInterval;
const numTicks = Math.floor((rowEnd - rowStart) / tickInterval) + 1;

Expand Down

1 comment on commit 102bc0c

@vercel
Copy link

@vercel vercel bot commented on 102bc0c Feb 16, 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.