cbartel
cbartel

Reputation: 1298

How to link a chart axis to a chart series using the Shinobi iOS SDK?

I added a secondary axis to my chart using addYAxis:(SChartAxis *)newYAxis. How do I get the second series linked to the new axis?

I found (BOOL)isLinkedToSeries:(SChartSeries *)series in SChartAxis.h. But how do I create the initial link?

Upvotes: 1

Views: 517

Answers (1)

sammyd
sammyd

Reputation: 893

When you have multiple axes on a ShinobiChart, then you can use the sChart:xAxisForSeriesAtIndex: and sChart:yAxisForSeriesAtIndex: on the SChartDataSource protocol.

For example, if you have 2 y-axes, and 2 series, and you want the first series associated with the first axes, and the second axis with the second series then implement the following method on your datasource:

- (SChartAxis *)sChart:(ShinobiChart *)chart yAxisForSeriesAtIndex:(int)index
{
    return chart.allYAxes[index];
}

Upvotes: 3

Related Questions