From 707a6f406e5a00b886f8da97ff1c28304f9c337f Mon Sep 17 00:00:00 2001 From: dej611 Date: Fri, 15 Oct 2021 18:58:34 +0200 Subject: [PATCH 1/2] :bug: Remove the extra math column and few other fixes --- .../lens_columns/overall_column.ts | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_columns/overall_column.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_columns/overall_column.ts index 44b40944dfd07..32268dcd8e440 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_columns/overall_column.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_columns/overall_column.ts @@ -31,6 +31,7 @@ export function getDistributionInPercentageColumn({ } const main: FormulaIndexPatternColumn = { + customLabel: true, label: label || 'Percentage of records', dataType: 'number' as DataType, operationType: 'formula', @@ -41,7 +42,7 @@ export function getDistributionInPercentageColumn({ isFormulaBroken: false, format: { id: 'percent', params: { decimals: 0 } }, }, - references: [`${yAxisColId}X4`], + references: [`${yAxisColId}X3`], }; const countColumn: CountIndexPatternColumn = { @@ -55,24 +56,13 @@ export function getDistributionInPercentageColumn({ filter: { query: columnFilter ?? '', language: 'kuery' }, }; - const mathColumn: MathIndexPatternColumn = { - label: 'Part of count() / overall_sum(count())', - dataType: 'number', - operationType: 'math', - isBucketed: false, - scale: 'ratio', - params: { tinymathAst: `${yAxisColId}X1` }, - references: [`${yAxisColId}X1`], - customLabel: true, - }; - const overAllSumColumn: OverallSumIndexPatternColumn = { label: 'Part of count() / overall_sum(count())', dataType: 'number', operationType: 'overall_sum', isBucketed: false, scale: 'ratio', - references: [`${yAxisColId}X2`], + references: [`${yAxisColId}X1`], customLabel: true, }; @@ -86,12 +76,12 @@ export function getDistributionInPercentageColumn({ tinymathAst: { type: 'function', name: 'divide', - args: [`${yAxisColId}X0`, `${yAxisColId}X3`], + args: [`${yAxisColId}X0`, `${yAxisColId}X2`], location: { min: 0, max: 30 }, text: lensFormula, } as unknown as TinymathAST, }, - references: [`${yAxisColId}X0`, `${yAxisColId}X3`], + references: [`${yAxisColId}X0`, `${yAxisColId}X2`], customLabel: true, }; @@ -101,9 +91,8 @@ export function getDistributionInPercentageColumn({ > = { [`${yAxisColId}X0`]: countColumn, [`${yAxisColId}X1`]: countColumn, - [`${yAxisColId}X2`]: mathColumn, - [`${yAxisColId}X3`]: overAllSumColumn, - [`${yAxisColId}X4`]: tinyMathColumn, + [`${yAxisColId}X2`]: overAllSumColumn, + [`${yAxisColId}X3`]: tinyMathColumn, }; return { main, supportingColumns }; From 9202d121f448c0e09dbb28c03b1ed12798c2c2f9 Mon Sep 17 00:00:00 2001 From: dej611 Date: Fri, 15 Oct 2021 18:59:01 +0200 Subject: [PATCH 2/2] :bug: Do not reference children columns in the visualization state --- .../exploratory_view/configurations/lens_attributes.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts index 657ce8844fc6d..6ef81b6c163ed 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts @@ -308,6 +308,7 @@ export class LensAttributes { }), operationType: 'percentile', params: { percentile: Number(percentileValue.split('th')[0]) }, + customLabel: true, }; } @@ -724,10 +725,7 @@ export class LensAttributes { getDataLayers(): XYState['layers'] { const dataLayers = this.layerConfigs.map((layerConfig, index) => ({ - accessors: [ - `y-axis-column-layer${index}`, - ...Object.keys(this.getChildYAxises(layerConfig, `layer${index}`)), - ], + accessors: [`y-axis-column-layer${index}`], layerId: `layer${index}`, layerType: 'data' as any, seriesType: layerConfig.seriesType || layerConfig.seriesConfig.defaultSeriesType,