Skip to content

Commit

Permalink
fix drawing out of bound negative value axis labels issue
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxuan30 committed Jun 30, 2015
1 parent 6e0256e commit 226221c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Charts/Classes/Renderers/ChartYAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ public class ChartYAxisRenderer: ChartAxisRendererBase
pt.x = fixedPosition
pt.y += offset

if (pt.y > viewPortHandler.contentRect.height)
{
continue
}

ChartUtils.drawText(context: context, text: text, point: pt, align: textAlign, attributes: [NSFontAttributeName: labelFont, NSForegroundColorAttributeName: labelTextColor])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public class ChartYAxisRendererHorizontalBarChart: ChartYAxisRenderer
return
}

if (positions[i].x < viewPortHandler.contentRect.origin.x)
{
continue
}

ChartUtils.drawText(context: context, text: text, point: CGPoint(x: positions[i].x, y: fixedPosition - offset), align: .Center, attributes: [NSFontAttributeName: labelFont, NSForegroundColorAttributeName: labelTextColor])
}
}
Expand Down

0 comments on commit 226221c

Please sign in to comment.