简体   繁体   English

如何在Swift中使用条形图

[英]How to use Bar Chart in Swift

I am using AMChart library in swift. 我正在迅速使用AMChart库。 https://github.com/adventam10/AMChart https://github.com/adventam10/AMChart

I created the bar chart. 我创建了条形图。 But I am not able to get the current result. 但是我无法获得当前结果。 Please help me! 请帮我!

Below image is my output: 下图是我的输出:

在此处输入图片说明

But I need this type of output: 但是我需要这种类型的输出:

在此处输入图片说明

Below code is what I am using for BarChart 下面的代码是我用于BarChart的代码

private func prepareDataList () {
    barDataList.removeAll()
    barColors.removeAll()
    var values = [Int]()
    values.removeAll()

    for i in 0..<colorArray.count {
        barColors.append(colorArray[i])

        let value = CGFloat(dataValues[i])
        values.append(Int(value))

        barDataList.append(values)
    }
}

You can add: 你可以加:

pod 'Charts' 

to your Podfile. 到您的Podfile。 "Charts" is the name of the library . “图表”是图书馆的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM