diff --git a/LICENSE b/LICENSE index 17c2ed446b..8198c7a0cb 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2016 Daniel Cohen Gindi & Philipp Jahoda + Copyright 2016-2019 Daniel Cohen Gindi & Philipp Jahoda Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Source/Charts/Renderers/BarChartRenderer.swift b/Source/Charts/Renderers/BarChartRenderer.swift index 6b192051bb..e675ba2215 100644 --- a/Source/Charts/Renderers/BarChartRenderer.swift +++ b/Source/Charts/Renderers/BarChartRenderer.swift @@ -867,9 +867,12 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer } else { stackLabel = nil } - + + //Handles empty array of yValues + let yValue = vals.isEmpty ? 0.0 : vals[idx % vals.count] + elementValueText = dataSet.valueFormatter?.stringForValue( - vals[idx % stackSize], + yValue, entry: e, dataSetIndex: dataSetIndex, viewPortHandler: viewPortHandler) ?? "\(e.y)" diff --git a/Source/Charts/Renderers/LineChartRenderer.swift b/Source/Charts/Renderers/LineChartRenderer.swift index eedd92de91..63930c19fb 100644 --- a/Source/Charts/Renderers/LineChartRenderer.swift +++ b/Source/Charts/Renderers/LineChartRenderer.swift @@ -711,8 +711,8 @@ open class LineChartRenderer: LineRadarRenderer context.setLineDash(phase: 0.0, lengths: []) } - let x = high.x // get the x-position - let y = high.y * Double(animator.phaseY) + let x = e.x // get the x-position + let y = e.y * Double(animator.phaseY) if x > chartXMax * animator.phaseX { diff --git a/Source/Charts/Renderers/PieChartRenderer.swift b/Source/Charts/Renderers/PieChartRenderer.swift index c9716111dc..dd1deb68fe 100644 --- a/Source/Charts/Renderers/PieChartRenderer.swift +++ b/Source/Charts/Renderers/PieChartRenderer.swift @@ -880,7 +880,9 @@ open class PieChartRenderer: DataRenderer // Prepend selected slices before the already rendered unselected ones. // NOTE: - This relies on drawDataSet() being called before drawHighlighted in PieChartView. - accessibleChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1) + if !accessibleChartElements.isEmpty { + accessibleChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1) + } context.restoreGState() }