Adjust chart labels

This commit is contained in:
2026-03-11 08:52:37 -06:00
parent 3aab4560f4
commit 6089d1980c

View File

@@ -98,7 +98,9 @@ public class AnalyticsController {
return "";
}
int labelStep = Math.max(1, (salesDateLabels.size() + 14) / 15);
boolean showLabel = index == 0 || index == salesDateLabels.size() - 1 || index % labelStep == 0;
int lastIndex = salesDateLabels.size() - 1;
boolean nearEnd = index >= Math.max(0, lastIndex - 2);
boolean showLabel = index == 0 || nearEnd || index % labelStep == 0;
return showLabel ? salesDateLabels.get(index) : "";
}