Format Large Numbers With Commas

Is there a way to format the display of plain large numbers in a ‘Singlestat’ panel to use commas, e.g. to display a large number like ‘1234567’ as ‘1,234,567’?

What’s really needed is an additional ‘Unit’ format under ‘none’ called something like ‘long’, that inserts commas, as necessary.

How about a new formatting option under ‘Unit’, called maybe ‘custom’, which will open an additional text edit and allow you to enter a traditional ‘printf’ format string.

5 Likes

Currently there is not a way to do this. You can use the short Unit to help make it easier to read large numbers.

There is a feature request for formatting numbers with commas.

1 Like

The consumers who use the dashboards I create explicitly don’t like the ‘short’ Unit. They want to see large numbers with ‘thousands’ separators. I can’t see how the other feature request you mention would be a solution here, unless an additional ‘long’ format is introduced with International Localization. The localization would cause numbers like ‘1.23K’ to be displayed as ‘1,23K’, but there would still be no ‘Unit’ option to display ‘1234567.89’ as ‘1,234,567.89’, or even ‘1.234.567,89’.

I think the ability to use ‘printf’ format codes would solve this issue, and even the Localization issue. Would it be possible to raise the use of format codes as a ‘feature request’?

1 Like

Open a feature request on GitHub and if it is a popular feature then it might get implemented.

I’ve done a ‘+1’ on Github, but would love to see this extended to the Tooltips too (to show the full absolute values, rather than the condensed values).

You can do it now: “Unit” -> “none” -> “locale format”

7 Likes

Yes it works with “locale format” but the thousands separator is not in general “,” but should be also “.” It depends…
For example
123,456.32 can be written also (in Europe) as 123.456,32
Anyway “locale format” and also the other formats do not work, on my release, on singlestat visualization.

you might be on an old version then. Locale format is browser standard local formatting

locale seems to work indeed, which is great

However, it takes away any other unit you have selected. In previous grafana versions you had the ability to add a pre-fix and post-fix…

My problem: I want to show for example: 27,652 h but this is not possible in Grafana 7:

  1. If I select ‘hours(h)’ as a unit, the value gets automatically shown as 3 year
  2. If I use a custom unit: ‘_h’ with underscore being a blank space, then I can get 27652 h
  3. If I select ‘locale format’, then I get 27,652 but there is no possibility to add a unit

The solution in Grafana 6.5 was to use locale format with a post-fix… Shame the post-fixes have been removed.

1 Like

In Grafana version 9.1.2 I change my time settings to a Browser Time (in Europe) still have “,” as a thousand separator. Is it right? Can´t I change “,” format to “.” format in thousand separator?

1 Like