2.2 KiB
2.2 KiB
CurveLineChart
The CurveLineChart is a composable function that displays a line chart with curved lines using the
Jetpack Compose framework. It is used to visualize data in a smooth curve format.
Function Signature
@Composable
fun CurveLineChart(
dataCollection: ChartDataCollection,
modifier: Modifier = Modifier,
padding: Dp = 16.dp,
axisConfig: AxisConfig = ChartDefaults.axisConfigDefaults(),
radiusScale: Float = 0.02f,
lineConfig: LineConfig = LineChartDefaults.defaultConfig(),
chartColors: CurvedLineChartColors = CurvedLineChartDefaults.defaultColor(),
) {
//Implementation
}
Parameters
dataCollection: This parameter is of typeChartDataCollectionand represents the data that will be plotted on the chart. It contains a collection ofLineData.modifier: This parameter is of typeModifierand is used to modify the appearance or behavior of the chart.padding: This parameter is of typeDpand specifies the padding around the chart.axisConfig: This parameter is of typeAxisConfigand is used to configure the appearance and behavior of the chart axes.- Where,
AxisConfiglooks like,
- Where,
data class AxisConfig(
val showAxes: Boolean,
val showGridLines: Boolean,
val showGridLabel: Boolean,
val axisStroke: Float,
val minLabelCount: Int,
val axisColor: Color,
val gridColor: Color,
)
radiusScale: This parameter is of typeFloatand determines the scale of the curve's radius. It affects the curvature of the lines in the chart.lineConfig: This parameter is of typeLineConfigand allows customization of the line appearance.- where,
LineConfiglooks like,
- where,
data class LineConfig(
val hasSmoothCurve: Boolean,
val hasDotMarker: Boolean,
val strokeSize: Float
)
chartColors: This parameter is of typeCurvedLineChartColorsand It allows customization of colors.- where,
CurvedLineChartColorslooks like,
- where,
data class CurvedLineChartColors(
val dotColor: List<Color> = emptyList(),
val backgroundColors: List<Color> = emptyList(),
val contentColor: List<Color> = emptyList(),
)