diff --git a/.betterer.results b/.betterer.results index c9fced3fc55..a0acad10818 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1749,7 +1749,7 @@ exports[`better eslint`] = { [2, 101, 3, "Unexpected any. Specify a different type.", "193409811"], [15, 28, 17, "Do not use any type assertions.", "2923536692"] ], - "packages/grafana-ui/src/components/GraphNG/utils.ts:3480871323": [ + "packages/grafana-ui/src/components/GraphNG/utils.ts:460323924": [ [23, 18, 35, "Do not use any type assertions.", "180126096"], [23, 48, 3, "Unexpected any. Specify a different type.", "193409811"] ], @@ -2219,7 +2219,7 @@ exports[`better eslint`] = { [56, 22, 24, "Do not use any type assertions.", "4121028738"], [56, 43, 3, "Unexpected any. Specify a different type.", "193409811"] ], - "packages/grafana-ui/src/components/TimeSeries/utils.ts:3806893813": [ + "packages/grafana-ui/src/components/TimeSeries/utils.ts:1695012447": [ [33, 29, 3, "Unexpected any. Specify a different type.", "193409811"], [135, 19, 146, "Do not use any type assertions.", "3723122882"] ], diff --git a/packages/grafana-ui/src/components/GraphNG/__snapshots__/utils.test.ts.snap b/packages/grafana-ui/src/components/GraphNG/__snapshots__/utils.test.ts.snap index bb9819144ef..66aa3f7800b 100644 --- a/packages/grafana-ui/src/components/GraphNG/__snapshots__/utils.test.ts.snap +++ b/packages/grafana-ui/src/components/GraphNG/__snapshots__/utils.test.ts.snap @@ -41,8 +41,8 @@ Object { }, "labelGap": 0, "rotate": undefined, - "scale": "__fixed/na-na/na-na/auto/linear/na", - "show": true, + "scale": "__fixed/na-na/na-na/auto/linear/na/false", + "show": false, "side": 3, "size": [Function], "space": [Function], @@ -79,7 +79,7 @@ Object { "key": "__global_", "scales": Array [ "x", - "__fixed/na-na/na-na/auto/linear/na", + "__fixed/na-na/na-na/auto/linear/na/false", ], }, }, @@ -87,7 +87,7 @@ Object { "mode": 1, "padding": undefined, "scales": Object { - "__fixed/na-na/na-na/auto/linear/na": Object { + "__fixed/na-na/na-na/auto/linear/na/false": Object { "auto": true, "dir": 1, "distr": 1, @@ -125,7 +125,7 @@ Object { "stroke": "#ff0000", }, "pxAlign": undefined, - "scale": "__fixed/na-na/na-na/auto/linear/na", + "scale": "__fixed/na-na/na-na/auto/linear/na/false", "show": true, "spanGaps": false, "stroke": "#ff0000", @@ -148,7 +148,7 @@ Object { "stroke": "#ff0000", }, "pxAlign": undefined, - "scale": "__fixed/na-na/na-na/auto/linear/na", + "scale": "__fixed/na-na/na-na/auto/linear/na/false", "show": true, "spanGaps": false, "stroke": "#ff0000", @@ -171,7 +171,7 @@ Object { "stroke": "#ff0000", }, "pxAlign": undefined, - "scale": "__fixed/na-na/na-na/auto/linear/na", + "scale": "__fixed/na-na/na-na/auto/linear/na/false", "show": true, "spanGaps": false, "stroke": "#ff0000", @@ -194,7 +194,7 @@ Object { "stroke": "#ff0000", }, "pxAlign": undefined, - "scale": "__fixed/na-na/na-na/auto/linear/na", + "scale": "__fixed/na-na/na-na/auto/linear/na/false", "show": true, "spanGaps": false, "stroke": "#ff0000", @@ -217,7 +217,7 @@ Object { "stroke": "#ff0000", }, "pxAlign": undefined, - "scale": "__fixed/na-na/na-na/auto/linear/na", + "scale": "__fixed/na-na/na-na/auto/linear/na/false", "show": true, "spanGaps": false, "stroke": "#ff0000", diff --git a/packages/grafana-ui/src/components/GraphNG/utils.ts b/packages/grafana-ui/src/components/GraphNG/utils.ts index e5de3bd9f66..e5b6893485e 100644 --- a/packages/grafana-ui/src/components/GraphNG/utils.ts +++ b/packages/grafana-ui/src/components/GraphNG/utils.ts @@ -151,7 +151,9 @@ export function buildScaleKey(config: FieldConfig) { const scaleLabel = Boolean(config.custom?.axisLabel) ? config.custom!.axisLabel : defaultPart; - return `${scaleUnit}/${scaleRange}/${scaleSoftRange}/${scalePlacement}/${scaleDistribution}/${scaleLabel}`; + const shouldHideFromViz = Boolean(config.custom?.hideFrom?.viz); + + return `${scaleUnit}/${scaleRange}/${scaleSoftRange}/${scalePlacement}/${scaleDistribution}/${scaleLabel}/${shouldHideFromViz}`; } function getScaleDistributionPart(config: ScaleDistributionConfig) { diff --git a/packages/grafana-ui/src/components/TimeSeries/utils.ts b/packages/grafana-ui/src/components/TimeSeries/utils.ts index 78e2c1be97d..1bbff13bb25 100644 --- a/packages/grafana-ui/src/components/TimeSeries/utils.ts +++ b/packages/grafana-ui/src/components/TimeSeries/utils.ts @@ -201,6 +201,7 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{ formatValue: (v) => formattedValueToString(fmt(v)), theme, grid: { show: customConfig.axisGridShow }, + show: customConfig.hideFrom?.viz === false, }, field )