From 102bc0cb01b5fd64a8bcdc907866f13468610b26 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Thu, 16 Feb 2023 16:58:53 +0000 Subject: [PATCH] update --- src/App.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/App.js b/src/App.js index 7774003..7439a7b 100644 --- a/src/App.js +++ b/src/App.js @@ -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;