From 78ed5a99e634110997fc37839a76368c6f79312f Mon Sep 17 00:00:00 2001 From: Oscar Kilhed Date: Wed, 2 Feb 2022 11:05:48 +0100 Subject: [PATCH] TimeSeries/Barchart: Only show default label for y axis (#44713) * TimeSeries/Barchart: only show default label for x axis * Update docs * Update packages/grafana-ui/src/options/builder/axis.tsx Co-authored-by: Dominik Prokop Co-authored-by: Dominik Prokop --- .../sources/visualizations/time-series/change-axis-display.md | 2 +- packages/grafana-ui/src/options/builder/axis.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sources/visualizations/time-series/change-axis-display.md b/docs/sources/visualizations/time-series/change-axis-display.md index 6b893602d29..bd6244531c3 100644 --- a/docs/sources/visualizations/time-series/change-axis-display.md +++ b/docs/sources/visualizations/time-series/change-axis-display.md @@ -47,7 +47,7 @@ Set a Y-axis text label. ![Label example](/static/img/docs/time-series-panel/label-example-7-4.png) -If you have more than one Y-axis, then you can give assign different labels in the Override tab. +If you have more than one Y-axis, then you can give assign different labels in the Override tab. You can also set the X-axis label using an override. ## Width diff --git a/packages/grafana-ui/src/options/builder/axis.tsx b/packages/grafana-ui/src/options/builder/axis.tsx index 2335dfb05bb..17ea669656e 100644 --- a/packages/grafana-ui/src/options/builder/axis.tsx +++ b/packages/grafana-ui/src/options/builder/axis.tsx @@ -37,8 +37,8 @@ export function addAxisConfig( placeholder: 'Optional text', }, showIf: (c) => c.axisPlacement !== AxisPlacement.Hidden, - // no matter what the field type is - shouldApply: () => true, + // Do not apply default settings to time and string fields which are used as x-axis fields in Time series and Bar chart panels + shouldApply: (f) => f.type !== FieldType.time && f.type !== FieldType.string, }) .addNumberInput({ path: 'axisWidth',