在我看来,这似乎是一件微不足道的事情,即使在通读之前的问题和技巧后,我仍然可以在android上工作,但不能在iOS上工作。
无论如何,我只是在尝试创建历史价格数据的组合图表,其中包括烛台图表以及背景中的交易量指标(条形图)。结果显示如下:
代码非常简单,并遵循以下示例:
let set1 = CandleChartDataSet(values: yVals1, label: "Data Set")
set1.axisDependency = YAxis.AxisDependency.left
set1.setColor(UIColor(white: 80 / 255, alpha: 1))
set1.drawIconsEnabled = false
set1.shadowColor = .darkGray
set1.shadowWidth = 0.7
set1.decreasingColor = .red
set1.decreasingFilled = true
set1.increasingColor = UIColor(red: 122 / 255, green: 242 / 255, blue: 84 / 255, alpha: 1)
set1.increasingFilled = false
set1.neutralColor = .blue
set1.drawValuesEnabled = false
self.candleStickChartView.xAxis.valueFormatter = IndexAxisValueFormatter(values: xValues)
let candleStickData = CandleChartData(dataSet: set1)
let data = CombinedChartData()
let barChartDataSet = BarChartDataSet(values: barChartEntries, label: "values")
barChartDataSet.setColor(UIColor.rhLightGrey().withAlphaComponent(0.3))
barChartDataSet.axisDependency = YAxis.AxisDependency.right
let barChartData = BarChartData(dataSet: barChartDataSet)
data.candleData = candleStickData
data.barData = barChartData
self.candleStickChartView.rightAxis.axisMinimum = 0.0
self.candleStickChartView.data = data
self.candleStickChartView.setNeedsDisplay()
当我删除
data.barData = barChartData
时,它会很好地显示烛台,但是我无法使“缩放”取决于烛台值(该烛台值远低于音量条)。有任何想法吗?
谢谢!
最佳答案
好像干净整修对我有用