Can I add IGRelativeStrengthIndexIndicator to a chart that has IGSplineSeries? I tried it already but it does not work. Only the IGRelativeStrengthIndexIndicator is displayed on the chart.
There seems to be a problem. When i add the second yAxis it seems to get added to the left. The Axis values are not visible. See BadChart.png
Can you give me a complete example that has yAxis on both side of the chart like this
The relative strength indicator will change the range of the axis, typically to a 0-100 range. If your spline series data is above or below that range, you will not see it.Try using two separate Y axes, one for the spline series and one for the indicator.
Here's a quick example of having a spline and the indicator on the same chart, but different Y axes. Note, that the data isn't very useful, as there are only a few data points. The indicator needs to have quite a bit more points to make sense. This is primarily to illustrate the approach.
NSArray *data = @[@5, @6, @3]; NSArray *openValues = @[@5, @16, @15,]; NSArray *closeValues = @[@15, @6, @23]; NSArray *highValues = @[@20, @20, @29]; NSArray *lowValues = @[@1, @0, @5];
_chart = [[IGChartView alloc]initWithFrame:self.view.frame];
_categoryHelper = [[IGCategorySeriesDataSourceHelper alloc]initWithValues:data];
_ohlcHelper = [[IGOHLCSeriesDataSourceHelper alloc]initWithOpenValues:openValues highValues:highValues lowValues:lowValues andCloseValues:closeValues];
[_chart addSeriesForType:[IGSplineSeries class] usingKey:@"series" withDataSource:_categoryHelper firstAxisKey:@"x" secondAxisKey:@"y"]; [_chart addSeriesForType:[IGRelativeStrengthIndexIndicator class] usingKey:@"rsi" withDataSource:_ohlcHelper firstAxisKey:@"x" secondAxisKey:@"y2"];
[self.view addSubview:_chart];