ChartsOrg / ChartsOrg/Charts

X-axis values changed when setVisibleXRangeMaximum is used

Open
#2,028 6 comments 0 reactions 0 assignees View on GitHub
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:

![nosetvisiblexrangemaximum](https://cloud.githubusercontent.com/assets/241671/21585433/fa28edb2-d08d-11e6-831d-b9911ea9df2a.png)

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

![setvisiblexrangemaximum](https://cloud.githubusercontent.com/assets/241671/21585435/feb83ab8-d08d-11e6-801f-6f95cb6d3122.png)

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.