ChartsOrg / ChartsOrg/Charts

Fail removing decimals values in barchart

Open
#4,934 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

## What did you do?

Put labels into Barchart without decimals

## What did you expect to happen?

In old versions of Charts & Xcode it works correctly

## What happened instead?

With Charts 4.1.0 and Xcode 14 this code doesn't get to put off the decimals. Before it worked fine...
`let formatter = NumberFormatter()
formatter.numberStyle = .none
formatter.maximumFractionDigits = 0
formatter.multiplier = 1.0
chartDataSet.valueFormatter = DefaultValueFormatter(formatter: formatter)
let chartData = BarChartData(dataSet: chartDataSet)`

[image](http://www.priminet.es/descargas/decimals.png)
## Charts Environment

**Charts version/Branch/Commit Number: 4.1.0**
**Xcode version: 14.0**
**Swift version: 5.7**
**Platform(s) running Charts: IOS 16**
**macOS version running Xcode: 12.6**

Contributor guide

Open the contributing guide

Research direction

Start with DefaultValueFormatter, NumberFormatter, chartDataSet.valueFormatter, and BarChartData in the reported snippet, then reproduce the behavior with Charts 4.1.0 on the stated Swift and Xcode versions. Trace how bar values are formatted and confirm that setting maximumFractionDigits to 0 removes decimal labels without breaking other value formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.