From b1e48f429fb82af33f65e57f549b1a099a89d33e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 13 Jul 2020 12:53:59 +0200 Subject: [PATCH] BarGauge: Fixed width of unfilled region not being correct when value is close to 100% (#26193) * BarGauge: Fixed width of unfilled region not being correct when value is close to 100% * removed accidental change * updated snapshot --- packages/grafana-ui/src/components/BarGauge/BarGauge.tsx | 3 --- .../components/BarGauge/__snapshots__/BarGauge.test.tsx.snap | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx b/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx index 79a80ced44b..f28aceb8952 100644 --- a/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx +++ b/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx @@ -605,9 +605,6 @@ function getValueStyles( styles.paddingRight = `${VALUE_LEFT_PADDING}px`; // Need to remove the left padding from the text width constraints textWidth -= VALUE_LEFT_PADDING; - - // adjust width of title box - styles.width = measureText(formattedValueString, styles.fontSize).width + VALUE_LEFT_PADDING * 2; } return styles; diff --git a/packages/grafana-ui/src/components/BarGauge/__snapshots__/BarGauge.test.tsx.snap b/packages/grafana-ui/src/components/BarGauge/__snapshots__/BarGauge.test.tsx.snap index 0ecb489b449..3b39c8362dc 100644 --- a/packages/grafana-ui/src/components/BarGauge/__snapshots__/BarGauge.test.tsx.snap +++ b/packages/grafana-ui/src/components/BarGauge/__snapshots__/BarGauge.test.tsx.snap @@ -35,7 +35,7 @@ exports[`BarGauge Render with basic options should render 1`] = ` "lineHeight": 1, "paddingLeft": "10px", "paddingRight": "10px", - "width": 22, + "width": "60px", } } value={