OGeek|极客世界-中国程序员成长平台

标题: ios - shinobi 图表中的堆积条形图和折线图 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 18:00
标题: ios - shinobi 图表中的堆积条形图和折线图

我有一个报表图表,其中包含 1 个堆积条形图和 3 个折线图,位于一个带有 X 轴和 Y 轴的单个图表上。我已经检查了一些 shinobi 图表控件,但我无法找到创建此类图表的方法。

PFA below a sample descprition

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



Best Answer-推荐答案


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

- (SChartSeries*)sChartShinobiChart *)chart seriesAtIndexNSInteger)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;
    }
}

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

关于ios - shinobi 图表中的堆积条形图和折线图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21037235/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4