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
Hi,
First I would like to thank you for this amazing project.
I am trying to specify colors for pie charts.
I have 3 label x y z and I want to specify for x the red color and y the orange color and z the green color.
I am using Swift 3.0 but the pie charts is taking 2 colors only,it gives x and y red and z green.
Am using the below code:
var colors: [UIColor] = []
let redcolor = UIColor(red: CGFloat(255/255), green: CGFloat(0/255), blue: CGFloat(0/255), alpha: 1)
let greencolor = UIColor(red: CGFloat(0/255), green: CGFloat(128/255), blue: CGFloat(0/255), alpha: 1)
let orangecolor = UIColor(red: CGFloat(255/255), green: CGFloat(140/255), blue: CGFloat(0/255), alpha: 1)
colors.append(redcolor)
colors.append(orangecolor)
colors.append(greencolor)
var taskChartDataEntries: [ChartDataEntry] = []
taskChartDataEntries.append(PieChartDataEntry(value: 10, label: "x"))
taskChartDataEntries.append(PieChartDataEntry(value: 11, label: "y"))
taskChartDataEntries.append(PieChartDataEntry(value: 1, label: "z"))
let data = PieChartData()
let ds1 = PieChartDataSet(values: taskChartDataEntries, label: "Status")
ds1.colors = colors
ds1.colors = ChartColorTemplates.joyful();
data.addDataSet(ds1)
The text was updated successfully, but these errors were encountered:
I don't understand "but the pie charts is taking 2 colors only", pie chart will render multiple colors for sure. Do check ChartsDemo for this kind of issues.
Hi,
First I would like to thank you for this amazing project.
I am trying to specify colors for pie charts.
I have 3 label x y z and I want to specify for x the red color and y the orange color and z the green color.
I am using Swift 3.0 but the pie charts is taking 2 colors only,it gives x and y red and z green.
Am using the below code:
The text was updated successfully, but these errors were encountered: