Closed ludriv closed 9 years ago
Can you be more specific, I'm not really sure what you mean.
Have you noticed the method setDrawFilled(boolean enabled)
in the LineDataSet
class?
Regards, Phil
Thanks for answering.
Yes, setDrawFilled(boolean enabled)
works but it's a plain color, I would like a gradient and, if possible, choose components colors and orientation.
Here an example
Hi @ludriv,
looks awesome! It would be great to have this feature!
@ludriv you can add a gradient shader to the mRenderPaint to do that. It works for me.
Looks very interesting, I'm thinking about adding this feature. In the meantime, you cand do a workaround like this (similar to what sy-tang mentioned):
Inside the library:
mRenderPaint.setShader(new LinearGradient(0, 0, 0, getHeight(), Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));
// data preparation...
// data drawing
mDrawCanvas.drawPath(..., mRenderPaint);
mRenderPaint.setShader(null);
Thanks it works!
I tried to do as you said Phil But it's doesn't work for me. Can you please tell me where to edit in LIbrary and how to Use it.? Thanks.
I want to do the same. Use a gradient below my line. How would this be possible
This I did this by modifying the drawFilledPath
method in the LineChartRenderer class like so:
Paint paint = new Paint();
paint.setShader(new LinearGradient(0, 0, 0, c.getHeight(), 0x80FFFFFF, 0x00FFFFFF, Shader.TileMode.CLAMP));
c.save();
c.clipPath(filledPath);
//int color = (fillAlpha << 24) | (fillColor & 0xffffff);
//c.drawColor(color);
c.drawPaint(paint);
c.restore();
I did it simply by adding setDrawableFilled which takes drawable as parameter. In that drawable, i've added gradient shape and It worked for me
@delhmela Did you got any way to do that.
@arpitgarg yeap I used MPAndroidChart and changed MPAndroidChart's codes )
@PhilJay animations are laggy in api 19 but without animations the app with the chart is quiet fast by the way thanks man great library.
Hello Phil, I want to draw gradient below line: line color with 1 or configurable alpha to line color 0 alpha. How can I do this?