您好想更改我的 iOS 图表的背景颜色。
我试过了:
barChartView.backgroundColor = UIColor.redcolor()
但它改变了我的条形图周围的颜色,而不是里面的颜色,即。在竖线后面。
任何想法?
您好想更改我的 iOS 图表的背景颜色。
我试过了:
barChartView.backgroundColor = UIColor.redcolor()
但它改变了我的条形图周围的颜色,而不是里面的颜色,即。在竖线后面。
任何想法?
barChartView.backgroundColor 引用您的 BarChartView 是子视图的 UIView。您需要引用 BarChart 本身的基类来更改条形或条形后面的网格的属性。要更改栏后面空间的颜色,请尝试:
barChartView.gridBackgroundColor = UIColor.redcolor()
如果 Japes 回答仍然不起作用,请确保它已启用。
barChartView.drawGridBackgroundEnabled = true
// Set grid background color
barChartView.gridBackgroundColor = UIColor.orange
// It is required to enable 'drawGridBackgroundColor' to see effect of gridBackground color
barChartView.drawGridBackgroundEnabled = true