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