ChartsOrg / ChartsOrg/Charts

Y axis labels improperly sized causing labels to be cut off in some cases

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

Description

Y axis labels (such as leftAxis) are sometimes cut off (horizontally). This is due to a bug in YAxis.swift. The current code takes the longest label string, where length is determined in terms of characters, and uses its size to determine the amount of width allocated to y axis labels. In some cases, such as is often the case with custom fonts, there are multiple labels of the same number of characters, but where one of them may take up more screen space than the other.

* [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?

Displayed Y axis labels on the left axis

## What did you expect to happen?

I expected that they would not be clipped, but rather sized for the largest label.

## What happened instead?

They are not always sized for the largest label, which results in sometimes clipping part of the label.

## Charts Environment

**Charts version/Branch/Commit Number: 85cfba96eb3492124d645ac0901b66f0cb266267**
**Xcode version: 13.2.1**
**Swift version: 5.5**
**Platform(s) running Charts: iPadOS 15.1**
**macOS version running Xcode: 12.2.1**

## Demo Project

n/a

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.