From 7a04672666e9c366e7bbf241ed82efe481dc9492 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 18 May 2022 01:21:16 +0000 Subject: grid background improvement --- src/lib/AuctionPriceScatterplot.svelte | 19 +++++++++++++++---- src/routes/auctionprices.svelte | 4 +++- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/lib/AuctionPriceScatterplot.svelte b/src/lib/AuctionPriceScatterplot.svelte index 1e774d0..0532f97 100644 --- a/src/lib/AuctionPriceScatterplot.svelte +++ b/src/lib/AuctionPriceScatterplot.svelte @@ -9,8 +9,12 @@ let maxCoins: number = item.auctions.reduce((max, auction) => Math.max(max, auction.coins), 0) let currentTimestamp = Math.floor(Date.now() / 1000) let earliestTimestamp = item.auctions.length > 0 ? item.auctions[0].ts : 0 - let minutesBetween = (currentTimestamp - earliestTimestamp) / 360 - let gridWidth = 100 / minutesBetween + let hoursBetween = (currentTimestamp - earliestTimestamp) / (60 * 60) + const gridWidth = 100 / hoursBetween + + let heightCoinInterval = Math.pow(10, Math.floor(Math.log10(maxCoins / 2))) + + const gridHeight = 100 / (maxCoins / heightCoinInterval) function getAuctionCoordinates(auction: SimpleAuctionSchema) { const timestampPercentage = @@ -52,8 +56,15 @@ - - + + r.json()) + let url = `${API_URL}auctionprices` + if (query.length > 0) url += `?items=${itemIds.join(',')}` + data = await fetch(url).then(r => r.json()) } let pageHeight = 0 -- cgit