To use the PointChart, follow the steps below:
- Include the Charty library in your Android project.
- Use the
PointChart
composable in your code:
@Composable
fun PointChart(
pointData: ChartDataCollection,
contentColor: Color,
modifier: Modifier = Modifier,
backgroundColor: Color = Color.White,
padding: Dp = 16.dp,
pointType: PointType = PointType.Stroke(),
axisConfig: AxisConfig = ChartDefaults.axisConfigDefaults(),
radiusScale: Float = 0.02f,
)
@Composable
fun PointChart(
dataCollection: ChartDataCollection,
modifier: Modifier = Modifier,
padding: Dp = 16.dp,
pointType: PointType = PointType.Stroke(),
axisConfig: AxisConfig = ChartDefaults.axisConfigDefaults(),
radiusScale: Float = 0.02f,
chartColors: ChartColors = ChartDefaults.colorDefaults(),
)
dataCollection
: This parameter is of typeChartDataCollection
and represents the data that will be plotted on the chart. It contains a collection ofPointData
.modifier
: This parameter is of typeModifier
and is used to modify the appearance or behavior of the chart.backgroundColor
: This parameter is of typeColor
and represents the background color of the chart. The default value isColor.White
.padding
: This parameter is of typeDp
and represents the padding around the chart. The default value is16.dp
.pointType
: This parameter is of typePointType
and represents the type of point rendering on the chart. It can be eitherPointType.Stroke()
(hollow points) orPointType.Fill()
(filled points). The default value isPointType.Stroke()
.axisConfig
: This parameter is of typeAxisConfig
and allows customization of the axis appearance and labels on the chart. The default value isChartDefaults.axisConfigDefaults()
.radiusScale
: This parameter is of typeFloat
and represents the scale factor for the radius of the data points on the chart. The default value is0.02f
.contentColor
: This parameter is of typeColor
.chartColors
: This parameter is of typeChartColors
and allows customization of the chart's colors. The default value isChartDefaults.colorDefaults()
.