Chart causes crash if partial datasets are drawn before a full dataset


#1

Our chart uses multiple series’ types (SChartColumnSeries, SChartLineSeries, and SChartBandSeries).  The SChartColumnSeries are full datasets covering the entire chart.  But the SChartBandSeries and SChartLineSeries are sometimes partial datasets because we need a discontinuous line to be shown.  The issue we have noticed is the chart will crash if partial datasets are drawn before a full dataset.

For example, we have a chart with category labels of “8 AM”, “9 AM”, “10 AM” using a SChartCategoryAxis as the x-axis.  If we draw a SChartBandSeries with a partial dataset only covering “9 AM” the chart will crash.  We need to draw the SChartBandSeries first in order to get the Z ordering correct (to be the bottom most series).

The crash does not happen if we reorder the series and draw the SChartColumnSeries first and the partial datasets after that.

Does anyone have any ideas for how best to work around this bug?

"ShinobiCharts - Version: 2.8.5-3, Edition: Premium, Release Date: Nov 10 2015

2016-04-07 15:02:37.514 [2642:753601] *** Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘*** -[__NSArrayM objectAtIndex:]: index 14 beyond bounds [0 … 13]’
*** First throw call stack:
(
    0   CoreFoundation                      0x0557da14 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x0503ee02 objc_exception_throw + 50
    2   CoreFoundation                      0x05449703 -[__NSArrayM objectAtIndex:] + 243
    3                                0x00b9ccf4 -[SChartBarColumnSeries drawBin:withDrawer:withGLBaseline:andGLTranslation:currentRenderIndexDict:] + 1812
    4                                0x00b643fd -[SChartMappedSeries drawWithCanvas:withGLBaseline:andGLTranslation:] + 1405
    5                                0x00c21466 -[SChartMappedSeriesGroup drawSingleSeries:onChart:] + 358
    6                                0x00c15eff -[SChartCartesianSeriesGroup drawStackedSeries:onChart:] + 159
    7                                0x00c162e7 -[SChartCartesianSeriesGroup drawSeriesOnChart:] + 951
    8                                0x00be5ee5 -[SChartCanvas drawChart:] + 3525
    9                                0x00be0795 -[SChartCanvasRenderView drawRect:] + 85
    10  UIKit                               0x0373d9db -[UIView(CALayerDelegate) drawLayer:inContext:] + 513
    11  QuartzCore                          0x0336e366 -[CALayer drawInContext:] + 279
    12  QuartzCore                          0x0336dc75 _ZN2CA5Layer8display_Ev + 667
    13  QuartzCore                          0x0336e24a -[CALayer _display] + 33
    14  QuartzCore                          0x0336d9d2 _ZN2CA5Layer7displayEv + 142
    15  QuartzCore                          0x0336e224 -[CALayer display] + 33
    16  QuartzCore                          0x033622d8 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 326
    17  QuartzCore                          0x0336235e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 38
    18  QuartzCore                          0x03354e8b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 317
    19  QuartzCore                          0x03388e03 _ZN2CA11Transaction6commitEv + 561
    20  QuartzCore                          0x033896c4 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    21  CoreFoundation                      0x05496ffe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    22  CoreFoundation                      0x05496f5e __CFRunLoopDoObservers + 398
    23  CoreFoundation                      0x0548c8dc __CFRunLoopRun + 1340
    24  CoreFoundation                      0x0548c0e6 CFRunLoopRunSpecific + 470
    25  CoreFoundation                      0x0548befb CFRunLoopRunInMode + 123
    26  GraphicsServices                    0x07076664 GSEventRunModal + 192
    27  GraphicsServices                    0x070764a1 GSEventRun + 104
    28  UIKit                               0x03671bfa UIApplicationMain + 160
    29                               0x002421ba main + 138
    30  libdyld.dylib                       0x05feda21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException


#2

Hi cdownes,

Sorry to hear you’re experiencing this crash and apologies it’s taken us a while to respond to you. 

Unfortunately, without knowing the data you are providing to each series, it’s a little tricky to determine what the cause of the issue is. Would it be possible for you to send in a sample project to info@shinobicontrols.com which demonstrates the crash and we’ll take a look as soon as we can?

Many thanks,

Sam