Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions PNChart/PNLineChart.m
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ - (void)setXLabels:(NSArray *)xLabels withWidth:(CGFloat)width
for (int index = 0; index < xLabels.count; index++) {
labelText = xLabels[index];

NSInteger x = (index * _xLabelWidth + _chartMarginLeft + _xLabelWidth /2.0 );
NSInteger x = (index * _xLabelWidth + _chartMarginLeft );
NSInteger y = _chartMarginBottom + _chartCavanHeight;

PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(x, y, (NSInteger)_xLabelWidth, (NSInteger)_chartMarginBottom)];
Expand Down Expand Up @@ -708,15 +708,15 @@ - (void)drawRect:(CGRect)rect
// draw x axis separator
CGPoint point;
for (NSUInteger i = 0; i < [self.xLabels count]; i++) {
point = CGPointMake(2 * _chartMarginLeft + (i * _xLabelWidth), _chartMarginBottom + _chartCavanHeight);
point = CGPointMake(_chartMarginLeft + ( i * _xLabelWidth ) + _xLabelWidth / 2, _chartMarginBottom + _chartCavanHeight);
CGContextMoveToPoint(ctx, point.x, point.y - 2);
CGContextAddLineToPoint(ctx, point.x, point.y);
CGContextStrokePath(ctx);
}

// draw y axis separator
CGFloat yStepHeight = _chartCavanHeight / _yLabelNum;
for (NSUInteger i = 0; i < [self.xLabels count]; i++) {
for (NSUInteger i = 0; i < self.yLabelNum; i++) {
point = CGPointMake(_chartMarginBottom + yAxisOffset, (_chartCavanHeight - i * yStepHeight + _yLabelHeight / 2));
CGContextMoveToPoint(ctx, point.x, point.y);
CGContextAddLineToPoint(ctx, point.x + 2, point.y);
Expand Down