diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/AuctionPriceScatterplot.svelte | 19 | ||||
-rw-r--r-- | src/lib/api.ts | 3 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/lib/AuctionPriceScatterplot.svelte b/src/lib/AuctionPriceScatterplot.svelte index f430edd..42fb6f1 100644 --- a/src/lib/AuctionPriceScatterplot.svelte +++ b/src/lib/AuctionPriceScatterplot.svelte @@ -12,7 +12,7 @@ let hoursBetween = (currentTimestamp - earliestTimestamp) / (60 * 60) const gridWidth = 100 / hoursBetween - let heightCoinInterval = Math.pow(10, Math.floor(Math.log10(maxCoins / 2))) + let heightCoinInterval = Math.ceil(Math.pow(10, Math.floor(Math.log10(maxCoins / 2)))) const gridHeight = 100 / (maxCoins / heightCoinInterval) @@ -52,6 +52,14 @@ } } else currentlyPreviewedAuction = null } + + function shortenBigNumber(n: number) { + if (n < 1000) return n + if (n < 1_000_000) return parseFloat((n / 1000).toPrecision(2)).toLocaleString() + 'k' + if (n < 1_000_000_000) return parseFloat((n / 1_000_000).toPrecision(2)).toLocaleString() + 'M' + if (n < 1_000_000_000_000) + return parseFloat((n / 1_000_000_000).toPrecision(2)).toLocaleString() + 'B' + } </script> {#if item.auctions.length > 0} @@ -73,6 +81,15 @@ /> </pattern> </defs> + {#each new Array(Math.floor(maxCoins / heightCoinInterval) + 1) as _, intervalIndex} + <text + x="-1" + y={Math.max(5, 100 - intervalIndex * gridHeight + 2)} + fill="var(--theme-darker-text)" + font-size="6px" + text-anchor="end">{shortenBigNumber(heightCoinInterval * intervalIndex)}</text + > + {/each} <rect width="100%" height="100%" diff --git a/src/lib/api.ts b/src/lib/api.ts index 1721d01..77d6334 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -1,3 +1,4 @@ // the trailing slash is required -export const API_URL = 'https://skyblock-api.matdoes.dev/' +// export const API_URL = 'https://skyblock-api.matdoes.dev/' // export const API_URL = 'http://localhost:8080/' +export const API_URL = 'https://8080-skyblocksta-skyblockapi-gef4h4mxokc.ws-us45.gitpod.io/' |