2.2 KiB
2.2 KiB
LineChart
To use the LineChart, follow the steps below:
- Include the Charty library in your Android project.
- Use the
LineChartcomposable in your code:
Function Signature
@Composable
fun LineChart(
dataCollection: ChartDataCollection,
modifier: Modifier = Modifier,
padding: Dp = 16.dp,
axisConfig: AxisConfig = ChartDefaults.axisConfigDefaults(),
radiusScale: Float = 0.02f,
lineConfig: LineConfig = LineChartDefaults.defaultConfig(),
chartColors: LineChartColors = LineChartDefaults.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.radiusScale: This parameter is of typeFloatand determines the scale of the dot's radius. It affects the size of the data points in the chart.lineConfig: This parameter is of typeLineConfigand allows customization of the line appearance.chartColors: This parameter is of typeLineChartColorsand provides a set of default colors for the chart components.
LineChart (Alternate Signature)
@Composable
fun LineChart(
dataCollection: ChartDataCollection,
dotColor: Color,
lineColor: Color,
modifier: Modifier = Modifier,
backgroundColor: Color = Color.White,
padding: Dp = 16.dp,
axisConfig: AxisConfig = ChartDefaults.axisConfigDefaults(),
lineConfig: LineConfig = LineChartDefaults.defaultConfig(),
radiusScale: Float = 0.02f,
) {
//Implementation
}
Additional Parameters
dotColor: This parameter is of typeColorand represents the color of the data points (dots) on the chart.lineColor: This parameter is of typeColorand represents the color of the lines connecting the data points.