-2

I am loading data points from core-data, and using it for x, y values in a line chart using the Charts Cocoapods module. For some reason, the data and lines do not get drawn sometimes, even though I am getting good data from core data every time.

D. Pratt
  • 444
  • 8
  • 15

1 Answers1

0

The issue turned out to be the fact that core data does not sort itself when returning the NSSets used to pull data out of, and Charts requires x values to be sequential. The solution, sort my data before putting it into the chart.

Hope this helps someone!

D. Pratt
  • 444
  • 8
  • 15
  • NSSets are, by definition, not sorted. – Magnas Sep 01 '18 at 19:45
  • That’s true, the issue is the Charts API can’t handle out of order data, which means you need to manually sort before plugging it into the chart. The Charts pod doesn’t have documentation for iOS, thus the post to help anyone else running into the issue. This has nothing to do with the fact NSSET’s are not ordered. – D. Pratt Sep 01 '18 at 19:48