Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
feat: daily pulls
Browse files Browse the repository at this point in the history
  • Loading branch information
xynydev committed Sep 12, 2023
1 parent ff01283 commit 1804a6a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/sections/PullStats.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import Chart from "chart.js/auto";
import { onMount } from "svelte";
import { darkModeStore } from "@ts/stores";
export let stats
Expand Down Expand Up @@ -29,7 +28,6 @@
});
datasets.push({
type: "bar",
label: "total",
data: dates.map((date) => totalForDate(date)),
});
Expand Down Expand Up @@ -68,14 +66,31 @@
});
new Chart(document.getElementById("total"), {
type: "line",
type: "bar",
data: {
labels: dates,
datasets: datasets.filter((d) => d.label == "total"),
},
options: chartOptions
});
// daily pulls (how much bigger is todays total pull count from yesterdays)
// is calculated by subtracting yesterday's total from today's
const daily = [{
label: "daily pulls",
data: dates.map((date, i) => {
return totalForDate(date)-totalForDate(dates[i-1] || dates[0])
}),
}]
new Chart(document.getElementById("daily"), {
type: "bar",
data: {
labels: dates,
datasets: daily,
},
options: chartOptions
});
new Chart(document.getElementById("main"), {
type: "line",
data: {
Expand Down Expand Up @@ -111,6 +126,10 @@
<figcaption>Total pulls</figcaption>
<canvas id="total"/>
</figure>
<figure class="h-[48rem]">
<figcaption>Daily pulls (bad data quality in some areas leading to odd peaks and dips)</figcaption>
<canvas id="daily"/>
</figure>
<figure class="h-[48rem]">
<figcaption>Main & Nvidia</figcaption>
<canvas id="main"/>
Expand Down

0 comments on commit 1804a6a

Please sign in to comment.