2.3 KiB
2.3 KiB
GaugeChart
To use the GaugeChart, follow the steps below:
- Include the Charty library in your Android project.
- Use the
GaugeChartcomposable in your code:
fun GaugeChart(
percentValue: Int,
modifier: Modifier = Modifier,
gaugeChartConfig: GaugeChartConfig = GaugeChartDefaults.gaugeConfigDefaults(),
needleConfig: NeedleConfig = GaugeChartDefaults.needleConfigDefaults(),
animated: Boolean = true,
animationSpec: AnimationSpec<Float> = tween(),
) {
// Implementation details...
}
Parameters
percentValue:Int- The percentage value to be displayed on the gauge chart. Must be within the range of 1 to 100.
modifier:Modifier(optional)- Modifier to be applied to the chart layout.
gaugeChartConfig:GaugeChartConfig(optional)- Configuration for the gauge chart appearance. Default configuration can be accessed through
GaugeChartDefaults.gaugeConfigDefaults().
- Configuration for the gauge chart appearance. Default configuration can be accessed through
- Properties of
GaugeChartConfig:placeHolderColor:Color- Color of the background arc of the chart. Default isColor.LightGray.primaryColor:Color- Color of the primary arc indicating the current value. Default isColor.Blue.showNeedle:Boolean- Specifies whether to show the needle indicating the current value. Default istrue.showIndicator:Boolean- Specifies whether to show the minute hour dividers. Default istrue.indicatorColor:Color- Color of the minute hour dividers. Default isColor.Red.indicatorWidth:Dp- Width of the minute hour dividers. Default is2.dp.strokeWidth:Dp- Width of the chart arcs. Default is16.dp.
needleConfig:NeedleConfig(optional)- Configuration for the needle appearance. Default configuration can be accessed through
GaugeChartDefaults.needleConfigDefaults(). - Properties of
NeedleConfig:color:Color- Color of the needle. Default isColor.Black.strokeWidth:Dp- Width of the needle stroke. Default is4.dp.
- Configuration for the needle appearance. Default configuration can be accessed through
animated:Boolean(optional)- Specifies whether the chart should animate when data changes. Default is
true.
- Specifies whether the chart should animate when data changes. Default is
animationSpec:AnimationSpec<Float>(optional)- Animation specification for the chart animation. Default is
tween().
- Animation specification for the chart animation. Default is