From f306107a386ba18fb216a7d1dd6658ad21ae3c64 Mon Sep 17 00:00:00 2001 From: Sammy-T Date: Tue, 16 Mar 2021 12:20:57 -0400 Subject: [PATCH] Adjust x-axis labels when record count is greater than 25 --- components/metrics/BarChart.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/metrics/BarChart.js b/components/metrics/BarChart.js index 642b1b63..3558e593 100644 --- a/components/metrics/BarChart.js +++ b/components/metrics/BarChart.js @@ -48,11 +48,17 @@ export default function BarChart({ case 'hour': return dateFormat(d, 'p', locale); case 'day': - if (records > 31) { - if (sw <= 250) { + if (records > 25) { + if (sw <= 275) { return index % 10 === 0 ? dateFormat(d, 'M/d', locale) : ''; } - return index % 5 === 0 ? dateFormat(d, 'M/d', locale) : ''; + if (sw <= 550) { + return index % 5 === 0 ? dateFormat(d, 'M/d', locale) : ''; + } + if (sw <= 700) { + return index % 2 === 0 ? dateFormat(d, 'M/d', locale) : ''; + } + return dateFormat(d, 'MMM d', locale); } if (sw <= 375) { return index % 2 === 0 ? dateFormat(d, 'MMM d', locale) : '';