Menu

A flipped > made 9 look bigger than 9.22 in Grafana tables
📰

A flipped > made 9 look bigger than 9.22 in Grafana tables

DEV Community: javascript·Ashok Ram·12 days ago
#AAzU34yn
#devtojavascript#devto#dev#cell#grafana
Long article (612 words) — no AI summary yet.
Reading 0:00
15s threshold

9.22 is bigger than 9 . A Grafana table gauge disagreed and gave 9 the longest bar in the column.

seriych filed it as issue #113304 . My fix, grafana/grafana#136236 , came down to one backwards comparison, plus a review lesson about code that runs for every single cell.

What a gauge cell is

Grafana is an open source dashboard tool. In its tables, a column can show each number as a gauge: a horizontal bar plus the number as text, squeezed into a cell of fixed width. The trick that keeps bars honest: each cell holds back the same width for text, sized to fit the longest value, and the bar takes whatever is left. Grafana calls that value the alignment factor.

If each cell keeps a different amount of text space, it's like comparing people's heights while each one stands on a box of a different size. The lengths stop meaning anything.

The bug

When a column has no factor yet, getAlignmentFactor scans up to the next 1000 rows for the longest formatted value (the text as shown, suffix included).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.