plot icon indicating copy to clipboard operation
plot copied to clipboard

Area chart with gradient colors

Open abhay-quickbit opened this issue 2 years ago • 2 comments

Is it possible to provide the gradient color to area chart?

abhay-quickbit avatar Jun 08 '22 11:06 abhay-quickbit

You can do this by overriding the draw field in AreaUnderLine. Like this, for example:

LinePlot.AreaUnderLine(draw = { path ->
    drawPath(path, brush = Brush.verticalGradient(listOf(Color.Red, Color.Yellow)))
})
Screen Shot 2022-09-22 at 16 15 52

thsaravana avatar Sep 22 '22 13:09 thsaravana

To be fair, it would be great to have native support instead of having to override the draw field. I am thinking of added Brush as a field, so that the user can either provider a Color or a Brush for all the components. This is going to be a breaking change if the client code is not parameterized, but it an easily fixable one. Adding to Milestone 0.2.0

thsaravana avatar Sep 22 '22 14:09 thsaravana