From 78ef1719e2320bf4d95d7e74fafa359405129e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sun, 7 Apr 2019 15:26:21 +0200 Subject: [PATCH] BarGauge: Round sizing to avoid float widths LED cell width needs to be integers --- packages/grafana-ui/src/components/BarGauge/BarGauge.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx b/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx index ea73c74e153..9c5bf656382 100644 --- a/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx +++ b/packages/grafana-ui/src/components/BarGauge/BarGauge.tsx @@ -136,8 +136,9 @@ export class BarGauge extends PureComponent { const valueRange = maxValue - minValue; const maxSize = isVert ? maxBarHeight : maxBarWidth; const cellSpacing = itemSpacing!; - const cellCount = maxSize / 20; - const cellSize = (maxSize - cellSpacing * cellCount) / cellCount; + const cellWidth = 12; + const cellCount = Math.floor(maxSize / cellWidth); + const cellSize = Math.floor((maxSize - cellSpacing * cellCount) / cellCount); const valueColor = getValueColor(this.props); const valueStyles = getValueStyles(value.text, valueColor, valueWidth, valueHeight);