如何在danielgindi iOS图表中创建多个y轴折线图?

时间:2018-07-19 07:07:45

标签: ios swift charts linechart ios-charts

我想创建一个具有多个y轴的图形。在 danielgindi 图表中可以使用Duel y轴图,但我想要更多两个y轴图。如下图所示:

enter image description here

let set1 = LineChartDataSet(values: yVals1, label: "DataSet 1")
set1.axisDependency = .left
set1.setColor(UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1))
set1.setCircleColor(.white)
set1.lineWidth = 2
set1.circleRadius = 3
set1.fillAlpha = 65/255
set1.fillColor = UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)
set1.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1)
set1.drawCircleHoleEnabled = false

let set2 = LineChartDataSet(values: yVals2, label: "DataSet 2")
set2.axisDependency = .right
set2.setColor(.red)
set2.setCircleColor(.white)
set2.lineWidth = 2
set2.circleRadius = 3
set2.fillAlpha = 65/255
set2.fillColor = .red
set2.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1)
set2.drawCircleHoleEnabled = false

这是danielgindi图表代码,但在此代码中显示了双y轴。

我该怎么办? 预先感谢。

0 个答案:

没有答案