I believe I've found a bug in the gradient fill for SChartLineSeries
in 2.9.0-6. I've verified that the correct/expected behaviour works on 2.8.10. What appears to be happening is that when the 0 point of the vertical axis is on screen (or the middle of the chart) the gradient is rendering properly. When the axis is shifted (in my case I'm making 1.0 (100%) the middle of the vertical axis, the gradient is not rendering (or perhaps is using 0 as the bottom instead of 0.95 or where ever my graph's axis ends.
Here is the code creating the series:
SChartLineSeries *performanceCurrentSeries = [[SChartLineSeries alloc] init];
performanceCurrentSeries.style.showFill = YES;
performanceCurrentSeries.style.fillWithGradient = YES;
performanceCurrentSeries.style.areaLineWidth = @(_trendline ? 1.25f : 3.0f);
performanceCurrentSeries.style.areaLineColor = [UIColor greenColor];
performanceCurrentSeries.style.areaColor = [UIColor colorWithRed:0.0f green:1.0f blue:0.0f alpha:0.5f];
performanceCurrentSeries.style.areaColorLowGradient = [UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:0.1f];
performanceCurrentSeries.animationEnabled = NO;
performanceCurrentSeries.selectionMode = SChartSelectionPoint;
The code for calculating my min/max takes the largest delta and uses 0 or 1.0 as the centre:
largest *= 1.1f;
NSNumber *minimum = [NSNumber numberWithFloat:(self.comparisonType == GraphComparisonTypeBudget ? 1.0f - largest : -largest)];
NSNumber *maximum = [NSNumber numberWithFloat:(self.comparisonType == GraphComparisonTypeBudget ? 1.0f + largest : largest)];
self.performanceChart.yAxis = [[SChartNumberAxis alloc] initWithRange:[[SChartNumberRange alloc] initWithMinimum:minimum andMaximum:maximum]];
self.performanceChart.yAxis.labelFormatter.numberFormatter.numberStyle = NSNumberFormatterPercentStyle;
Here's how the Budget (100% centreline) graph renders on 2.8.10 [You can see gradient at top right a bit]:
Now with 2.9.0-6 the fill at the bottom has no gradient:
This doesn't happen with all graphs however. Here's 2.9.0-6 where 0.0 is the centreline:
For now I've had to keep our code at 2.8.10 to keep our graphs looking consistent.