I know I can set a boolean to true to add varying colors, which seems to be the only way to add different colors per slice.
As far as I can see, I can only do it on the series level...which will just set every slice to one color, which is not what I want. I want to set each slice a different color, but not the default ones given by apache poi.
You need to create un dataset to change the color, this is an example
fun setColor() {
val entries = arrayListOf<PieEntry>()
val colors = arrayListOf<Int>()
for (category in 4) {
colors.add(Color.parseColor("#FFFFFF")
}
val dataSet = PieDataSet(entries, "")
dataSet.colors = colors
val data = PieData(dataSet)
data.setValueTextSize(11f)
data.setValueTextColor(Color.WHITE)
pieChart.data = data
pieChart.highlightValues(null)
pieChart.invalidate()
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.