Search code examples
codenameone

Can the XYSeriesRenderer area be filled with gradient colors?


I need XYSeriesRenderer.FillOutsideLine to be filled with colors with gradients. For example,

An XYSeriesRenderer fills with green for BOUNDS_ABOVE and red for the BOUNDS_BELOW area. enter image description here

But I need the colors with gradients. Gradient blue for the BOUNDS_ABOVE area and Gradient red for the BOUNDS_BELOW area. enter image description here


Solution

  • No.

    You could potentially try to override drawSeries and copy the code that's there then replace the fill logic. Or alternatively do something hacky with drawPath but both aren't ideal.

    You can also add this feature into the code by editing the files in Codename One itself and submitting a PR.

    Notice that in the screenshot we have a translucent gradient which I don't think we support efficiently.