YCharts
YCharts copied to clipboard
Not able to remove the extra space on the right of bar chart.
As shown in the image, when the labels of the x-axis are less in number, I want to end the rendering of graph at the end of last label. But it is taking the full width. Modifier.wrapContentwidth()
is not working.
PS. The red background is applied for the whole graph.
@buddha-buktare show me your code snippet.
@buddha-buktare show me your code snippet.
@lkant8
val barChartData = BarChartData(
chartData = chartData,
xAxisData = xAxisData,
yAxisData = yAxisData,
backgroundColor = Color.Transparent,
barStyle = BarStyle(
barWidth = barWidth,
cornerRadius = 4.dp,
paddingBetweenBars = paddingBetweenBars,
selectionHighlightData = null,
),
paddingEnd = 0.dp,
drawBar = { drawScope, barChartData, drawOffset, height, barChartType, barStyle ->
drawCustomBarGraph(
drawScope,
barChartData,
drawOffset,
height,
barChartType,
barStyle
)
}
)
Box(
modifier = modifier,
contentAlignment = Alignment.Center,
) {
BarChart(
modifier = Modifier
.height(300.dp)
.background(Color.White),
barChartData = barChartData,
)
}