swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular
https://swimlane.github.io/ngx-charts/
MIT License
4.3k stars 1.15k forks source link

Advance Pie Chart - Excessive rounding of biggest numbers #628

Open Ramso-dev opened 7 years ago

Ramso-dev commented 7 years ago

I'm submitting a ... (check one with "x")

[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior I have the following data set: export var data = [{"name":"Remaining memory","value":14.507041931152344},{"name":"quizmasterdb-3-n8bnn","value":0.047496795654296875},{"name":"jenkins-6-5o01y","value":2.0730514526367188}]

My advance Pie Chart shows the following: Total (GiB): 17 Remaining memory:15 quizmasterdb-3-n8bnn: 0,05 jenkins-6-5o01y: 2,07

Expected behavior

I notice here that the smallest numbers are being rounded with 2 decimals as expected but the biggest one and the total are being excesively rounded (Up to 0,5GiB). And thats too much loss of precision. Should be like this: Total (GiB): 16,63 -> better precision !! Remaining memory: 14,51 -> better precision !! quizmasterdb-3-n8bnn: 0,05 -> good enough jenkins-6-5o01y: 2,07 -> good enough

Reproduction of the problem Plunker: https://plnkr.co/edit/DOLe6qFvQGJSH37BCATe?p=preview

What is the motivation / use case for changing the behavior? I need a better precision for memory monitoring.

LucasFrecia commented 5 years ago

@Ramso-dev did you manage to work around this?

Samuel-Oliveira commented 4 years ago

+1

Ramso-dev commented 4 years ago

Hi! I was able to write a workaround but sadly the project I was working on at that time got canceled and I have no access to that code. I remember it was kinda easy to do, at least for my needs. There was some lines where the value was being rounded somewhere in the legend or the pie-chart component if i remember well but can't help you further.