diff --git a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap index 54bb3efd75b3..c17eeec91dc2 100644 --- a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap +++ b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap @@ -340,9 +340,10 @@ exports[`xy_expression XYChart component it renders bar 1`] = ` displayValueSettings={ Object { "isAlternatingValueLabel": false, - "isValueContainedInElement": true, + "isValueContainedInElement": false, "overflowConstraints": Array [ "chartEdges", + "barGeometry", ], "showValueLabel": false, "valueFormatter": [Function], @@ -406,9 +407,10 @@ exports[`xy_expression XYChart component it renders bar 1`] = ` displayValueSettings={ Object { "isAlternatingValueLabel": false, - "isValueContainedInElement": true, + "isValueContainedInElement": false, "overflowConstraints": Array [ "chartEdges", + "barGeometry", ], "showValueLabel": false, "valueFormatter": [Function], @@ -569,9 +571,10 @@ exports[`xy_expression XYChart component it renders horizontal bar 1`] = ` displayValueSettings={ Object { "isAlternatingValueLabel": false, - "isValueContainedInElement": true, + "isValueContainedInElement": false, "overflowConstraints": Array [ "chartEdges", + "barGeometry", ], "showValueLabel": false, "valueFormatter": [Function], @@ -635,9 +638,10 @@ exports[`xy_expression XYChart component it renders horizontal bar 1`] = ` displayValueSettings={ Object { "isAlternatingValueLabel": false, - "isValueContainedInElement": true, + "isValueContainedInElement": false, "overflowConstraints": Array [ "chartEdges", + "barGeometry", ], "showValueLabel": false, "valueFormatter": [Function], @@ -1240,9 +1244,10 @@ exports[`xy_expression XYChart component it renders stacked bar 1`] = ` displayValueSettings={ Object { "isAlternatingValueLabel": false, - "isValueContainedInElement": true, + "isValueContainedInElement": false, "overflowConstraints": Array [ "chartEdges", + "barGeometry", ], "showValueLabel": false, "valueFormatter": [Function], @@ -1310,9 +1315,10 @@ exports[`xy_expression XYChart component it renders stacked bar 1`] = ` displayValueSettings={ Object { "isAlternatingValueLabel": false, - "isValueContainedInElement": true, + "isValueContainedInElement": false, "overflowConstraints": Array [ "chartEdges", + "barGeometry", ], "showValueLabel": false, "valueFormatter": [Function], @@ -1477,9 +1483,10 @@ exports[`xy_expression XYChart component it renders stacked horizontal bar 1`] = displayValueSettings={ Object { "isAlternatingValueLabel": false, - "isValueContainedInElement": true, + "isValueContainedInElement": false, "overflowConstraints": Array [ "chartEdges", + "barGeometry", ], "showValueLabel": false, "valueFormatter": [Function], @@ -1547,9 +1554,10 @@ exports[`xy_expression XYChart component it renders stacked horizontal bar 1`] = displayValueSettings={ Object { "isAlternatingValueLabel": false, - "isValueContainedInElement": true, + "isValueContainedInElement": false, "overflowConstraints": Array [ "chartEdges", + "barGeometry", ], "showValueLabel": false, "valueFormatter": [Function], diff --git a/x-pack/plugins/lens/public/xy_visualization/expression.tsx b/x-pack/plugins/lens/public/xy_visualization/expression.tsx index 56867c625bb6..8eb7ec1e0f62 100644 --- a/x-pack/plugins/lens/public/xy_visualization/expression.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/expression.tsx @@ -167,7 +167,7 @@ export const getXyChartRenderer = (dependencies: { }); function getValueLabelsStyling(isHorizontal: boolean) { - const VALUE_LABELS_MAX_FONTSIZE = 15; + const VALUE_LABELS_MAX_FONTSIZE = 12; const VALUE_LABELS_MIN_FONTSIZE = 10; const VALUE_LABELS_VERTICAL_OFFSET = -10; const VALUE_LABELS_HORIZONTAL_OFFSET = 10; @@ -175,7 +175,7 @@ function getValueLabelsStyling(isHorizontal: boolean) { return { displayValue: { fontSize: { min: VALUE_LABELS_MIN_FONTSIZE, max: VALUE_LABELS_MAX_FONTSIZE }, - fill: { textInverted: true, textBorder: 2 }, + fill: { textContrast: true, textInverted: false, textBorder: 0 }, alignment: isHorizontal ? { vertical: VerticalAlignment.Middle, @@ -792,9 +792,12 @@ export function XYChart({ // * in some scenarios value labels are not strings, and this breaks the elastic-chart lib valueFormatter: (d: unknown) => yAxis?.formatter?.convert(d) || '', showValueLabel: shouldShowValueLabels && valueLabels !== 'hide', + isValueContainedInElement: false, isAlternatingValueLabel: false, - isValueContainedInElement: true, - overflowConstraints: [LabelOverflowConstraint.ChartEdges], + overflowConstraints: [ + LabelOverflowConstraint.ChartEdges, + LabelOverflowConstraint.BarGeometry, + ], }, }; return ;