Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Adjust x-axis labels when record count is greater than 25

Sammy-Tf306107a386b
diff --git a/components/metrics/BarChart.js b/components/metrics/BarChart.js
index 642b1b63a..3558e5930 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) : '';