Version 2.8.7 (7-Apr-2016) breaks stackIndex from SChartColumnSeries


#1

We updated our app to the latest version 2.8.7. Now the stacked bar charts are broken when using the property stackIndex. New bars are shown randonmly with a gradient, values of the bars are wrong and the assigned colors are mixed up as well.

Please see the attached images. The one images shows the two series as two bars next to each other (without using stackIndex). The other image shows the problem with the stackIndex. Please help and provide a bug fix or workarround asap.

 


#2

Hi KK4iOS,

Sorry to hear you’re experiencing this issue.

Without seeing the data you’re supplying to the chart and how you’re setting up the series it’s a little difficult to determine what might be causing this.

Could you send a sample project to info@shinobicontrols.com and a member of our team will take a look?

Thanks,

Sam


#3

Dear Sam,

Shinobi should already be aware of that problem because Tati posted on May 26th 2016 a similar problem under the subject ‘Stacked bar graph on iOS’. 

As per your request the problem can be reproduced easily with your sample project ‘columneSeries’. Just use the data series and stackindex settings as I copied it into this post. One serie does have only one value the other serie does NOT have a value but why are two bars displayed?

The funny thing (and of course scary one for our app users) is that the same data series produces two different results depending if the iPad simulator runs for an iPad 2 or iPad Air. Maybe due to the use of a NSDictionary? Please also find attached the two screenshots with the simulator results. The screenshots show also that suddenly the bar have a gradient.

Please provide a workaround or a fixed version asap.

Thanks,

Klaus

===== Please run your sample project with the following setup ===============

//
 //  ViewController.m
 //  ColumnSeries
 //
 //  Created by Colin Eberhardt on 04/07/2013.
 //  Copyright (c) 2013 ShinobiControls. All rights reserved.
 //
 
 #import "ViewController.h"
 #import <ShinobiCharts/ShinobiCharts.h>
 
 @interfaceViewController () <SChartDatasource>
 
 @end
 
 @implementation ViewController
 {
     NSDictionary* _sales[2];
     ShinobiChart* _chart;
 }
 
 - (void)viewDidLoad
 {
     [superviewDidLoad];
     
 //    _sales[0] = @{@"Broccoli" : @5.65, @"Carrots" : @12.6, @"Mushrooms" : @8.4, @"Okra" : @0.0};
 //    _sales[1] = @{@"Broccoli" : @4.35, @"Carrots" : @13.2, @"Mushrooms" : @4.6, @"Okra" : @0.0};
 
 //    _sales[0] = @{@"Broccoli" : @5.1, @"Carrots" : @12.3, @"Mushrooms" : @8.5, @"Okra" : @0.0};
 //    _sales[1] = @{@"Broccoli" : @4.3, @"Carrots" : @13.4, @"Mushrooms" : @4.3, @"Okra" : @3.0};
 
     _sales[0] = @{@"Broccoli" : @0, @"Carrots" : @1, @"Mushrooms" : @0, @"Okra" : @0};
     _sales[1] = @{@"Broccoli" : @0, @"Carrots" : @0, @"Mushrooms" : @0, @"Okra" : @0};
     
     // Create the chart
     CGFloat margin = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) ? 20.0 : 50.0;
     _chart = [[ShinobiChartalloc] initWithFrame:CGRectMake(0, margin, self.view.bounds.size.width, self.view.bounds.size.height - margin)];
     _chart.title = @"Grocery Sales Figures";
     
     _chart.autoresizingMask =  ~UIViewAutoresizingNone;
     
     _chart.licenseKey = @""; // TODO: add your trial licence key here!
     
     // add a pair of axes
     SChartCategoryAxis *xAxis = [[SChartCategoryAxisalloc] init];
     xAxis.style.interSeriesPadding = @0;
     _chart.xAxis = xAxis;
     
     SChartAxis *yAxis = [[SChartNumberAxisalloc] init];
     yAxis.title = @"Sales (1000s)";
     yAxis.rangePaddingHigh = @1.0;
     _chart.yAxis = yAxis;
     
     
     // add to the view
     [self.viewaddSubview:_chart];
     
     _chart.datasource = self;
     
     // show the legend 
     _chart.legend.hidden = NO;
     _chart.legend.placement = SChartLegendPlacementInsidePlotArea;
 }
 
 #pragma mark - SChartDatasource methods
 
 - (NSInteger)numberOfSeriesInSChart:(ShinobiChart *)chart {
     return2;
 }
 
 -(SChartSeries *)sChart:(ShinobiChart *)chart seriesAtIndex:(NSInteger)index {
     SChartColumnSeries *columnSeries = [[SChartColumnSeriesalloc] init];
     columnSeries.stackIndex = @1;
     columnSeries.title = index == 0 ? @"2011" : @"2012";
     return columnSeries;
 }
 
 - (NSInteger)sChart:(ShinobiChart *)chart numberOfDataPointsForSeriesAtIndex:(NSInteger)seriesIndex {
     return_sales[seriesIndex].allKeys.count;
 }
 
 - (id<SChartData>)sChart:(ShinobiChart *)chart dataPointAtIndex:(NSInteger)dataIndex forSeriesAtIndex:(NSInteger)seriesIndex {
     SChartDataPoint *datapoint = [[SChartDataPointalloc] init];
     NSString* key = _sales[seriesIndex].allKeys[dataIndex];
     datapoint.xValue = key;
     datapoint.yValue = _sales[seriesIndex][key];
     return datapoint;
 }
 

@end

 

===== End ======


#4

Hi Klaus,

Thanks again for bringing this to our attention & I’m sorry for any inconvenience this may have caused. I have raised the priority of this issue in our back log.

The work around provided on the forum post you mentioned is still the best solution currently to get your stacked column chart to work in our latest version.

One thing to mention, in the other forum post they are using string categories where it looks like you are using dates. Have you tried implementing this on our DateTimeAxis?

Thank you for your feedback on our Column Series sample, I have passed this on to our developers. We really appreciate all the feedback we get from our customers. 

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


#5

Dear Andrew,

thank you for the confirmation that this is a bug and is getting prioritised resolution. We use SChartCategoryAxis as well (and not SChartDateTimeAxis). 

The stack index seems to work for SChartNumberAxis and SChartDateTimeAxis but then I see other side effects how the tickmark labels are displayed.

With SChartDateTimeAxis the date formatting changes randomly and we can’t really use the formatStringForFrequency: method because we would need to define for every country the string format and this is not possible.

With SChartNumberAxis the complete label must be reconstructed in -(void)sChart:alterTickMark:beforeAddingToAxis:.

Both is really a pain and we don’t know what dependencies we add from futurre updates?

We hope that you provide a new version before the official iOS 10 release where this stack index issue and the iPad Pro issue (mentioned in the post: iOS 10 bug with bar charts on iPad Pro 12.9 - bars don’t scroll but x axis tickmarks and labels) are both fixed, otherwise we would be really screwed with this framework.

We don’t have any special charts in our app but there have been always problems from version to version which we first need to identify and second need to find a workaround for it.  Meanwhile this becomes exhausting and has already cost us a lot of time and money.

Regards,

Klaus


#6

Hi Klaus,

I’m sorry to hear you’re having issues with our product - just to reiterate the point my colleague Andrew has already made, we will be seeking to tackle this issue as soon as possible. I hope the work-around is suitable for now. We will update this post once a fix has been made. 

As for the iOS 10 graphical issue, that will be fixed as part of our iOS 10 release. 

Kind regards,

Matt / iOS Developer