From af5ac586c87a1cb33861e421689acffb24a98af0 Mon Sep 17 00:00:00 2001 From: Timothy Moose Date: Thu, 22 Mar 2018 09:02:31 -0500 Subject: [PATCH] Add option to disable clipping data to contentRect --- Source/Charts/Charts/BarLineChartViewBase.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Charts/Charts/BarLineChartViewBase.swift b/Source/Charts/Charts/BarLineChartViewBase.swift index 4b8fc4dad1..65b2be586c 100644 --- a/Source/Charts/Charts/BarLineChartViewBase.swift +++ b/Source/Charts/Charts/BarLineChartViewBase.swift @@ -50,6 +50,11 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD /// When enabled, the values will be clipped to contentRect, otherwise they can bleed outside the content rect. @objc open var clipValuesToContentEnabled: Bool = false + /// When disabled, the data and/or highlights will not be clipped to contentRect. Disabling this option can + /// be useful, when the data lies fully within the content rect, but is drawn in such a way (such as thick lines) + /// that there is unwanted clipping. + @objc open var clipDataToContentEnabled: Bool = true + /// Sets the minimum offset (padding) around the chart, defaults to 10 @objc open var minOffset = CGFloat(10.0) @@ -218,9 +223,11 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD rightYAxisRenderer.renderLimitLines(context: context) } - // make sure the data cannot be drawn outside the content-rect context.saveGState() - context.clip(to: _viewPortHandler.contentRect) + // make sure the data cannot be drawn outside the content-rect + if clipDataToContentEnabled { + context.clip(to: _viewPortHandler.contentRect) + } renderer.drawData(context: context) // if highlighting is enabled