diff --git a/src/plugins/chart_expressions/expression_gauge/common/expression_functions/__snapshots__/gauge_function.test.ts.snap b/src/plugins/chart_expressions/expression_gauge/common/expression_functions/__snapshots__/gauge_function.test.ts.snap index 56e22aedf42edd..45680ddb2383f8 100644 --- a/src/plugins/chart_expressions/expression_gauge/common/expression_functions/__snapshots__/gauge_function.test.ts.snap +++ b/src/plugins/chart_expressions/expression_gauge/common/expression_functions/__snapshots__/gauge_function.test.ts.snap @@ -18,6 +18,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "arc", "ticksPosition": "auto", }, @@ -67,6 +68,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "arc", "ticksPosition": "auto", }, @@ -114,6 +116,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "auto", }, @@ -161,6 +164,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "auto", }, @@ -208,6 +212,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "bands", }, @@ -257,6 +262,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "circle", "ticksPosition": "auto", }, @@ -306,6 +312,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "circle", "ticksPosition": "auto", }, @@ -353,6 +360,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "auto", }, @@ -400,6 +408,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "hidden", }, @@ -447,6 +456,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "auto", }, @@ -494,6 +504,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "auto", }, @@ -541,6 +552,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "auto", }, @@ -588,6 +600,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "horizontalBullet", "ticksPosition": "auto", }, @@ -635,6 +648,7 @@ Object { "metric": "col-0-1", "min": "col-1-2", "palette": undefined, + "percentageMode": false, "shape": "verticalBullet", "ticksPosition": "auto", }, diff --git a/src/plugins/chart_expressions/expression_gauge/public/components/__snapshots__/gauge_component.test.tsx.snap b/src/plugins/chart_expressions/expression_gauge/public/components/__snapshots__/gauge_component.test.tsx.snap index 0bd72c606dd9f9..59aaa3677e9bc4 100644 --- a/src/plugins/chart_expressions/expression_gauge/public/components/__snapshots__/gauge_component.test.tsx.snap +++ b/src/plugins/chart_expressions/expression_gauge/public/components/__snapshots__/gauge_component.test.tsx.snap @@ -41,6 +41,7 @@ exports[`GaugeComponent renders the chart 1`] = ` 4, ] } + tooltipValueFormatter={[Function]} /> `; diff --git a/src/plugins/chart_expressions/expression_gauge/public/components/gauge_component.test.tsx b/src/plugins/chart_expressions/expression_gauge/public/components/gauge_component.test.tsx index 488d5f57a6458e..c71b95a95d02c7 100644 --- a/src/plugins/chart_expressions/expression_gauge/public/components/gauge_component.test.tsx +++ b/src/plugins/chart_expressions/expression_gauge/public/components/gauge_component.test.tsx @@ -54,6 +54,7 @@ jest.mock('@elastic/charts', () => { }); const chartsThemeService = chartPluginMock.createSetupContract().theme; +const paletteThemeService = chartPluginMock.createSetupContract().palettes; const formatService = fieldFormatsServiceMock.createStartContract(); const args: GaugeArguments = { labelMajor: 'Gauge', @@ -81,12 +82,13 @@ const createData = ( describe('GaugeComponent', function () { let wrapperProps: GaugeRenderProps; - beforeAll(() => { + beforeAll(async () => { wrapperProps = { data: createData(), chartsThemeService, args, formatFactory: formatService.deserialize, + paletteService: await paletteThemeService.getPalettes(), }; }); diff --git a/src/plugins/vis_types/gauge/public/to_ast.ts b/src/plugins/vis_types/gauge/public/to_ast.ts index 3a9497846d7e73..dfb483d47fd214 100644 --- a/src/plugins/vis_types/gauge/public/to_ast.ts +++ b/src/plugins/vis_types/gauge/public/to_ast.ts @@ -81,8 +81,8 @@ export const toExpressionAst: VisToExpressionAst = (vis, params) range: percentageMode ? 'percent' : 'number', continuity: 'none', gradient: true, - rangeMax: percentageMode ? 100 : Infinity, - rangeMin: 0, + rangeMax: percentageMode ? 100 : stopsWithColors.stop[stopsWithColors.stop.length - 1], + rangeMin: stopsWithColors.stop[0], }); gauge.addArgument('palette', buildExpression([palette]));