@@ -352,7 +352,13 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
352352
353353 context. setFillColor ( dataSet. barShadowColor. cgColor)
354354
355- let bezierPath = UIBezierPath ( roundedRect: barRect, byRoundingCorners: dataSet. roundedCorners,
355+ var roundedCorners = dataSet. roundedCorners
356+ if let i = buffer. firstIndex ( of: barRect) ,
357+ let entry = dataSet. entryForIndex ( i) ,
358+ entry. y < 0 {
359+ roundedCorners. update ( with: [ . bottomLeft, . bottomRight, . topLeft, . topRight] )
360+ }
361+ let bezierPath = UIBezierPath ( roundedRect: barRect, byRoundingCorners: roundedCorners,
356362 cornerRadii: . init( width: dataSet. cornerRadius, height: dataSet. cornerRadius) )
357363 context. addPath ( bezierPath. cgPath)
358364 context. drawPath ( using: . fill)
@@ -383,7 +389,12 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
383389 context. setFillColor ( dataSet. color ( atIndex: j) . cgColor)
384390 }
385391
386- let bezierPath = UIBezierPath ( roundedRect: barRect, byRoundingCorners: dataSet. roundedCorners,
392+ var roundedCorners = dataSet. roundedCorners
393+ if let entry = dataSet. entryForIndex ( j) ,
394+ entry. y < 0 {
395+ roundedCorners. update ( with: [ . bottomLeft, . bottomRight, . topLeft, . topRight] )
396+ }
397+ let bezierPath = UIBezierPath ( roundedRect: barRect, byRoundingCorners: roundedCorners,
387398 cornerRadii: . init( width: dataSet. cornerRadius, height: dataSet. cornerRadius) )
388399 context. addPath ( bezierPath. cgPath)
389400 context. drawPath ( using: . fill)
@@ -751,7 +762,11 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
751762
752763 setHighlightDrawPos ( highlight: high, barRect: barRect)
753764
754- let bezierPath = UIBezierPath ( roundedRect: barRect, byRoundingCorners: set. roundedCorners,
765+ var roundedCorners = set. roundedCorners
766+ if e. y < 0 {
767+ roundedCorners. update ( with: [ . bottomLeft, . bottomRight, . topLeft, . topRight] )
768+ }
769+ let bezierPath = UIBezierPath ( roundedRect: barRect, byRoundingCorners: roundedCorners,
755770 cornerRadii: . init( width: set. cornerRadius, height: set. cornerRadius) )
756771 context. addPath ( bezierPath. cgPath)
757772 context. drawPath ( using: . fill)
0 commit comments