iphone - Core plot : Unable to set date/minute in x-axis -


am breaking head on since yesterday , can't work! plain x-axis line, y-axis line (not ticks or labels!) , chart title! please help! seems simple, elusive!

am plotting last 5 values of memory usage of server. values each minute approximately (sometimes, it's 2 minutes once). example, 1 set of last 5 values might want show this:

date (vs)  memory usage (bytes)

2013-05-02 11:50:33 +0000 - 157888512.000000

2013-05-02 11:51:33 +0000 - 157839360.000000

2013-05-02 11:52:14 +0000 - 157888512.000000

2013-05-02 11:56:36 +0000 - 157863936.000000

2013-05-02 11:57:48 +0000 - 157888512.000000

i refresh graph every minute. 

the 'numberforplot', 'numberofrecordsforplot' seems called, no plotting seen/visible in graph.

my graph initialized method :

-(void) initializegraph {      nslog(@"view_visualizer.initializegraph");      if ((self.graph == nil) || (self.graph == null)) {               self.graphhostview = [(cptgraphhostingview *) [cptgraphhostingview alloc] initwithframe:self.view.bounds];          self.graph = [[cptxygraph alloc] initwithframe:self.graphhostview.bounds];          graph.paddingleft   = 10.0;          graph.paddingright  = 10.0;          graph.paddingtop    = 10.0;          graph.paddingbottom = 10.0;          graph.title = @"processor usage";           cptxyplotspace *plotspace = (cptxyplotspace *) graph.defaultplotspace;          nstimeinterval xlow = 0.0f;          nstimeinterval onemin = 60.0f;          plotspace.xrange = [cptplotrange plotrangewithlocation:cptdecimalfromfloat(xlow)                              length:cptdecimalfromfloat(onemin*6.0)];          plotspace.yrange = [cptplotrange plotrangewithlocation:cptdecimalfromfloat(0)                                                      length:cptdecimalfromfloat(6)];            // plotting style set line plots          cptmutablelinestyle *linestyle = [cptmutablelinestyle linestyle];          linestyle.linecolor = [cptcolor blackcolor];          linestyle.linewidth = 2.0f;            nstimeinterval onemin = 60.0f;          cptxyaxisset *axisset = (cptxyaxisset *) self.graph.axisset;          axisset.xaxis.majorintervallength = cptdecimalfromfloat(onemin);          axisset.xaxis.minorticksperinterval = 0;          axisset.xaxis.majorticklinestyle = linestyle;          axisset.xaxis.majorticklength = 7.0f;          //axisset.yaxis.orthogonalcoordinatedecimal = cptdecimalfromfloat(onemin);        //axisset.xaxis.majorticklinestyle = linestyle;          //axisset.xaxis.minorticklinestyle = linestyle;          //axisset.xaxis.axislinestyle = linestyle;          //axisset.xaxis.minorticklength = 5.0f;          //axisset.xaxis.majorticklength = 5.0f;          //axisset.xaxis.labeloffset = 3.0f;            nsdateformatter *dateformatter = [[nsdateformatter alloc] init];          // example date format : 2013-05-02 11:23:16 +0000          [dateformatter setdateformat:@"yyyy-mm-dd hh:mm:ss z"];          //dateformatter.datestyle = kcfdateformattershortstyle;          //dateformatter.timezone = [nstimezone timezoneforsecondsfromgmt:0];          cpttimeformatter *timeformatter = [[cpttimeformatter alloc] initwithdateformatter:dateformatter];          timeformatter.referencedate = [nsdate datewithtimeintervalsince1970:([[nsdate date] timeintervalsince1970] - (6*onemin))];          axisset.xaxis.labelformatter = timeformatter;            //axisset.yaxis.majorintervallength = [nsdecimal decimalnumberwithstring:@"5"];          //axisset.yaxis.minorticksperinterval = 4;          //axisset.yaxis.majorticklinestyle = linestyle;          //axisset.yaxis.minorticklinestyle = linestyle;          //axisset.yaxis.axislinestyle = linestyle;          //axisset.yaxis.minorticklength = 5.0f;          //axisset.yaxis.majorticklength = 5.0f;          //axisset.yaxis.labeloffset = 3.0f;            cptscatterplot *xsquaredplot = [[cptscatterplot alloc]                                      initwithframe:self.graph.bounds];          xsquaredplot.identifier = @"x squared plot";          cptmutablelinestyle *datalinestyle = [cptmutablelinestyle linestyle];          datalinestyle.linewidth = 1.0f;          datalinestyle.linecolor = [cptcolor redcolor];          xsquaredplot.datalinestyle = datalinestyle;          xsquaredplot.datasource = self;           [self.graph addplot:xsquaredplot];           self.graphhostview.allowpinchscaling = no;          self.graphhostview.hostedgraph = self.graph;          [self.view addsubview:self.graphhostview];      } }    #pragma mark - cptplotdatasource methods  -(nsuinteger)numberofrecordsforplot:(cptplot *)plot {      return [dicthealth count];  }  -(nsnumber *) numberforplot:(cptplot *)plot                    field:(nsuinteger)fieldenum              recordindex:(nsuinteger)index {      health_memuse *healthdata = (health_memuse *) [dicthealth objectforkey:                                                          [self.arrayhealthkeys objectatindex:index]];       if ( fieldenum == cptscatterplotfieldx ) {          return [nsdecimalnumber numberwithfloat:[healthdata.currdate timeintervalsince1970]];          /* return [nsnumber numberwithdouble:([healthdata.currdate timeintervalsince1970] + [[nstimezone localtimezone] secondsfromgmt])];     */      } else {          nslog(@"plot memuse %f on date %@ index %d",            healthdata.memuse, healthdata.currdate, index);          return [nsnumber numberwithfloat:(healthdata.memuse/(1024*1024*1024))]; // convert bytes gb      } } 

please help! realize might wrong in setting range axes, tried googl'ing, stackoverflow'ing , tried several variations it, in vain.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -