This is a migrated thread and some comments may be shown as answers.

Apply gradient to AreaSeries

1 Answer 64 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MG
Top achievements
Rank 1
MG asked on 29 May 2015, 06:53 AM
Hello, I wonder if you can apply a color gradient to the AreaSeries chart type? If so, how it should do?

1 Answer, 1 is accepted

Sort by
0
Accepted
Victor
Telerik team
answered on 02 Jun 2015, 07:41 AM
Hi Francisco,

Thanks for writing.
I already answered your question in your support ticket about the same issue.
Here is the example again, in case some one else is looking for it:
public class CustomAreaSeries extends AreaSeries {
    @Override
    public void render(Canvas canvas) {
        Paint paint = new Paint();
        RectF plotArea = Util.convertToRectF(this.chart.getPlotAreaClip());
        paint.setShader(new LinearGradient(plotArea.left, plotArea.centerY(), plotArea.right, plotArea.centerY(), Color.RED, Color.GREEN, Shader.TileMode.CLAMP));
        AreaRendererBase renderer = (AreaRendererBase)this.getRenderer();
        renderer.setFillPaint(paint);
        super.render(canvas);
    }
}


Regards,
Victor
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
MG
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or