To use the StackedBarChart, follow the steps below:
- Include the Charty library in your Android project.
- Use the
StackedBarChart
composable in your code:
@Composable
fun StackedBarChart(
stackBarData: ComposeList<StackBarData>,
modifier: Modifier = Modifier,
axisConfig: AxisConfig = ChartDefaults.axisConfigDefaults(),
padding: Dp = 16.dp,
spacing: Dp = 4.dp,
textLabelTextConfig: ChartyLabelTextConfig = ChartDefaults.defaultTextLabelConfig(),
)
stackBarData
: This parameter is of typeComposeList<StackBarData>
and represents the data that will be plotted on the stacked bar chart. It contains a list ofStackBarData
objects.modifier
: This parameter is of typeModifier
.axisConfig
: This parameter is of typeAxisConfig
and allows customization of the axis appearance and labels on the chart. It provides options to configure the axis color, stroke width, and label count, among others. The default value isChartDefaults.axisConfigDefaults()
.padding
: This parameter is of typeDp
and represents the padding around the chart. The default value is16.dp
.spacing
: This parameter is of typeDp
and represents the spacing between the stacked bars. The default value is4.dp
.textLabelTextConfig
: This parameter is of typeChartyLabelTextConfig
and allows customization of the text labels on the chart. The default value isChartDefaults.defaultTextLabelConfig()
.