从 Horizo​​ntalBarChartView 中移除阴影

remove shadow from HorizontalBarChartView

我的 HorizontalBarChartView 有阴影。我怎样才能删除它?

图表设置如下: chartView.userInteractionEnabled = NO; chartView.drawGridBackgroundEnabled = NO; chartView.drawBarShadowEnabled = NO; chartView.drawBordersEnabled = NO; chartView.leftAxis.enabled = NO; chartView.rightAxis.enabled = NO; chartView.drawValueAboveBarEnabled = NO;

尝试禁用 BarChartView.drawBarShadowEnabled

BarChartDataSet 中也有 shadowColor:

/// the color used for drawing the bar-shadows. The bar shadows is a surface behind the bar that indicates the maximum value
public var barShadowColor = UIColor(red: 215.0/255.0, green: 215.0/255.0, blue: 215.0/255.0, alpha: 1.0)

如果您使用 swift 而不是 objc,只需将 'NO' 替换为 'false'

chartView.drawBarShadowEnabled = false

编辑: 来自代码源:

/// if set to true, a grey area is drawn behind each bar that indicates the maximum value
173     @objc open var drawBarShadowEnabled: Bool 

在 ChartsDemo 示例中 link

//: ### General
chartView.pinchZoomEnabled          = false
chartView.drawBarShadowEnabled      = false
chartView.doubleTapToZoomEnabled    = false
chartView.drawGridBackgroundEnabled = true
chartView.fitBars                   = true