Skip to content

A platform for community discussion. Free, open, simple.

UX: Dynamically refresh y-axis scale for stacked chart (#38364)

Krzysztof Kotlarek35d6eaac4339
diff --git a/frontend/discourse/admin/components/admin-report-stacked-chart.gjs b/frontend/discourse/admin/components/admin-report-stacked-chart.gjs
index 06eab24310b..8dac4a7735d 100644
--- a/frontend/discourse/admin/components/admin-report-stacked-chart.gjs
+++ b/frontend/discourse/admin/components/admin-report-stacked-chart.gjs
@@ -98,17 +98,6 @@ export default class AdminReportStackedChart extends Component {
})),
};
- // max Y value so chart remains constant when data changes
- const stackedTotals = [];
- for (let i = 0; i < chartData[0].data.length; i++) {
- let total = 0;
- for (const value of chartData) {
- total += value.data[i]?.y || 0;
- }
- stackedTotals.push(total);
- }
- const maxStackedValue = Math.max(...stackedTotals);
-
const prefersReducedMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
@@ -213,7 +202,6 @@ export default class AdminReportStackedChart extends Component {
y: {
stacked: true,
display: true,
- max: maxStackedValue,
grid: {
color: getCSSColor("--primary-very-low"),
},