Mix column and line series

5 posts, 2 answers
  1. Yunuen Sanchez
    Yunuen Sanchez avatar
    31 posts
    Member since:
    Aug 2009

    Posted 27 Oct 2015 Link to this post

    Is it possible to mix a column and a line series on the same chart? I did it on code but only the Column is displayed?

  2. Answer
    Yoanna
    Admin
    Yoanna avatar
    44 posts

    Posted 28 Oct 2015 Link to this post

    Hello, Yunuen, 

    thank you for contacting the iOS team.

    TKChart supports adding multiple series stacked one on top of another. In order to achieve this you need to add each series to the chart. 
    The following code snippet shows how this could be done:
    TKChart* chart = [[TKChart alloc] initWithFrame:self.view.frame];
    chart.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [self.view addSubview:chart];
     
    NSMutableArray *randomNumericData = [[NSMutableArray alloc] init];
     
    for (int i=0; i<10; i++) {
        [randomNumericData addObject:[[TKChartDataPoint alloc] initWithX:@(i) Y:@(arc4random()%100)]];
    }
     
    [chart addSeries:[[TKChartColumnSeries alloc] initWithItems:randomNumericData]];
    [chart addSeries:[[TKChartLineSeries alloc] initWithItems:randomNumericData]];

    Please, keep in mind that TKChart series are being rendered in the order they are added to the chart. If you add TKChartColumnSeries last it will show on top of every other series added. 
    To achieve the desired look you can also use TKChartSeriesStyle properties of which you can find more information here.

    If you have any questions do not hesitate to contact us.

    Regards,
    Yoanna
    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. DevCraft banner
  4. Yunuen Sanchez
    Yunuen Sanchez avatar
    31 posts
    Member since:
    Aug 2009

    Posted 28 Oct 2015 in reply to Yoanna Link to this post

    Thanks a lot Yoanna! My problem was related to the palette, the line was there but the color was the same as the background.

    I have one more question. I can't see the first and the last point of the line. Is it a natural behavior or am I missing something?

    I'm attaching the chart.

    Thanks

  5. Answer
    Yoanna
    Admin
    Yoanna avatar
    44 posts

    Posted 29 Oct 2015 Link to this post

    Hello, Yunuen,

    thanks for this update.

    By default TKChart is designed not to show the first and the last point. However you can control this behavior via style property called shapeMode.

    series.style.shapeMode = TKChartSeriesStyleShapeModeAlwaysShow;

    I hope this answers your question.
    If you need further assistance I will be glad to help.

    Regards,
    Yoanna
    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
  6. Yunuen Sanchez
    Yunuen Sanchez avatar
    31 posts
    Member since:
    Aug 2009

    Posted 29 Oct 2015 in reply to Yoanna Link to this post

    Working perfect now!

     Thanks Yoanna

Back to Top
DevCraft banner