SChartLineSeries gradient fill bug in 2.9.0-6?


#1

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.


#2

Hello HappyPanda,

Thanks for getting in touch!

I can confirm this is an issue with the latest version of our charts.

I have forwarded this issue to our development team who will investigate the issue further.

Due to this being the first time we’ve heard about this issue we currently don’t have a work around solution.

However, I have given this issue a high priority and informed the development team to notify this forum post when a version of charts containing this fix has been released.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


#3

Thanks Andrew,

Glad I actually found a bug, and it wasn’t my brain. :slight_smile:


#4

I think I’ve ran into this bug as well after trying to upgrade to 2.9.0-6.

I have a graph with y values that may not necessary start with zero. For example, 50-100. Instead of showing a nice gradient under our graph, it is now showing a solid color (the starting gradient color). And making it especially aesthetically displeasing, we have vertical panning/zooming enabled, and the area which was below the graphed area is showing no gradient at all if the user pans/zooms.

Please keep this issue a high priority.

Thank you.


#5

Hello HappyPanda & cbolton,

I can confirm we have found the source of this issue and have implemented a fix.

The fix will be contained in the next alpha release of ShinobiCharts.

We currently don’t have an exact date when we expect this to be released. However we will update this forum post when the alpha release is available to download from our customer portal.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


#6

Thanks Andrew, appreciate the update.


#7

@HappyPanda and @cbolton

We’ve just released an alpha version of the framework which should fix this issue with the baseline gradient. If you could download 2.9.1-ALPHA and let me know if you’re still seeing the issue that’d be very helpful.

Thanks,
Sam


#8

Hi @sburnstone and @MrAPolk,

The alpha build has fixed the issue for me. Thanks for the quick turnaround on the issue.
Can you please ping this thread when the official build is released?

Thanks


#9

No problem.

We’ll hopefully get the official build out later this week and I’ll try and remember to update this post :slight_smile: .


#10

The alpha release fixed it for me as well. Thanks!


#11

Hi all,

You should now be able to download the stable version of 2.9.1 from the portal now.

Please let us know if you have any further problems.

Sam