aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-18 00:21:08 -0500
committermat <github@matdoes.dev>2022-05-18 00:21:08 -0500
commit5fd8b696b9b9e76785817075cacdec58a900f388 (patch)
treec848ee7e92538300785bd435a7c9509582ffee00
parent4fa747dd1f433113fad23826a447627ab634215f (diff)
downloadskyblock-stats-5fd8b696b9b9e76785817075cacdec58a900f388.tar.gz
skyblock-stats-5fd8b696b9b9e76785817075cacdec58a900f388.tar.bz2
skyblock-stats-5fd8b696b9b9e76785817075cacdec58a900f388.zip
fix NaN warning
-rw-r--r--src/lib/AuctionPriceScatterplot.svelte73
1 files changed, 40 insertions, 33 deletions
diff --git a/src/lib/AuctionPriceScatterplot.svelte b/src/lib/AuctionPriceScatterplot.svelte
index cfdbe9b..f430edd 100644
--- a/src/lib/AuctionPriceScatterplot.svelte
+++ b/src/lib/AuctionPriceScatterplot.svelte
@@ -54,40 +54,47 @@
}
</script>
-<svg viewBox="0 0 100 100" class="item-auction-history">
- <defs>
- <pattern
- id="grid-{item.id}"
- width={gridWidth}
- height={gridHeight}
- patternUnits="userSpaceOnUse"
- x="0%"
- y="100%"
- >
- <path d="M {gridWidth} 0 L 0 0 0 {gridHeight}" fill="none" stroke="#fff2" stroke-width="1" />
- </pattern>
- </defs>
- <rect
- width="100%"
- height="100%"
- fill="url(#grid-{item.id})"
- on:mousemove={updateNearest}
- bind:this={svgEl}
- />
-
- {#each item.auctions as auction}
- {@const [x, y] = getAuctionCoordinates(auction)}
- <circle
- cx={x}
- cy={y}
- r="1"
- stroke-width="4"
- fill={auction.bin ? '#11b' : '#1b1'}
- class:selected-auction={currentlyPreviewedAuction?.auction?.id === auction?.id}
+{#if item.auctions.length > 0}
+ <svg viewBox="0 0 100 100" class="item-auction-history">
+ <defs>
+ <pattern
+ id="grid-{item.id}"
+ width={gridWidth}
+ height={gridHeight}
+ patternUnits="userSpaceOnUse"
+ x="0%"
+ y="100%"
+ >
+ <path
+ d="M {gridWidth} 0 L 0 0 0 {gridHeight}"
+ fill="none"
+ stroke="#fff2"
+ stroke-width="1"
+ />
+ </pattern>
+ </defs>
+ <rect
+ width="100%"
+ height="100%"
+ fill="url(#grid-{item.id})"
+ on:mousemove={updateNearest}
+ bind:this={svgEl}
/>
- {/each}
- <!-- {item.auctions} -->
-</svg>
+
+ {#each item.auctions as auction}
+ {@const [x, y] = getAuctionCoordinates(auction)}
+ <circle
+ cx={x}
+ cy={y}
+ r="1"
+ stroke-width="4"
+ fill={auction.bin ? '#11b' : '#1b1'}
+ class:selected-auction={currentlyPreviewedAuction?.auction?.id === auction?.id}
+ />
+ {/each}
+ <!-- {item.auctions} -->
+ </svg>
+{/if}
<style>
.item-auction-history {