Skip to content

Commit

Permalink
Clip drawing area of limit lines when !isDrawLimitLinesBehindDataEnabled
Browse files Browse the repository at this point in the history
(Closes #1052)
  • Loading branch information
danielgindi committed May 22, 2016
1 parent 6406e61 commit 9a7aeb2
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Charts/Classes/Charts/BarLineChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,52 +216,55 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar

// make sure the graph values and grid cannot be drawn outside the content-rect
CGContextSaveGState(context)

CGContextClipToRect(context, _viewPortHandler.contentRect)

_xAxisRenderer?.renderGridLines(context: context)
_leftYAxisRenderer?.renderGridLines(context: context)
_rightYAxisRenderer?.renderGridLines(context: context)

if (_xAxis.isDrawLimitLinesBehindDataEnabled)
if _xAxis.isDrawLimitLinesBehindDataEnabled
{
_xAxisRenderer?.renderLimitLines(context: context)
}
if (_leftAxis.isDrawLimitLinesBehindDataEnabled)
if _leftAxis.isDrawLimitLinesBehindDataEnabled
{
_leftYAxisRenderer?.renderLimitLines(context: context)
}
if (_rightAxis.isDrawLimitLinesBehindDataEnabled)
if _rightAxis.isDrawLimitLinesBehindDataEnabled
{
_rightYAxisRenderer?.renderLimitLines(context: context)
}

renderer?.drawData(context: context)

// if highlighting is enabled
if (valuesToHighlight())
{
renderer?.drawHighlighted(context: context, indices: _indicesToHighlight)
}

// Removes clipping rectangle

CGContextRestoreGState(context)

renderer!.drawExtras(context: context)

if (!_xAxis.isDrawLimitLinesBehindDataEnabled)
CGContextSaveGState(context)
CGContextClipToRect(context, _viewPortHandler.contentRect)

if !_xAxis.isDrawLimitLinesBehindDataEnabled
{
_xAxisRenderer?.renderLimitLines(context: context)
}
if (!_leftAxis.isDrawLimitLinesBehindDataEnabled)
if !_leftAxis.isDrawLimitLinesBehindDataEnabled
{
_leftYAxisRenderer?.renderLimitLines(context: context)
}
if (!_rightAxis.isDrawLimitLinesBehindDataEnabled)
if !_rightAxis.isDrawLimitLinesBehindDataEnabled
{
_rightYAxisRenderer?.renderLimitLines(context: context)
}

CGContextRestoreGState(context)

_xAxisRenderer.renderAxisLabels(context: context)
_leftYAxisRenderer.renderAxisLabels(context: context)
_rightYAxisRenderer.renderAxisLabels(context: context)
Expand Down

0 comments on commit 9a7aeb2

Please sign in to comment.