这是我的代码: 我得到的错误是:线程1:致命错误:向下广播的Array元素无法与代码的CalcStackSize函数中的目标类型匹配。感谢您的帮助。我仍在尝试使用此可可豆荚 https://cocoapods.org/pods/Charts是豆荚
func setHorizontalChart() {
horizontalBarChartView.isHidden = false
var dataEntries: [ChartDataEntry] = []
let unitsSold = [20.0, 4.0, 6.0, 3.0, 12.0, 16.0, 4.0, 18.0, 2.0, 4.0, 5.0, 4.0]
let test = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
for i in 0..<months.count {
let dataEntry = ChartDataEntry(x: Double(test[i]), y: Double(unitsSold[i]))
dataEntries.append(dataEntry)
}
let chartDataSet = BarChartDataSet(values: dataEntries, label: "Units Sold")
let chartData = BarChartData(dataSet: chartDataSet)
horizontalBarChartView.data = chartData