MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

chart not rendered when line color is transparent but fill color is blue

Open john-stemberger opened this issue 1 year ago • 0 comments

Summary I would like to render a filled area that is blue but I do not want the solid line that forms the upper bounds of the line E.G:

Screenshot 2024-04-24 at 11 01 47 AM

instead of

Screenshot 2024-04-24 at 11 02 00 AM

To do this I set the DataSet color = transparent with fillColor = red/blue (fillAlpha = 25) but when I do this all the lines and fill regions disappear

Other things I have tried:

  1. setting the lineWidth = 0 but this leaves a very thin line at the top (1 px)
  2. setting the color to have the same alpha as fillAlpha but this leaves a slightly darker line at the top (due to the double painting)

Expected Behavior filled region should still render if the fill color is not transparent but the color is transparent

Possible Solution The root of the problem is that the LineChartRendered uses mRenderPaint when drawing the bitmap to the canvas (line 103) and the mRenderPaint color is set to transparent. Doing this results in the entire bitmap being rendered as transparent.

One possible solution would be to pass null instead of mRenderPaint

Device (please complete the following information):

  • Device: Pixel 6 Pro
  • Android Version: API 33
  • Library Version: 3.1.0

john-stemberger avatar Apr 24 '24 15:04 john-stemberger