ios - CorePlot: xAxis NSDateFormatter trouble -


i'm making app coreplot , trying labels along xaxis read 12pm , 1pm, 2pm, etc. have implemented nsdateformatter xaxis.label formatter.

problem is, intervals appear in seconds (see pic below) need them in hours.

enter image description here

i tried fix making xaxis.majorintervallength 3600, makes graph this:

enter image description here

the tick stil there, they're placed 3600 placed apart, if makes sense. here code:

cptxyaxisset *faxisset = (cptxyaxisset *)self.graph.axisset;      faxisset.xaxis.title = @"time";     faxisset.xaxis.titletextstyle = textstyle;     faxisset.xaxis.titleoffset = 30.0f;     faxisset.xaxis.axislinestyle = axislinestyle;     faxisset.xaxis.majorticklinestyle = axislinestyle;     faxisset.xaxis.minorticklinestyle = axislinestyle;     faxisset.xaxis.labeltextstyle = textstyle;     faxisset.xaxis.labeloffset = 3.0f;     faxisset.xaxis.majorintervallength = cptdecimalfromfloat(3600.0f);     faxisset.xaxis.minorticksperinterval = 1;     faxisset.xaxis.minorticklength = 5.0f;     faxisset.xaxis.majorticklength = 7.0f; nsstring *dats1 = @"16";     nsdateformatter *dateformatter3 = [[[nsdateformatter alloc] init] autorelease];     [dateformatter3 setdatestyle:nsdateformattermediumstyle];     [dateformatter3 setdateformat:@"hh:mm:ss a"];     cpttimeformatter *timeformatter  =   [[cpttimeformatter alloc]initwithdateformatter:dateformatter3];     timeformatter.referencedate =   [dateformatter3 datefromstring:dats1];     faxisset.xaxis.labelformatter    =   timeformatter; 

basically, have every other tick mark read hours them remain same distance apart.

i'd appreciate help, thanks!

check out cptcalendarformatter. formats dates unit intervals (e.g., hours) rather time value cpttimeformatter.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -