2015-06-04 6 views
5

मैंने BEMSimpleLineGraph Pod का उपयोग करके एक लाइन ग्राफ़ बनाया है, लेकिन, मेरे जीवन के लिए, यह पता नहीं लगा सकता कि एक्स-एक्सिस लेबल क्यों नहीं दिख रहे हैं किसी भी डिवाइस पर नया आईफोन 5.BEMSimpleLineGraph X-Axis लेबल आईफोन 5 से नए फोन के लिए नहीं दिख रहे हैं

संपादित करें: मुझे डिफ़ॉल्ट रूप से enableXAxisLabel = YES का उल्लेख करना चाहिए। iPhone 5

लेकिन वे दिखाई नहीं देती हैं:

#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 to date object 
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; 
    [dateFormat setDateFormat:@"yyyy-MM-dd"]; 
    NSDate *date = [dateFormat dateFromString:dateStr]; 

    // Convert date object to 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 

यह एक iPhone 5 डिवाइस और iPhone 5 सिम्युलेटर पर उम्मीद के रूप में बाहर आता है:

यहाँ ग्राफ बाहर बिछाने के लिए कोड है आईफोन 5 के मुकाबले कुछ भी नया है। यह आईफोन 5 एस के लिए है: iPhone 5s

+1

मुझे एक ही समस्या है। ऐसा लगता है कि आईफोन 5 और यहां तक ​​कि आईफोन 6 और 6+ पर ठीक काम करता है लेकिन आईफोन 5 एस – mikemike396

उत्तर

5

कृपया this issue on github देखें। जब हम आधिकारिक फिक्स पर काम करते हैं तो इसमें एक अस्थायी फिक्स होता है।

धन्यवाद!

+0

बहुत बढ़िया नहीं है। अस्थायी फिक्स के लिए धन्यवाद! – Chris

संबंधित मुद्दे