From 2df3698e8ccc2960a780945df068592b1108a708 Mon Sep 17 00:00:00 2001 From: Vova Selin Date: Tue, 28 Dec 2021 22:04:15 -0700 Subject: [PATCH] Minor changes to graphs (#1566) * Add thousands comma separator for card counts graph * Fix Answer Buttons graph's tooltip Changes to the "times pressed" heading * Shows the percent of that button out of all the presses * Comma separates total on thousands * Update CONTRIBUTERS * Wider spacing for graph tables * Switch to locale-based stats numbers * Update CONTRIBUTORS Wrong email? * Fix counts graph on narrow devices Graph and table now align in a column when the device's screen is narrow. Columns widths are bounded to not get too wide * Rename toLocaleXXX functions * toLocaleNumber -> localizedNumber * toLocaleString -> localizedDate Also cleans up sketchy "card counts" table formatting * Localize more numbers Uses locale-based rounding for more numbers now * Localize graph axis ticks * Fix future-due graph tooltip * avoid div by zero (dae) Ignoring NaN in localizedNumber() could potentially mask a mistake in the future - better to explicitly handle the invalid case at the source instead. --- CONTRIBUTORS | 1 + ts/deck-options/SpinBoxFloat.svelte | 3 +- ts/graphs/CardCounts.svelte | 70 ++++++++++++++++++++--------- ts/graphs/HoverColumns.svelte | 2 +- ts/graphs/TableData.svelte | 4 ++ ts/graphs/buttons.ts | 20 +++++++-- ts/graphs/calendar.ts | 4 +- ts/graphs/card-counts.ts | 11 ++--- ts/graphs/ease.ts | 3 +- ts/graphs/future-due.ts | 5 ++- ts/graphs/histogram-graph.ts | 11 +++-- ts/graphs/hours.ts | 6 ++- ts/graphs/intervals.ts | 3 +- ts/graphs/reviews.ts | 4 +- ts/graphs/today.ts | 5 ++- ts/lib/i18n/utils.ts | 8 +++- 16 files changed, 113 insertions(+), 47 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 5d95cdbf3..482d1c005 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -88,6 +88,7 @@ Ren Tatsumoto lolilolicon Gesa Stupperich git9527 +Vova Selin ******************** diff --git a/ts/deck-options/SpinBoxFloat.svelte b/ts/deck-options/SpinBoxFloat.svelte index 2a3d9cd3a..77aa0248b 100644 --- a/ts/deck-options/SpinBoxFloat.svelte +++ b/ts/deck-options/SpinBoxFloat.svelte @@ -4,13 +4,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -->