X-axis values changed when setVisibleXRangeMaximum is used
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I hope the bug title makes sense, but this is a fairly simple issue to describe. I'm using Charts 3.0.1 via CocoaPods.
Sample code can be found here - https://github.com/fongd/ChartsVisibleXRangeMaxTest/blob/master/ChartsVisibleXRangeMax/ViewController.swift
Basically, when setVisibleXRangeMaximum is used to limit the number of visible data points in the viewport, the X-axis values are needlessly changed such that the data circles no longer align.
Here is a screenshot of a line chart created without using setVisibleXRangeMaximum:

And here is a screenshot of a line chart that uses setVisibleXRangeMaximum:

In the latter, the X-axis values seem to be forced to increment by 0.7, I'm not sure how/where this needs to be changed. I haven't found any mention in the docs about this. FWIW, Charts 2.2.x did not exhibit this behaviour.
Contributor guide
Research direction
Start with the linked ChartsVisibleXRangeMaxTest sample, especially ViewController.swift, and reproduce the difference between Charts 3.0.1 with and without setVisibleXRangeMaximum. Trace how the visible range affects X-axis labels and compare the rendered labels with the data circles. Done means the axis values remain aligned with the plotted points when the maximum visible range is used, while preserving the existing behavior otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- data-visualization, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100