Charty icon indicating copy to clipboard operation
Charty copied to clipboard

Line drawn out of bounds on dataset update

Open sanskar10100 opened this issue 2 years ago • 9 comments

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: Screenshot_20220923_195016

ScreenCap: Out of bounds.webm

Please let me know if any other data is needed.

sanskar10100 avatar Sep 23 '22 14:09 sanskar10100

Hey buddy, thank you for this. Can you pass your dataset for me to replicate!

thanks

hi-manshu avatar Sep 23 '22 16:09 hi-manshu

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: image

sanskar10100 avatar Sep 26 '22 06:09 sanskar10100

Thank you, will check soon!

hi-manshu avatar Sep 26 '22 07:09 hi-manshu

Hey @hi-manshu sorry to bug you, but any update on this?

sanskar10100 avatar Oct 12 '22 11:10 sanskar10100

Hey I will try to fix this by this weekend

hi-manshu avatar Oct 12 '22 12:10 hi-manshu

Hi, I'm facing similar problem with CurveLineChart. When I load the follwing LineData, recomposition draw the CurveLine chart out of bounds.

Screenshot from 2022-10-29 17-41-21

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)
)

khaleeljageer avatar Oct 29 '22 12:10 khaleeljageer

Fixed this issue in PR #55

AlexZhukovich avatar Oct 29 '22 13:10 AlexZhukovich

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 avatar Oct 29 '22 15:10 khaleeljageer

@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.

AlexZhukovich avatar Oct 30 '22 07:10 AlexZhukovich