ah gotcha. but I think that is a bug in grafana, not sure why it takes over when decimal is on auto.
1 Like
Thanks for the reply. Seems so. The problem is most probably with the valueFormat function. not an expert on JavaScript.
1 Like
thanks for the tips. the data is basically there. it just does not show up in certain visualization. the search for decimal and removal of ‘auto’ did the trick.
1 Like
tested it in console log and I think you are correct
decimals is 0
Added a bug
opened 08:58PM - 04 Aug 22 UTC
closed 02:42PM - 19 Aug 22 UTC
type/bug
area/grafana/data
**What happened**:
negative decimal numbers' decimals get dropped
**What you… expected to happen**:
i expect the auto decimal setting to respect my numbers :)
**How to reproduce it (as minimally and precisely as possible)**:
using microsoft sql server as data source and fake data
```
select getdate() time, -27.5 value
```
The value is rounded to -27 with decimal set to auto. if one changes it to 1 then it works. but auto should respect my numbers.
Self debugging getDecimalsForValue in dev console.
![image](https://user-images.githubusercontent.com/900951/182951049-d08ab46d-7547-40ed-8855-957ece665b0e.png)
The issue is here
https://github.com/grafana/grafana/blob/2107652c3fdeebf499c360795c219f68ef47b65f/packages/grafana-data/src/valueFormats/valueFormats.ts#L82
getDecimalsForValue function. Also looks like it is missing a unit test for neg values.
**Anything else we need to know?**:
**Environment**:
- Grafana version: 9.0.3
- Data source type & version: inline csv
- OS Grafana is installed on: Windows
- User OS & Browser: Windows/Chrome
- Grafana plugins: infinity
- Others:
seems like it is now fixed
grafana:main
← grafana:joao_silva/decimal-fix
opened 02:18PM - 19 Aug 22 UTC
**What this PR does / why we need it**:
If you leave the "Decimals" option se… t to auto, negative and positive values behave differently:
![183403766-f934d171-1afd-4b58-b442-1ff17219f648](https://user-images.githubusercontent.com/100691367/185638462-03d35308-1fb7-4137-85f5-9df8f4528755.png)
This PR makes sure that there is no difference between how those are displayed and adds some tests for those cases.
**Which issue(s) this PR fixes**:
Fixes #53331