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

area chart gradient help

1 Answer 100 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.
derrick
Top achievements
Rank 1
derrick asked on 02 Sep 2015, 08:34 PM
Can a gradient be applied to an area chart? I'm looking at the iOS demo app and the double curved area chart example has very faint gradients for the red and blue (see attahced). Can I specify what the gradient range should be with "hard" hex values or is there a way to define 1 hex value with opacity or alpha values, like 100% - 40% ? 

In the attached image the red is #fff3f3 (lightest) at the top -to- fbdfdd (darker)

1 Answer, 1 is accepted

Sort by
0
Sophi
Telerik team
answered on 03 Sep 2015, 06:52 AM
Hi Derrick,

Thank you for contacting us.

Yes, gradient can be applied on area chart. The gradients from the image are the default area colors that the chart uses, you can set your custom fill through the palette property of the series. Consider the following code snippet.
TKLinearGradientFill *fill = [TKLinearGradientFill
                                  linearGradientFillWithColors:@[[UIColor colorWithRed:0.f green:1.f blue:0.f alpha:0.6f],
                                                                 [UIColor colorWithRed:1.f green:0.f blue:0.f alpha:0.6f],
                                                                 [UIColor colorWithRed:0.f green:0.f blue:1.f alpha:0.6f]]];
    areaSeries.style.palette = [TKChartPalette new];
    TKChartPaletteItem *item = [[TKChartPaletteItem alloc] initWithFill:fill];
    [areaSeries.style.palette addPaletteItem:item];
You can read more about chart customizations in our online documentation. One of the topics in this article is exactly working with fills including gradients.

I hope this covers your case.
If you have any other questions, do not hesitate to contact us.

Regards,
Sophi
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
derrick
Top achievements
Rank 1
Answers by
Sophi
Telerik team
Share this question
or