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
I need to create a stacked bar chart with 3 dataSets like this :
But when I used this code :
********************** Begin ******************************
let chiffreAffaire = [3282.0, 4179.0]
let chiffreAffaireDetails1 = [788.0, 889.0]
let chiffreAffaireDetails2 = [300.0, 330.0]
let chiffreAffaireDetails3 = [2247.0, 1843.0]
var yse1 = chiffreAffaireDetails1.enumerated().map { x, y in return BarChartDataEntry(x: Double(x), y: y) }
var yse2 = chiffreAffaireDetails2.enumerated().map { x, y in return BarChartDataEntry(x: Double(x), y: y) }
var yse3 = chiffreAffaireDetails3.enumerated().map { x, y in return BarChartDataEntry(x: Double(x), y: y) }
var yse = chiffreAffaire.enumerated().map { x, y in return BarChartDataEntry(x: Double(x), y: y) }
let data = BarChartData()
let ds1 = BarChartDataSet(values: yse1, label: "")
let ds2 = BarChartDataSet(values: yse2, label: "")
let ds3 = BarChartDataSet(values: yse3, label: "")
let ds4 = BarChartDataSet(values: yse, label: "")
data.barWidth=0.6
ds4.setColor (UIColor.detailsBtnGreen)
ds4.valueFont=UIFont(name:"Avenir-Book" ,size:20.0)!
data.addDataSet(ds4)
ds2.setColor (UIColor.pistachioGreen)
ds2.valueFont=UIFont(name:"Avenir-Book" ,size:20.0)!
ds2.valueTextColor=UIColor.white
data.addDataSet(ds2)
ds1.setColor (UIColor.pinkBar)
ds1.valueFont=UIFont(name:"Avenir-Book" ,size:20.0)!
ds1.valueTextColor=UIColor.white
data.addDataSet(ds1)
ds3.setColor(UIColor.royalBlue)
ds3.valueFont=UIFont(name:"Avenir-Book" ,size:20.0)!
ds3.valueTextColor=UIColor.white
data.addDataSet(ds3)
self.barChartView.data = data
********************** End ******************************
I had this result :
The problem is that it takes only the first and the last dataSet colors !
Someone can help me please ?
Thanks in advance ( and sorry for my bad english ;-) )
The text was updated successfully, but these errors were encountered:
Hi everyone,
I need to create a stacked bar chart with 3 dataSets like this :
But when I used this code :
********************** Begin ******************************
let chiffreAffaire = [3282.0, 4179.0]
let chiffreAffaireDetails1 = [788.0, 889.0]
let chiffreAffaireDetails2 = [300.0, 330.0]
let chiffreAffaireDetails3 = [2247.0, 1843.0]
********************** End ******************************
I had this result :

The problem is that it takes only the first and the last dataSet colors !
Someone can help me please ?
Thanks in advance ( and sorry for my bad english ;-) )
The text was updated successfully, but these errors were encountered: