shinobi图表中的堆积条形图和折线图

时间:2014-01-10 06:03:38

标签: ios iphone graph shinobi

我有一个报告图表,其中包含1个堆积条形图和3个折线图,在一个图表上有一个X和Y轴。我已经检查了一些shinobi图表控件,但我没想办法创建这样的图形。

PFA below a sample descprition

我已经检查了多轴代码,但它们似乎是两个独立的图表,有自己的交互和手势。我希望所有这些都能同时处理。

1 个答案:

答案 0 :(得分:1)

您在那里绘制的图表不需要多轴功能。相反,你有4个不同的系列 - 在2个堆叠组中。以下代码示例演示了如何使用SChartDatasource方法执行此操作:

- (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;
    }
}

这会将所有系列与相同的轴相关联,因此滚动和缩放会同时影响所有系列。

相关问题