ChartsOrg / ChartsOrg/Charts

StackedBarChart only using rightAxis add extra padding

Open
#4,799 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

ℹ When using the Charts-Demo-iOS code for the `StackedBarChart` when changing the enabling of the `leftAxis` and `rightAxis` adds extra padding to the bottom of the chart.

With the default

```
let leftAxis = chartView.leftAxis
leftAxis.valueFormatter = DefaultAxisValueFormatter(formatter: formatter)
leftAxis.axisMinimum = 0

chartView.rightAxis.enabled = false
```

`StackedBarChart` appears as expected

![Simulator Screen Shot - iPhone 13 Pro Max - 2022-03-24 at 14 53 08](https://user-images.githubusercontent.com/4707821/159990414-31c5d5f8-eb9d-487e-b3ee-1e5aee2c1ece.png)

However when revering which axis to display:

```
let rightAxis = chartView.rightAxis
rightAxis.valueFormatter = DefaultAxisValueFormatter(formatter: formatter)
rightAxis.axisMinimum = 0

chartView.leftAxis.enabled = false
```

There is extra padding on the bottom of the `StackedBarChart`

![Simulator Screen Shot - iPhone 13 Pro Max - 2022-03-24 at 14 52 47](https://user-images.githubusercontent.com/4707821/159991178-c4d8039c-c1ac-45a4-94bb-c3d75d52865f.png)

ℹ Changing between using the `leftAxis` and the `rightAxis` should not have the shown effect.

**Charts (3.6.0)**
**Xcode version: 13.3**
**Swift version: 5**
**macOS version running Xcode: 12.3**

Contributor guide

Open the contributing guide

Research direction

Start with the Charts-Demo-iOS StackedBarChart example and reproduce the two configurations shown in the issue: leftAxis enabled versus rightAxis enabled. Compare the resulting bottom padding and trace the chart layout behavior associated with axis visibility. Done means switching between the axes no longer changes the chart's bottom padding unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
data-visualization, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.