Swift Line Charts

(Bruce Q Simmons) #1


I am trying to manipulate some core data that I have stored and display it in a line chart. I have it working (for the most part) but now want to only display (chart) the last 10 items in my core data. I have my X and Y stored in var lineChartEntry = [ChartDataEntry]() which is populated from my do loop reading core.

I have tried things like .suffix which works in debug mode but the slice errors when I feed it to LineChartDataSet(values: lineChartEntry, label: "Recorded Weight").

Ideas would be well appreciated!

(Happy Human Pointer) #2


Can you tell us what error you are getting? I assume it is along the lines of Cannot convert value of type X to type Y. However, it is difficult to help us when the only relevant information is: