Skip to content

Commit

Permalink
Add mean, median and total to analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierstoval committed Apr 5, 2024
1 parent 8900114 commit 24d2301
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/routes/analytics/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
{#each (chart_data?.labels||[]) as label}
<th>{label}</th>
{/each}
<th>#Average/Mean</th>
<th>#Median</th>
<th>#Total</th>
</tr>
</thead>
<tbody>
Expand All @@ -193,6 +196,9 @@

</td>
{/each}
<td>{new Intl.NumberFormat('fr-FR', {style: 'currency', currency: 'EUR'}).format(dataset.data.reduce((a, b) => a + b, 0) / dataset.data.length).toString()}</td>
<td>{new Intl.NumberFormat('fr-FR', {style: 'currency', currency: 'EUR'}).format(dataset.data[Math.floor(dataset.data.length/2)]).toString()}</td>
<td>{new Intl.NumberFormat('fr-FR', {style: 'currency', currency: 'EUR'}).format(dataset.data.reduce((a, b) => a + b, 0)).toString()}</td>
</tr>
{/each}
</tbody>
Expand Down

0 comments on commit 24d2301

Please sign in to comment.