redash icon indicating copy to clipboard operation
redash copied to clipboard

Counter Visualization: can't format decimal numbers

Open susodapop opened this issue 4 years ago • 3 comments

Issue Summary

The number formatting options are disabled when I make a counter visualization from a decimal number.

Steps to Reproduce

  1. Create a new query against ~any SQL database~ BigQuery.
  2. Run the query SELECT 0.15 as value and execute
  3. Make a counter visualization that points at the value column
  4. Observe that the format options are gone

I expect to format this number as a percentage. Numeral.JS supports this with the scalePercentBy100 property option.

Further Details: My query doesn't explicitly cast 0.15 as numeric so it comes into Redash as a text type. You can produce the same issue in any SQL by running SELECT '0.15' as value. I expect the Counter visualization should try to cast as a number, or at least give that option like a normal table does.

Technical details:

  • Redash Version: Version 9 (and Version 8)
  • Browser/OS: Firefox on MacOS
  • How did you install Redash: Tested on SaaS and Docker

susodapop avatar Oct 15 '19 21:10 susodapop

Did you select the column before trying to update the formatting?

screenshot-redash-preview netlify com-2019 10 16-12_38_45

Here's what you described and it seems to work: https://redash-preview.netlify.com/queries/231/source#418

One thing we should change is to either:

  1. When no column is picked, mark it as missing. and/or
  2. Pick the first column available as default.

arikfr avatar Oct 16 '19 09:10 arikfr

Strange. I also can't reproduce it anymore using a fresh query. But my original query still doesn't work. I think this is probably a data type issue with the query runner. I've updated the issue above with more details.

susodapop avatar Oct 16 '19 11:10 susodapop

I came across this after searching for the same problem. When I attempt to format the Counter type visualization, the UI controls are completely greyed out and cannot be interacted with. This makes it extremely unuseful with values that represent monetary value or other kinds of numerical data.

I've tried this numerous times on different queries, including creating new queries. The same result every time -- there's no way to control the format of the Counter visualization.

mmercurio avatar Feb 19 '22 19:02 mmercurio