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

Line series with multiple color datapoint

5 Answers 69 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.
ramya
Top achievements
Rank 1
ramya asked on 06 Jun 2015, 05:46 AM

Hi 

 

1)How to give customise color in line series.

2)Is there a way to change a multiple colors of datapoint in single line series in iOS Native .

 

Regards,

Ramya.

5 Answers, 1 is accepted

Sort by
0
Sophi
Telerik team
answered on 08 Jun 2015, 10:32 AM
Hello Ramya,

Thank you for contacting us.

You can give custom color to TKChartLineSeries by adding a custom TKChartPaletteItem to the palette property of TKChartLineSeries.
TKChartLineSeries* seriesForIncomes = [[TKChartLineSeries alloc] initWithItems:pointsWithCategoriesAndValues];
seriesForIncomes.style.palette = [[TKChartPalette alloc] init];
TKChartPaletteItem *item = [[TKChartPaletteItem alloc] init];
item.stroke = [TKStroke strokeWithColor:[UIColor purpleColor]];
[seriesForIncomes.style.palette addPaletteItem:item];

Yes, there is a way to set different color for every datapoint in your chart. You should adopt TKChartDelegate protocol and implement its chart:paletteItemForPoint:inSeries:  method. 

-(TKChartPaletteItem *)chart:(TKChart *)chart paletteItemForPoint:(NSUInteger)index inSeries:(TKChartSeries *)series{
    NSArray *colors = [NSArray arrayWithObjects:[UIColor blackColor], [UIColor greenColor], [UIColor redColor], [UIColor orangeColor], [UIColor yellowColor], [UIColor brownColor], nil];
    TKChartPaletteItem *item = [[TKChartPaletteItem alloc] init];
    item.fill = [TKSolidFill solidFillWithColor:[colors objectAtIndex:index]];
    return item;
}

I hope this helps.
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
0
ramya
Top achievements
Rank 1
answered on 08 Jun 2015, 11:26 AM
Thank you so much.
0
Sophi
Telerik team
answered on 08 Jun 2015, 12:16 PM
Hey Ramya,

I am glad I was able to help. If you have 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
0
Doug
Top achievements
Rank 1
answered on 29 Mar 2017, 01:25 PM
need this in vb.net
0
Deyan
Telerik team
answered on 31 Mar 2017, 10:24 AM
Hello,

We do not provide VB.NET code samples but you could use a online converter to do the conversion.

Regards,
Deyan
Telerik by Progress
Want to build beautiful Android apps as well? Check out UI for Android which enables the same set of scenarios, allowing you to create the same great app experience on both iOS and Android.
Tags
Chart
Asked by
ramya
Top achievements
Rank 1
Answers by
Sophi
Telerik team
ramya
Top achievements
Rank 1
Doug
Top achievements
Rank 1
Deyan
Telerik team
Share this question
or