I created a simple histogram with a library in https://github.com/danielgindi/ios-charts still can not figure out how to make this grouped histogram, I added an array of units sold to the diagram, but I do not know how to get an array unitBought on a chart to make it grouped using chart.please.
@IBOutlet weak var barChartView: BarChartView! override func viewDidLoad() { super.viewDidLoad() months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] let unitsSold = [20.0, 4.0, 6.0, 3.0, 12.0, 16.0, 4.0, 18.0, 2.0, 4.0, 5.0, 12.8] let unitsBought = [20.0, 4.0, 6.0, 3.0, 12.0, 16.0, 4.0, 18.0, 2.0, 4.0, 5.0, 12.8] setChart(months, values: unitsSold) } //functions func setChart(dataPoints: [String], values: [Double]) { barChartView.noDataText = "You need to provide data for the chart." var dataEntries: [BarChartDataEntry] = [] for i in 0..<dataPoints.count { let dataEntry = BarChartDataEntry(value: values[i], xIndex: i) dataEntries.append(dataEntry) } let chartDataSet = BarChartDataSet(yVals: dataEntries, label: "Units Sold") let chartData = BarChartData(xVals: months, dataSet: chartDataSet) barChartView.data = chartData barChartView.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1) barChartView.gridBackgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1) barChartView.legend.enabled = false barChartView.leftAxis.drawGridLinesEnabled = false barChartView.leftAxis.drawAxisLineEnabled = true barChartView.rightAxis.drawGridLinesEnabled = false barChartView.rightAxis.drawAxisLineEnabled = false barChartView.rightAxis.drawLabelsEnabled = false barChartView.xAxis.drawGridLinesEnabled = false barChartView.xAxis.drawLabelsEnabled = true }