ChartsOrg / ChartsOrg/Charts

Centering XAxis Labels to each integer point.

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

Description

* [x ] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).

## What did you do?

I created a BarChartView using UIViewRepresentable. Then I created an value index mapper for xAxis like so:
`xAxis.valueFormatter = IndexAxisValueFormatter(values: xAxisLabels)`
xAxisLabels is just an array of strings.

## What did you expect to happen?

I expected the labels to be centered in each bar.

## What happened instead?

Instead the labels were drawn in a seemingly random position.
![IMG_9594](https://user-images.githubusercontent.com/21320531/115972936-76c31e00-a51f-11eb-8403-04c83bbdff9a.jpg)

## Charts Environment

**Charts version/Branch/Commit Number:**
**Xcode version: Version 12.4 (12D4e)**
**Swift version: 5.3.3**
**Platform(s) running Charts: iPhone**
**macOS version running Xcode: 11.2.3**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.