ChartsOrg / ChartsOrg/Charts

add a padding on the xAxis, only on the values not on the Graph

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

I am trying to find a solution to add a padding on the xAxis.

I DO NOT WANT TO CHANGE ANYTHING OF THE GRAPH ITSELF

My view looks like this :
![Simulator Screen Shot - iPhone 11 Pro Max - 2020-06-30 at 14 08 23](https://user-images.githubusercontent.com/39704075/86124635-c2fa2900-badb-11ea-9497-6bae332cf8a9.png)

As you can see the dates values are out of the graph. I would like to do recenter the the values on this axis.

When I call `chartView.xAxis.avoidFirstLastClippingEnabled = true` it does the work on one sidesuch as follow:
![Simulator Screen Shot - iPhone 11 Pro Max - 2020-06-30 at 14 17 30](https://user-images.githubusercontent.com/39704075/86125207-8c70de00-badc-11ea-8fc8-35869e238b61.png)

However it's not effective on the other side, plus the values do not have the right spacing anymore.

What could some my problem is to have an equivalent of this, only effective for those dates :

`chartView.setExtraOffsets(left: 36, top: 0, right: 36, bottom: 40)
`

I would be happy hear any kind of solution I am getting desperate on this.
Thanks for helping

Contributor guide

Open the contributing guide

Research direction

Start by tracing the xAxis.avoidFirstLastClippingEnabled behavior and chartView.setExtraOffsets usage in the chart configuration. Reproduce the reported date-label clipping on an iPhone-sized chart, then determine whether axis-only padding can preserve the graph bounds and label spacing. Done means the x-axis values are centered and spaced correctly without changing the plotted graph.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.