Skip to content

Commit

Permalink
Add fix for stacked bars ChartsOrg#4029
Browse files Browse the repository at this point in the history
  • Loading branch information
krisanthony committed Apr 1, 2020
1 parent 8ef2368 commit fcc09cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/Charts/Renderers/BarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,11 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
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)"
Expand Down

0 comments on commit fcc09cd

Please sign in to comment.