ChartsOrg / Charts

Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Apache License 2.0
27.59k stars 6k forks source link

Percentage Data Problem #4599

Open mdm84 opened 3 years ago

mdm84 commented 3 years ago

Simulator Screen Shot - iPhone 12 Pro - 2021-03-10 at 18 44 28

ℹ Please fill out this template when filing an issue. All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.

Per our *CONTRIBUTING guidelines, we use GitHub for bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag ios-charts.

Please remove this line and everything above it before submitting.

What did you do?

ℹ I want to show the percentage Label on my PieChart. This is my code let formatter = NumberFormatter() formatter.numberStyle = .percent formatter.maximumFractionDigits = 1 formatter.multiplier = 1 formatter.percentSymbol = " %" let bvform = DefaultValueFormatter(formatter: formatter) dataset.setValueFormatter(bvform) in the version 3.6.0 worked in right way.

What did you expect to happen?

ℹ with this array in input [1505, 208] I would show 87,8% and 12,2%

What happened instead?

ℹ I show this value in the piechart = 87.85755983654407 and 12.142440163455925

Charts Environment

Charts version/Branch/Commit Number: 4.0.1 Xcode version: 12.4 Swift version: 5.3 Platform(s) running Charts: iOS macOS version running Xcode: 11.2.1

claywatkins commented 3 years ago

I'm also having this same issue, if you find a solution or if anyone can fix this it would be greatly appreciated.

kyuilisworking commented 3 years ago

Is this still not fixed? Right now it seems like the formatters are being completely ignored.

thepoortom commented 3 years ago

Same issue. Please, take a look at @scottljohnson workaround here: https://github.com/danielgindi/Charts/issues/4690