Time series panel: Hide axis when series is hidden from the visualization (#51432)

* Time series panel: Hide axis when series is hidden from the visualization

* Fix snap
This commit is contained in:
Dominik Prokop
2022-06-27 14:17:46 +02:00
committed by GitHub
parent f2d8b1ceee
commit 4a397c9c24
4 changed files with 15 additions and 12 deletions

View File

@@ -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"]
],

View File

@@ -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",

View File

@@ -151,7 +151,9 @@ export function buildScaleKey(config: FieldConfig<GraphFieldConfig>) {
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) {

View File

@@ -201,6 +201,7 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{
formatValue: (v) => formattedValueToString(fmt(v)),
theme,
grid: { show: customConfig.axisGridShow },
show: customConfig.hideFrom?.viz === false,
},
field
)