Norway


My is not displaying any bars using this bar graph. I have successfully imported the charts cocoa . There are currently no run errors. The only thing that is being displayed in the graph is the description label.

    import UIKit
import Charts
class ViewController: UIViewController {


@IBOutlet var lineChartVIew: BarChartView!
var days: [String]!


override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    days = ["Monday","Tuesday","life"]
    let task = [1.0,4.0,3.0]
    setChart(dataPoints: days, values: task)
}

func setChart(dataPoints : [String], values : [Double]){
    lineChartVIew.noDataText = "Nothining to display"

    var dataEntries : [BarChartDataEntry] = []
    var counter = 0.0

    for i in 0..<dataPoints.count {
        counter += 1
        let dataEntery = BarChartDataEntry(x: values[i], y: counter)
        dataEntries.append(dataEntery)
    }

    let ChartDataSet = BarChartDataSet(values: dataEntries, label: "Time")
    let chartData = BarChartData()
    lineChartVIew. = chartData
    ChartDataSet.colors = ChartColorTemplates.colorful()

    lineChartVIew.animate(xAxisDuration: 2.0, yAxisDuration: 2.0)
}}

enter image description here  - 5ad0a - ios &#8211; coca pod Chart not appearing (Swift4)



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here