From d65f7346a7326b727ce743f036bc69530a17a1d6 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Thu, 7 Jan 2021 17:27:15 -0600 Subject: [PATCH] GraphNG: check cross-axis presence when auto-padding. close #30121. (#30126) --- packages/grafana-ui/src/components/uPlot/hooks.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/uPlot/hooks.ts b/packages/grafana-ui/src/components/uPlot/hooks.ts index 772b42c7a10..911f9af58f0 100644 --- a/packages/grafana-ui/src/components/uPlot/hooks.ts +++ b/packages/grafana-ui/src/components/uPlot/hooks.ts @@ -86,7 +86,9 @@ export const usePlotPlugins = () => { }; const paddingSide: PaddingSide = (u, side, sidesWithAxes, cycleNum) => { - return sidesWithAxes[side] ? 0 : 8; + let hasCrossAxis = side % 2 ? sidesWithAxes[0] || sidesWithAxes[2] : sidesWithAxes[1] || sidesWithAxes[3]; + + return sidesWithAxes[side] || !hasCrossAxis ? 0 : 8; }; export const DEFAULT_PLOT_CONFIG: Partial = {