@@ -41,6 +41,8 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
4141 internal lazy var accessibilityOrderedElements : [ [ NSUIAccessibilityElement ] ] = accessibilityCreateEmptyOrderedElements ( )
4242
4343 private typealias Buffer = [ CGRect ]
44+
45+ internal let barCornerRadius = CGFloat ( 5.0 )
4446
4547 @objc open weak var dataProvider : BarChartDataProvider ?
4648
@@ -323,7 +325,7 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
323325 guard let e = dataSet. entryForIndex ( i) as? BarChartDataEntry else { continue }
324326
325327 x = e. x
326-
328+
327329 _barShadowRectBuffer. origin. x = CGFloat ( x - barWidthHalf)
328330 _barShadowRectBuffer. size. width = CGFloat ( barWidth)
329331
@@ -337,6 +339,7 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
337339 _barShadowRectBuffer. size. height = viewPortHandler. contentHeight
338340
339341 context. setFillColor ( dataSet. barShadowColor. cgColor)
342+
340343 context. fill ( _barShadowRectBuffer)
341344 }
342345 }
@@ -351,7 +354,10 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
351354 guard viewPortHandler. isInBoundsRight ( barRect. origin. x) else { break }
352355
353356 context. setFillColor ( dataSet. barShadowColor. cgColor)
354- context. fill ( barRect)
357+
358+ let bezierPath = UIBezierPath ( roundedRect: barRect, cornerRadius: barCornerRadius)
359+ context. addPath ( bezierPath. cgPath)
360+ context. drawPath ( using: . fill)
355361 }
356362 }
357363
@@ -361,7 +367,6 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
361367 {
362368 context. setFillColor ( dataSet. color ( atIndex: 0 ) . cgColor)
363369 }
364-
365370 // In case the chart is stacked, we need to accomodate individual bars within accessibilityOrdereredElements
366371 let isStacked = dataSet. isStacked
367372 let stackSize = isStacked ? dataSet. stackSize : 1
@@ -379,7 +384,9 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
379384 context. setFillColor ( dataSet. color ( atIndex: j) . cgColor)
380385 }
381386
382- context. fill ( barRect)
387+ let bezierPath = UIBezierPath ( roundedRect: barRect, byRoundingCorners: [ . topLeft, . topRight] , cornerRadii: CGSize ( width: 10 , height: 10 ) )
388+ context. addPath ( bezierPath. cgPath)
389+ context. drawPath ( using: . fill)
383390
384391 if drawBorder
385392 {
0 commit comments