graph - BEMSimpleLineGraph X-Axis Labels not showing for phones newer than iPhone 5 -
i've created line graph using bemsimplelinegraph pod, but, life of me, can't figure out why x-axis labels aren't showing on device newer iphone 5.
edit: should mention enablexaxislabel = yes default.
here code lay out graph:
#import "weightchartcell.h" @implementation weightchartcell @synthesize viewcell, arrayplots, mygraph, labelweighthistory; - (void)awakefromnib { } - (void)layoutsubviews { [super layoutsubviews]; float width = viewcell.bounds.size.width; self.mygraph = [[bemsimplelinegraphview alloc] initwithframe:cgrectmake(-20, 40, width+20, 150.0)]; self.mygraph.datasource = self; self.mygraph.delegate = self; self.mygraph.colortop = [uicolor whitecolor]; self.mygraph.colorbottom = [uicolor colorwithred:190/255.0 green:218/255.0 blue:246/255.0 alpha:1]; self.mygraph.colorline = [uicolor colorwithred:124/255.0 green:181/255.0 blue:236/255.0 alpha:1]; self.mygraph.colorpoint = [uicolor colorwithred:124/255.0 green:181/255.0 blue:236/255.0 alpha:1]; self.mygraph.widthline = 3; self.mygraph.sizepoint = 10; self.mygraph.alwaysdisplaydots = yes; self.mygraph.colorxaxislabel = [uicolor lightgraycolor]; self.mygraph.colorbackgroundxaxis = [uicolor clearcolor]; self.mygraph.enableyaxislabel = yes; self.mygraph.coloryaxislabel = [uicolor clearcolor]; self.mygraph.colorbackgroundyaxis = [uicolor clearcolor]; self.mygraph.enablereferenceyaxislines = yes; self.mygraph.colorreferencelines = [uicolor lightgraycolor]; self.mygraph.enableleftreferenceaxisframeline = no; self.mygraph.enablepopupreport = yes; self.mygraph.enablereferenceaxisframe = yes; [viewcell addsubview:self.mygraph]; labelweighthistory.text = nslocalizedstring(@"progress", nil); [self sendsubviewtoback:self.mygraph]; } - (nsinteger)numberofpointsinlinegraph:(bemsimplelinegraphview *)graph { return [arrayplots count]; } - (nsinteger)numberofgapsbetweenlabelsonlinegraph:(bemsimplelinegraphview *)graph { return 1; } - (nsstring *)linegraph:(bemsimplelinegraphview *)graph labelonxaxisforindex:(nsinteger)index { nsstring *datestr = [[arrayplots objectatindex:index] valueforkey:@"created_at"]; // convert string date object nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"yyyy-mm-dd"]; nsdate *date = [dateformat datefromstring:datestr]; // convert date object desired output format [dateformat setdateformat:@"d.mmm"]; datestr = [dateformat stringfromdate:date]; return datestr; } - (cgfloat)linegraph:(bemsimplelinegraphview *)graph valueforpointatindex:(nsinteger)index { nsinteger ypoint = [[[arrayplots objectatindex:index] valueforkey:@"weight"] floatvalue]; return ypoint; } @end
it comes out expected on iphone 5 device , iphone 5 simulator:
but don't show @ on newer iphone 5. iphone 5s:
please see this issue on github. contains temporary fix while work on official fix.
thanks!
Comments
Post a Comment