You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var xVals = [String]()
var datasets = [BarChartDataSet]()
for i in 0..<json.count{
var entries = [BarChartDataEntry]()
for j in 0..<json[i]["Items"].count{
if i == 0{
xVals.append(json[i]["Items"][j]["X"].string!)
}
let entry = BarChartDataEntry(value: json[i]["Items"][j]["Value"].double!, xIndex: j)
entries.append(entry)
}
let dataset = BarChartDataSet(yVals: entries, label: json[i]["Name"].string)
dataset.setColors(ChartColorTemplates.pastel(), alpha: 100)
datasets.append(dataset)
}
let data = BarChartData(xVals: xVals, dataSets: datasets)
barChart.data = data`
How do I color by type rather than group?
The text was updated successfully, but these errors were encountered:
Hi there,
I want to create the same chart as the example image you provided here :
BarChart (grouped DataSets)
I managed to create the same grouping, but when I add color sets, it doesn't work like this.
Here is my attempt:
Code:
`
How do I color by type rather than group?
The text was updated successfully, but these errors were encountered: