admin管理员组文章数量:1287966
How to make pie chart code like this, I have used many libraries like MPAndroidChart for it but none of them prevents overlapping of labels
my current approach with MPAndroidChart is
val ds = PieDataSet(entries, "")
ds.colors = Utils.colors.map { it.toArgb() }
ds.yValuePosition = PieDataSet.ValuePosition.OUTSIDE_SLICE
ds.xValuePosition = PieDataSet.ValuePosition.OUTSIDE_SLICE
ds.sliceSpace = 1.5f
ds.valueTextColor = Black33.toArgb()
ds.valueTextSize = 12f
ds.isUsingSliceColorAsValueLineColor = true
ds.valueLinePart1Length = 1f
ds.valueLinePart2Length = 1f
ds.valueLinePart1OffsetPercentage = 100f
ds.valueTypeface = opensans
ds.valueFormatter = object : ValueFormatter() {
override fun getFormattedValue(value: Float): String {
return "%.1f%%".format(value)
}
}
chart.setEntryLabelTextSize(13f)
chart.setEntryLabelTypeface(nunito)
chart.minAngleForSlices = 25f
chart.isRotationEnabled = true
val d = PieData(ds)
chart.data = d
chart.invalidate()
I have tried minimizing it by using "minAngleForSlices" but that doesn't seem to be a good solution solution
本文标签: How to make perfect Pie Chart in android jetpack composeStack Overflow
版权声明:本文标题:How to make perfect Pie Chart in android jetpack compose - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741330488a2372738.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论