简体   繁体   中英

How to use Bar Chart in Swift

I am using AMChart library in swift. 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

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. "Charts" is the name of the library .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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