From c930f6a69bc6f47bf8ee7bfd1e3c37978e78e72a Mon Sep 17 00:00:00 2001 From: kevinzhow Date: Sat, 26 Apr 2014 17:37:14 +0800 Subject: [PATCH] Fix Bar chart x label position --- PNChart/PNBarChart/PNBarChart.m | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/PNChart/PNBarChart/PNBarChart.m b/PNChart/PNBarChart/PNBarChart.m index 0b10f55a..90b5566b 100644 --- a/PNChart/PNBarChart/PNBarChart.m +++ b/PNChart/PNBarChart/PNBarChart.m @@ -123,14 +123,8 @@ - (void)strokeChart label.textColor = _labelTextColor; [label setTextAlignment:NSTextAlignmentCenter]; label.text = labelText; - NSLog(@"Label text is %@",labelText); [label sizeToFit]; - CGFloat labelXPosition; - if (label.frame.size.width < _xLabelWidth) { - labelXPosition = (index * _xLabelWidth + _chartMargin + _xLabelWidth /2.0 ); - }else{ - labelXPosition = (index * _xLabelWidth + _chartMargin + label.frame.size.width /2.0 ); - } + CGFloat labelXPosition = (index * _xLabelWidth + _chartMargin + _xLabelWidth /2.0 ); label.center = CGPointMake(labelXPosition, self.frame.size.height - xLabelHeight - _chartMargin + label.frame.size.height /2.0 + _labelMarginTop);