Stacked bar chart and Line Chart in shinobi charts

2k Views Asked by At

I have a report chart that contains 1 stacked bar chart and 3 line charts on a single graph with one X and Y axis. I have checked some of the shinobi chart controls but i coud not figure out a way to create such graph.

PFA below a sample descprition

I have checked out the Multi axis code but they seem to be two independent charts with their own interactions and gestures. I want all of them to be handled at the same time.

1

There are 1 best solutions below

0
On

The chart you have drawn there does not require multiple axis functionality. Instead you have 4 distinct series - in 2 stacking groups. The following code sample demonstrates how to do this with the SChartDatasource method:

- (SChartSeries*)sChart:(ShinobiChart *)chart seriesAtIndex:(NSInteger)index {
    if(index == 3) {
        // Index 3 will be the line series
        SChartLineSeries* lineSeries = [[SChartLineSeries alloc] init];
        // Put it in the stack group indexed by the number 0
        lineSeries.stackIndex = @0;
        return lineSeries;
    } else { // index = 0, 1, 2
        // The other indices represent the columns
        SChartColumnSeries *columnSeries = [SChartColumnSeries new];
        // Put them all in the same stack group (indexed by the number 1)
        columnSeries.stackIndex = @1;
        return columnSeries;
    }
}

This will associate all the series with the same axes, and consequently scrolling and zooming will affect all series simultaneously.