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 = Array<String>()
for var i = 0 ; i < count ; i++ {
xVals.append(months[i % 8])
}
var yValsTemp = Array<String>()
for var i = 0 ; i < count ; i++ {
yValsTemp.append(datas[i % 8])
}
var yVals = Array<BarChartDataEntry>();
for var i = 0 ; i < yValsTemp.count ; i++ {
yVals.append(BarChartDataEntry(value: (yValsTemp[i] as NSString).floatValue, xIndex: i))
}
var set1: BarChartDataSet = BarChartDataSet(yVals: yVals, label: "")
var data: BarChartData = BarChartData(xVals: xVals, dataSet: set1)
I need to add one more dataSet so I have create another dataSet
var zValsTemp = Array<String>()
for var i = 0 ; i < count ; i++ {
zValsTemp.append(dataSale[i % 8])
}
var zVals = Array<BarChartDataEntry>()
for var i = 0 ; i < zValsTemp.count ; i++ {
zVals.append(BarChartDataEntry(value: (zValsTemp[i] as NSString).floatValue, xIndex: i))
}
var set2: BarChartDataSet = BarChartDataSet(yVals: zVals, label: "")
set2.setColor(UIColor.greenColor())
But I am not able to set Both dataSet together into final dataSet I have tried several thing
Attempt:1
var dataSet = NSMutableArray(objects: set1,set2)
var data: BarChartData = BarChartData(xVals: xVals, dataSet: dataSet)
//Error:: Cannot find an initializer for type 'BarChartData' that accepts an argument list of type '(xVals: Array<String>, dataSet: NSMutableArray)'
Attempt:2
var dataSet = NSMutableArray()
dataSet.addObject(set1)
dataSet.addObject(set2)
var data: BarChartData = BarChartData(xVals: xVals, dataSet: dataSet)
//Error:: Cannot find an initializer for type 'BarChartData' that accepts an argument list of type '(xVals: Array<String>, dataSet: NSMutableArray)'
Attempt:3
var set = Array<BarChartDataSet>()
set.append(set1)
set.append(set2)
var data: BarChartData = BarChartData(xVals: xVals, dataSet: set)
//Error:: Cannot find an initializer for type 'BarChartData' that accepts an argument list of type '(xVals: Array<String>, dataSet: Array<BarChartDataSet>)
How can I setup both for multiple chart rendering.
Thanks
The text was updated successfully, but these errors were encountered:
Earlier I have only one dataSet it works fine
I need to add one more dataSet so I have create another dataSet
But I am not able to set Both dataSet together into final dataSet I have tried several thing
Attempt:1
Attempt:2
Attempt:3
How can I setup both for multiple chart rendering.
Thanks
The text was updated successfully, but these errors were encountered: