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

Mix column and line series

4 Answers 47 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.
Yunuen Sanchez
Top achievements
Rank 1
Yunuen Sanchez asked on 27 Oct 2015, 06:07 AM

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?

4 Answers, 1 is accepted

Sort by
0
Accepted
Yoanna
Telerik team
answered on 28 Oct 2015, 09:15 AM
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
0
Yunuen Sanchez
Top achievements
Rank 1
answered on 28 Oct 2015, 05:24 PM

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

0
Accepted
Yoanna
Telerik team
answered on 29 Oct 2015, 12:12 PM
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
0
Yunuen Sanchez
Top achievements
Rank 1
answered on 29 Oct 2015, 05:01 PM

Working perfect now!

 Thanks Yoanna

Tags
Chart
Asked by
Yunuen Sanchez
Top achievements
Rank 1
Answers by
Yoanna
Telerik team
Yunuen Sanchez
Top achievements
Rank 1
Share this question
or