Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph doesn't display on older iPads #1954

Closed
keeshux opened this issue Dec 12, 2016 · 7 comments
Closed

Graph doesn't display on older iPads #1954

keeshux opened this issue Dec 12, 2016 · 7 comments

Comments

@keeshux
Copy link

keeshux commented Dec 12, 2016

I spent a few hours before posting this. My graph performs pretty well on all devices, except older iPads, where it doesn't appear at all. Actually the y-axis seems to update to the new data sets, only the graph isn't being drawn. This applies to both a real device (iPad 2) and simulators (iPad 2, iPad Retina).

Thanks in advance.

@liuxuan30
Copy link
Member

well.. It should have nothing to do with older iPad, just the iOS version and APIs.. And you are the first one to report this.
Before we look into this, you need to debug more and give more info, at least you should be able to post a screenshot, showing that the UIView of your chart is correctly added, having meaningful frame, but nothing rendered.

@keeshux
Copy link
Author

keeshux commented Dec 13, 2016

Sorry Xuan, I erroneously thought I had specified that, surprisingly, it's not an iOS-related issue. In fact the graph works as expected on iPad Air 2 with 9.3 (to name one), and not on an iPad 2 with 9.3 as well. Later I'll post the relevant code bits, I'm not at home now.

@liuxuan30
Copy link
Member

Interesting.. don't forget to add a screenshot for iPad 2. And if you can debug more, please do it, that will help because I don't have iPad 2 (simulator neither).

@keeshux
Copy link
Author

keeshux commented Dec 15, 2016

I narrowed it down. My scenario is that I was using TimeInterval values for the X axis, and strange things happen when X values are so huge and lie within a small range. Here's the relevant code:

let y = [2271590059.0, 3371668096.0, 2128116851.0, 2766080740.0, 2610847501.0, 1444402694.0, 4261313944.0, 2930941047.0, 575994230.0, 1206051462.0]

var entries = [ChartDataEntry]()
let now = Date.timeIntervalSinceReferenceDate
for i in 0..<10 {
    let entry = ChartDataEntry(x: now + Double(i), y: y[i])
    entries.append(entry)
    print(entry)
}
let dataSet = LineChartDataSet(values: entries, label: "foobar")
chart.data = LineChartData(dataSet: dataSet)

Looks fine on iPad Pro:

big_near_xs_ipad_pro

Not quite on iPad Retina:

big_near_xs_ipad_retina

Now, I can use a different X mapping, but it may still be something you want to look into.

@Fedenieto90
Copy link

Fedenieto90 commented Dec 16, 2016

Same happens to me with timestamps on the xAxis. I also have some repeated values that I pass to the xAxis. When there is only one value, it works:

screen shot 2016-12-16 at 5 48 28 pm

But if I have more values, the graph disappears as shown below:
screen shot 2016-12-16 at 5 48 01 pm

@liuxuan30
Copy link
Member

I guess it's related:#1956, #1679? All uses big unix time stamp, and a 32 bit CPU?

@Fedenieto90
Copy link

The three values used for the second chart are:
1449761040
1449761040
1422468000

Notice that two of them are equal, but it shouldn't be a problem. The values are NSTimeIntervals.

@jjatie jjatie closed this as completed Apr 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants