简体   繁体   English

iOS-Charts - 无法隐藏 Y 轴

[英]iOS-Charts - cannot hide Y axis

I am trying to hide all of the lines that iOS-Charts displays.我试图隐藏 iOS-Charts 显示的所有行。 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)

在此处输入图片说明 Any help is appreciated任何帮助表示赞赏

您已经为xAxis使用了正确的属性drawAxisLineEnabled ,因此只需为 leftAxis 使用相同的属性。

cell.averageTempChartView.leftAxis.drawAxisLineEnabled = false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM