ChartsOrg / Charts

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

Fixed: Pie Chart percentage does not display on demo project #5143

Open leson1106 opened 6 months ago

leson1106 commented 6 months ago

Issue Link :link:

I didn't see any issues relevant to this. However, it's happening on both Swift and Objective-c targets in the demo project. The Pie Chart percentage doesn't show up even DefaultValueFormatter was set.

Simulator Screenshot - iPhone 14 - 2024-01-13 at 16 08 37

Goals Soccer ⚽

Make Pie Chart percentage show up.

Implementation Details :construction:

Move NumberFormatter constructor and setValueFormatter(formatter:) function below chartView.data = data. I saw on the didSet implementation of ChartData, that each data in ChartData will be re-assigned to defaultValueFormatter if the valueFormatter of each data is a DefaultValueFormatter subtype. So, no matter what formatter is set, it will be replaced.

Testing Details :mag:

I've tested on both Swift and Objective-c targets. It works as expected.

Simulator Screenshot - iPhone 14 - 2024-01-13 at 16 20 19

Simulator Screenshot - iPhone 14 - 2024-01-13 at 16 20 33