Skip to content

[BUG] App crash with non changing data and gradient fill #44

@Tezekiel

Description

@Tezekiel

Steps to reproduce the behavior:
When using these datasets:

generateDataSet 1: Dataset(points=[DataPoint(x=0.0, y=0.4446), DataPoint(x=1.0, y=0.4446), DataPoint(x=2.0, y=0.4446), DataPoint(x=3.0, y=0.4446), DataPoint(x=4.0, y=0.4446), DataPoint(x=5.0, y=0.4446), DataPoint(x=6.0, y=0.4446), DataPoint(x=7.0, y=0.4446), DataPoint(x=8.0, y=0.4446), DataPoint(x=9.0, y=0.4446), DataPoint(x=10.0, y=0.4446), DataPoint(x=11.0, y=0.4446), DataPoint(x=12.0, y=0.4446), DataPoint(x=13.0, y=0.4446), DataPoint(x=14.0, y=0.4446), DataPoint(x=15.0, y=0.4446), DataPoint(x=16.0, y=0.4446), DataPoint(x=17.0, y=0.4446), DataPoint(x=18.0, y=0.4446), DataPoint(x=19.0, y=0.4446), DataPoint(x=20.0, y=0.4446), DataPoint(x=21.0, y=0.4446), DataPoint(x=22.0, y=0.4446), DataPoint(x=23.0, y=0.4446), DataPoint(x=24.0, y=0.4446), DataPoint(x=25.0, y=0.4446)])

generateDataSet 2: Dataset(points=[DataPoint(x=26.0, y=0.4446), DataPoint(x=27.0, y=0.4446)])

This will crash the app if you want to show gradient fill.
I think this happens in case of dataset 2 having same Y values as last dataset1 y value.
I have managed to create a quickfix with this code:

   .drawFill(withGradient = !isAllSame())

    private fun isAllSame(): Boolean {
        val pointY = dataSet2.points[0].y
        return dataSet2.points.all { it.y == pointY }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions