To use the CircleChart, follow the steps below:
- Include the Charty library in your Android project.
- Use the
CircleChart
composable in your code:
fun CircleChart(
dataCollection: ChartDataCollection,
modifier: Modifier = Modifier,
canAnimate: Boolean = true,
textLabelTextConfig: CircleChartLabelTextConfig = CircleConfigDefaults.defaultTextLabelConfig(),
config: CircleChartConfig = CircleConfigDefaults.circleConfigDefaults(),
) {
// Implementation details...
}
CircleChart
accepts the following parameters:
dataCollection
: AChartDataCollection
object representing the data to be displayed in CircleChart of typeCircleData
.modifier
: OptionalModifier
to customize the appearance and behavior of the chart.canAnimate
: OptionalBoolean
value representing if the chart should animate. Default istrue
.textLabelTextConfig
: OptionalCircleChartLabelTextConfig
type parameter. Configuration for the text label that appears in the center of the chart. Default configuration can be accessed throughCircleConfigDefaults.defaultTextLabelConfig()
. where, it looks like,
data class CircleChartLabelTextConfig(
val textSize: TextUnit,
val fontStyle: FontStyle? = null,
val fontWeight: FontWeight? = null,
val fontFamily: FontFamily? = null,
val indicatorSize: Dp = 10.dp,
val maxLine: Int = 1,
val overflow: TextOverflow = TextOverflow.Ellipsis
)
config
: OptionalCircleChartConfig
type parameter. Configuration for the circle chart appearance. Default configuration can be accessed through CircleConfigDefaults.circleConfigDefaults(). where, it looks like,
data class CircleChartConfig(
val startAngle: StartAngle = StartAngle.Zero,
val maxValue: Float?,
val showLabel: Boolean
)