diff --git a/Source/Charts/Charts/ChartViewBase.swift b/Source/Charts/Charts/ChartViewBase.swift index 695a622996..297f3bb239 100755 --- a/Source/Charts/Charts/ChartViewBase.swift +++ b/Source/Charts/Charts/ChartViewBase.swift @@ -155,7 +155,10 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate /// flag that indicates if offsets calculation has already been done or not fileprivate var _offsetsCalculated = false - + + /// if `true` , when call clear(), also set lastHighlighted to nil + open var clearLastHighlightedEnabled = false + /// array of Highlight objects that reference the highlighted slices in the chart internal var _indicesToHighlight = [Highlight]() @@ -276,6 +279,10 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate _data = nil _offsetsCalculated = false _indicesToHighlight.removeAll() + if clearLastHighlightedEnabled + { + lastHighlighted = nil + } setNeedsDisplay() }