ChartsOrg / ChartsOrg/Charts

XAxis labels overlap in Charts 3.0

Open
#1,969 13 comments 14 reactions 0 assignees View on GitHub
★★ bug
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

In charts 2.x, the xAxis adjusted it's labelCount based on the width of the widest label. Here is an example from the 2.x demo:

![charts 2](https://cloud.githubusercontent.com/assets/5270669/21265912/bbe6f8ec-c371-11e6-93c7-481a7eef8bdf.png)

However, in Charts 3, the labelWidth seems to be disregarded (computeAxis does not even consider it) when calculating the number of entries to show on the axis. Anything above 10 (about) characters has a chance to eventually get overlapped. Here's the same example, from Charts 3 demo:

![charts 3](https://cloud.githubusercontent.com/assets/5270669/21265954/ec104848-c371-11e6-9df0-217e8f4d56f6.png)

This is a major regression for us from 2x. I've looked at the code and here is what I found:

XAxisRender.computeAxisValues calls super.computeAxisValues first, then calls computeSize. In my opinion, the result of computeSize should be an input to computeAxisValues and would need to be called first.

However modifying the AxisRendererBase.computeAxisValues to consider the labelWidth is beyond my comprehension level at this time.

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.