1
我有以下2個數據集的折線圖。 一個數據集依賴於左邊的yAxis,右邊的yAxis。如何使用ios圖表在同一行中對齊左右軸?
現在我想讓他們都在同一行中有零值。 其他值可以不對齊。 我該怎麼做?
代碼:
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 = ""
你可以分享你的代碼?然後它將有可能重現問題 – DevB2F
@ DevB2F完成,將代碼添加到問題 –