question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pie chart chart show incorrect percentage

See original GitHub issue

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

Don’t round values in Pie grid chart so much, sample: data = [ { name: ‘first’, value: 1546 }, { name: ‘second’, value: 381 }, { name: ‘next’, value: 38 } ];

it will show 80%, 20%, 2% that in summarize => 102%

Expected behavior

Must be “78.7%”, “19.4%”, “1.9%”

Reproduction of the problem

Use sample data above

What is the motivation / use case for changing the behavior?

It’s weird for user to see values that in total will be more than 100 percent

Please tell us about your environment:

  • ngx-charts version: 4.0.3
  • Angular version: 2.4.5
  • Browser: [ Chrome ]
  • Language: [TypeScript 2.0.3]

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:35 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
wzc570738205commented, Dec 27, 2018

@yuveliremil This issue solves the problem of percentageFormatting not working; it can be done now, and for now, it works.

.html
 <ngx-charts-advanced-pie-chart
                    [results]="dashboardData"
                    [label]="label"
                    [percentageFormatting]="percentageFormatting"
                   >
 </ngx-charts-advanced-pie-chart>
.ts
 percentageFormatting(c) {
    return Math.round(c);
  }
3reactions
fchiumeocommented, Oct 4, 2018

with animations=true not working decimal in percent

Read more comments on GitHub >

github_iconTop Results From Across the Web

pie chart does not reflect correct percentage
Hi, You need to build a pie chart where 1 component is the achieved value and the second is a calculated value of...
Read more >
Pie Chart Rounding in Excel - Peltier Tech
The phenomenon is that Excel will place incorrect percentage labels onto the wedges of a pie chart, simply to ensure that the displayed ......
Read more >
Piechart does not reflect the correct percentage-Showing 100%
My pie chart is linked to a cell that says 25% complete. The pie chart says 25% but has (100%) next to it...
Read more >
Pie charts with wrong percentages... | MrExcel Message Board
I have a pie chart with 4 categories, and the numbers in each category 2, 35, 95 and 12 respectively; however, when asked...
Read more >
Pie chart displays incorrect percentage n… - Apple Community
With pie charts, the segment labels can be the numeric values or those values shown as a percentage (not percentile) of the total....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found