我有以下两个数据集的折线图。
一个数据集取决于左边的YxAX,右边的另一个YAXIS。
现在我希望它们都在同一行中有一个零值。
其他值可以不对齐。
我该怎么做?
代码:
let speedLine = LineChartDataSet(values: speedEntries, label: "Speed")
speedLine.colors = [UIColor.white]
speedLine.drawCirclesEnabled = false
speedLine.axisDependency = .left
let powerLine = LineChartDataSet(values: powerEntries, label: "Power")
powerLine.colors = [UIColor.green]
powerLine.drawCirclesEnabled = false
powerLine.axisDependency = .right
let data = LineChartData()
data.addDataSet(speedLine)
data.addDataSet(powerLine)
chartView.data = data
chartView.xAxis.labelTextColor = UIColor.white
chartView.xAxis.labelCount = 20
chartView.leftAxis.labelTextColor = UIColor.white
chartView.rightAxis.labelTextColor = UIColor.green
chartView.legend.textColor = UIColor.white
chartView.rightAxis.axisMinimum = -80.0
chartView.chartDescription?.text = ""
最佳答案
既然你已经:
chartView.rightAxis.axisMinimum = -80.0
您可能还需要这样做:
chartView.leftAxis.axisMinimum = -80.0