Line series with multiple color datapoint

Thread is closed for posting
6 posts, 0 answers
  1. ramya
    ramya avatar
    2 posts
    Member since:
    Jun 2015

    Posted 06 Jun 2015 Link to this post

    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.

  2. Sophi
    Admin
    Sophi avatar
    103 posts

    Posted 08 Jun 2015 Link to this post

    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
  3. ramya
    ramya avatar
    2 posts
    Member since:
    Jun 2015

    Posted 08 Jun 2015 in reply to Sophi Link to this post

    Thank you so much.
  4. Sophi
    Admin
    Sophi avatar
    103 posts

    Posted 08 Jun 2015 Link to this post

    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
  5. Doug
    Doug avatar
    97 posts
    Member since:
    Aug 2014

    Posted 29 Mar in reply to Sophi Link to this post

    need this in vb.net
  6. Deyan
    Admin
    Deyan avatar
    2142 posts

    Posted 31 Mar Link to this post

    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.
Back to Top