2017-11-11 2 views
1

2 개의 데이터 세트가있는 다음과 같은 선형 차트가 있습니다. 하나의 데이터 세트는 왼쪽 yAxx에 종속되고 다른 하나는 오른쪽 yAxis에 종속됩니다.ios-charts를 사용하여 같은 줄에 오른쪽 및 왼쪽 축을 정렬하는 방법은 무엇입니까?

이제는 둘 다 같은 줄에 0 값을 넣길 바랍니다. 다른 값은 정렬되지 않아도됩니다. 어떻게 할 수 있습니까?

코드 :

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 = "" 

enter image description here

+0

당신이 당신의 코드를 공유 할 수 있습니까? 그렇다면 문제를 재현하는 것이 가능합니다. – DevB2F

+0

@ DevB2F 완료, 질문에 코드를 추가했습니다. –

답변

0

부터 당신이 :

chartView.rightAxis.axisMinimum = -80.0 

당신은뿐만 아니라이 작업을 수행해야 할 수 있습니다

chartView.leftAxis.axisMinimum = -80.0 
+0

Didnt work. 두 가지를 모두 제거해 보았습니다. 하지만 운이 없다. –