-
-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LineChart: how to display gradient below line #104
Comments
Can you be more specific, I'm not really sure what you mean. Have you noticed the method Regards, |
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 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?
The text was updated successfully, but these errors were encountered: