BarCharView修改bar圆角
修改BarChartRenderer.swift文件中的,@objc open func drawDataSet(context: CGContext, dataSet: IBarChartDataSet, index: Int)函数
原代码:
if !isSingleColor
{
// Set the color for the currently drawn value. If the index is out of bounds, reuse colors.
context.setFillColor(dataSet.color(atIndex: j).cgColor)
}
context.fill(barRect)
更改圆角代码:
if !isSingleColor
{
// Set the color for the currently drawn value. If the index is out of bounds, reuse colors.
context.setFillColor(dataSet.color(atIndex: j).cgColor)
}
// context.fill(barRect)
let bezierPath =UIBezierPath(roundedRect: barRect,byRoundingCorners: [.topLeft, .topRight],cornerRadii:CGSize(width:4,height:4));
context.addPath(bezierPath.cgPath)
context.drawPath(using: .fill)
网友评论