From f1dce0c7d782bef02086d2b315d3ea727b249f56 Mon Sep 17 00:00:00 2001 From: Ryan Watts <33863267+ryanjpwatts@users.noreply.github.com> Date: Tue, 4 Jun 2024 17:58:59 +0100 Subject: [PATCH] XYChart: Use same auto-ranging logic for X and Y axes (#88584) --- .../panels-visualizations/visualizations/xy-chart/index.md | 4 ++-- .../src/components/uPlot/config/UPlotScaleBuilder.ts | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/sources/panels-visualizations/visualizations/xy-chart/index.md b/docs/sources/panels-visualizations/visualizations/xy-chart/index.md index 68073a6d2c7..8b6ef44a546 100644 --- a/docs/sources/panels-visualizations/visualizations/xy-chart/index.md +++ b/docs/sources/panels-visualizations/visualizations/xy-chart/index.md @@ -253,11 +253,11 @@ Set the y-axis to be centered on zero. ### Soft min and soft max -Set a **Soft min** or **soft max** option for better control of y-axis limits. By default, Grafana sets the range for the y-axis automatically based on the dataset. +Set a **Soft min** or **soft max** option for better control of all axes limits. By default, Grafana sets the range automatically based on the dataset. **Soft min** and **soft max** settings can prevent small variations in the data from being magnified when it's mostly flat. In contrast, hard min and max values help prevent obscuring useful detail in the data by clipping intermittent spikes past a specific point. -To define hard limits of the y-axis, set standard min/max options. For more information, refer to [Configure standard options](ref:configure-standard-options). +To define hard limits of the axes, set standard min/max options. For more information, refer to [Configure standard options](ref:configure-standard-options). ![Label example](/static/img/docs/time-series-panel/axis-soft-min-max-7-4.png) diff --git a/packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts b/packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts index 1e2e6f74991..e840eb5c5fe 100644 --- a/packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts +++ b/packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts @@ -156,11 +156,6 @@ export class UPlotScaleBuilder extends PlotConfigBuilder { let minMax: uPlot.Range.MinMax = [dataMin, dataMax]; - // don't pad numeric x scales - if (scaleKey === 'x' && !isTime && distr === ScaleDistribution.Linear) { - return minMax; - } - // happens when all series on a scale are `show: false`, re-returning nulls will auto-disable axis if (!hasFixedRange && dataMin == null && dataMax == null) { return minMax;