I'm able to generate the X Axis for one specific month (i.e. February).
func generateDateAxisValues(_ month: Int, year: Int) -> [ChartAxisValueDate] {
let date = dateWithComponents(1, month, year)
let calendar = Calendar.current
let monthDays = calendar.range(of: .day, in: .month, for: date)!
let arr = CountableRange<Int>(monthDays)
return arr.map {day in
let date = dateWithComponents(day, month, year)
let axisValue = ChartAxisValueDate(date: date, formatter: displayFormatter, labelSettings: labelSettings)
axisValue.hidden = !(day % 5 == 0)
return axisValue
}
}
But I want to stretch the X Axis values across the past 30 days; not just one individual month. How can you generate X Axis values for the past 30 days?