Specific month formatting of SChartDateTimeAxis


#1

Hi - I’m evaluating the chart package on iOS and want to know how I can format the y-date axis like below. I understand how to use NSDateFormatter…

<…chart…>

SEP OCT NOV DEC JAN  FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC JAN
        2012                  2013                 2013                 2013                 2013                  2014

Best regards,
Micke De Geer


#2

Hi Mick,

I think there are a few approaches you could follow here.

  1. You could add an extra X-axis formatted to show the years rather than months. You could then manually set the range of this axis to the same range as your primary axis upon render.

2) You might have some luck using the sChart:alterTickMark:beforeAddingToAxis: to alter certain tick mark labels, placing the year underneath them.

  1. You could manually add labels below your X axis. You could then use the axes data mapping methods available on the SChartAxis to find out the pixel location for a specific data values. Each time the chart pans, you could manage your labels, moving them with the axis, and removing them when the data value has panned out of range.

Best regards,
Jan Akerman