I am trying to hide all of the lines that iOS-Charts displays. However there is one line that I cannot hide. I have searched through the docs but could not find an answer.
let data = LineChartData()
let ds = LineChartDataSet(entries: yValues, label: "Day")
ds.setColor(#colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0))
ds.setCircleColor(.white)
ds.circleRadius = 5
ds.lineWidth = 3
ds.valueFont = UIFont.systemFont(ofSize: 6, weight: .bold)
ds.valueColors = [#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)]
data.addDataSet(ds)
cell.averageTempChartView.data = data
}else{
cell.averageTempLabel.text = ""
}
cell.cellView.layer.cornerRadius = 30
cell.cellView.translatesAutoresizingMaskIntoConstraints = false
cell.cellView.layer.shadowOpacity = 0.23
cell.cellView.layer.shadowRadius = 3
cell.cellView.layer.shadowOffset = CGSize(width: 0, height: 0)
cell.cellView.layer.shadowColor = UIColor.black.cgColor
cell.cellView.backgroundColor = #colorLiteral(red: 1, green: 0.7843137255, blue: 0.2039215686, alpha: 1)
cell.averageTempChartView.xAxis.wordWrapEnabled = true
cell.averageTempChartView.xAxis.labelPosition = XAxis.LabelPosition.bottom
cell.averageTempChartView.xAxis.labelTextColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
cell.averageTempChartView.xAxis.labelFont = UIFont.systemFont(ofSize: 12, weight: .bold)
cell.averageTempChartView.rightAxis.enabled = false
cell.averageTempChartView.xAxis.granularity = 1
cell.averageTempChartView.xAxis.drawAxisLineEnabled = false
cell.averageTempChartView.xAxis.drawGridLinesEnabled = false
cell.averageTempChartView.leftAxis.gridColor = .clear
cell.averageTempChartView.rightAxis.gridColor = .clear
cell.averageTempChartView.leftAxis.drawLabelsEnabled = false
cell.averageTempChartView.rightAxis.drawLabelsEnabled = false
cell.averageTempChartView.noDataText = ""
cell.averageTempChartView.legend.enabled = false
cell.averageTempChartView.noDataFont = UIFont.systemFont(ofSize: 15, weight: .bold)
cell.averageTempChartView.noDataTextColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
您已经为xAxis
使用了正确的属性drawAxisLineEnabled
,因此只需为 leftAxis 使用相同的属性。
cell.averageTempChartView.leftAxis.drawAxisLineEnabled = false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.