Charty
Charty copied to clipboard
Line drawn out of bounds on dataset update
Using a LineChart
, when the dataset is updated with a large value, the recomposition results in a line being drawn out of bounds.
LineChart(
lineData = pagesReadData,
color = MaterialTheme.colors.primaryVariant,
modifier = modifier
.height(250.dp)
.fillMaxWidth()
.padding(32.dp),
axisConfig = AxisConfig(
showAxis = true,
isAxisDashed = false,
showUnitLabels = true,
showXLabels = true,
xAxisColor = MaterialTheme.colors.onSurface,
yAxisColor = MaterialTheme.colors.onSurface,
)
)
Resultant:
ScreenCap: Out of bounds.webm
Please let me know if any other data is needed.
Hey buddy, thank you for this. Can you pass your dataset for me to replicate!
thanks
Initial Data:
LineData(xValue=23 Sep , yValue=10.0)
LineData(xValue=24 Sep , yValue=10.0)
Updated Data:
LineData(xValue=23 Sep , yValue=10.0)
LineData(xValue=24 Sep , yValue=10.0)
LineData(xValue=26 Sep , yValue=20.0)
Result:
Thank you, will check soon!
Hey @hi-manshu sorry to bug you, but any update on this?
Hey I will try to fix this by this weekend
Hi, I'm facing similar problem with CurveLineChart. When I load the follwing LineData, recomposition draw the CurveLine chart out of bounds.
LineData that I used.
listOf(
LineData(xValue = "23 Sep", yValue = 0.793f),
LineData(xValue = "24 Sep", yValue = 0.766f),
LineData(xValue = "25 Sep", yValue = 0.746f),
LineData(xValue = "26 Sep", yValue = 0.786f),
LineData(xValue = "27 Sep", yValue = 0.735f),
LineData(xValue = "28 Sep", yValue = 0.712f),
LineData(xValue = "29 Sep", yValue = 0.744f),
LineData(xValue = "30 Sep", yValue = 0.774f)
)
Fixed this issue in PR #55
Hi @AlexZhukovich ,
Tested the fix with your branch. Found that the issue still exist with the following LineData.
listOf(
LineData(xValue = "23 Sep", yValue = 0.793f),
LineData(xValue = "24 Sep", yValue = 0.766f),
LineData(xValue = "25 Sep", yValue = 0.746f),
LineData(xValue = "26 Sep", yValue = 0.786f),
LineData(xValue = "27 Sep", yValue = 0.735f),
LineData(xValue = "28 Sep", yValue = 0.712f),
LineData(xValue = "29 Sep", yValue = 0.744f),
LineData(xValue = "30 Sep", yValue = 0.774f)
)
@khaleeljageer I think here we have different issues. The initial issue is related to adding additional data and updating the chart component. In your case, the data is displaying incorrectly.