Skip to content

Commit

Permalink
Fix Bar chart x label position
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinzhow committed Apr 26, 2014
1 parent 1823eec commit c930f6a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions PNChart/PNBarChart/PNBarChart.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c930f6a

Please sign in to comment.