             for i in barData.indices {
                 let set = barData[i] as! BarChartDataSet
                 let size = set.count * (set.isStacked ? set.stackSize : 1)
-                if _buffers[i].rects.count != size {
-                    _buffers[i].rects = [CGRect](repeating: CGRect(), count: size)
+                if _buffers[i].count != size {
+                    _buffers[i] = [CGRect](repeating: CGRect(), count: size)
                 }
             }
         } else {


    final lazy var accessibilityOrderedElements: [[NSUIAccessibilityElement]] = accessibilityCreateEmptyOrderedElements()

    private class Buffer {
        var rects = [CGRect]()
    }

    public weak var dataProvider: BarChartDataProvider?


                    barRect.origin.y = top
                    barRect.size.height = bottom - top

                    _buffers[index][bufferIndex] = barRect
                    bufferIndex += 1
                }
            }
