If the chart has only one value it will not draw anything and will crash the app if trying to zoom/pan

4 posts, 0 answers
  1. Oleg
    Oleg avatar
    8 posts
    Member since:
    Nov 2014

    Posted 18 Nov 2014 Link to this post

    Using this code the chart will not draw and if pan/zoom will crash every time:
    @implementation ViewController
    - (void)viewDidLoad {
        [super viewDidLoad];
        TKChart *chart = [[TKChart alloc] initWithFrame:CGRectInset(self.view.bounds, 30, 100)];
        chart.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        [self.view addSubview:chart];
        NSMutableArray *randomNumericData = [[NSMutableArray alloc] init];
        for (int i=0; i<1; i++) {
            [randomNumericData addObject:[[TKChartDataPoint alloc] initWithX:@(i) Y:@(arc4random()%100)]];


        }
        
        TKChartColumnSeries *series = [[TKChartColumnSeries alloc] initWithItems:randomNumericData];
        [chart addSeries:series];
        
        chart.delegate = self;
        
        chart.title.hidden = NO;
        chart.title.text = @"Testing a chart demo";
        chart.legend.hidden = NO;
        chart.xAxis.allowPan = YES;
        chart.xAxis.allowZoom = YES;
        


        chart.allowAnimations = NO;
    }
    @end

    2014-11-18 15:00:18.475 TelerikTestApplication[3189:29593567] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithCapacity:]: capacity (2147483650) is ridiculous'
    *** First throw call stack:
    (
    0   CoreFoundation                      0x00aba946 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x0073fa97 objc_exception_throw + 44
    2   CoreFoundation                      0x0097160e -[__NSPlaceholderArray initWithCapacity:] + 286
    3   TelerikTestApplication              0x0018553a get_range + 903
    4   TelerikTestApplication              0x00184e61 -[TKChartGridRender drawInContext:] + 296
    5   QuartzCore                          0x0136cc97 _ZL16backing_callbackP9CGContextPv + 96
    6   QuartzCore                          0x012514fe CABackingStoreUpdate_ + 2788
    7   QuartzCore                          0x0136cc2f ___ZN2CA5Layer8display_Ev_block_invoke + 93
    8   QuartzCore                          0x013a2416 x_blame_allocations + 15
    9   QuartzCore                          0x0136ca95 _ZN2CA5Layer8display_Ev + 1591
    10  QuartzCore                          0x0136cce6 -[CALayer _display] + 33
    11  QuartzCore                          0x0136c456 _ZN2CA5Layer7displayEv + 142
    12  QuartzCore                          0x0136ccc0 -[CALayer display] + 33
    13  QuartzCore                          0x01360ef6 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 322
    14  QuartzCore                          0x01360f7c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 38
    15  QuartzCore                          0x012bf3c6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
    16  QuartzCore                          0x012c078c _ZN2CA11Transaction6commitEv + 392
    17  QuartzCore                          0x012c0e58 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    18  CoreFoundation                      0x009dd9de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    19  CoreFoundation                      0x009dd920 __CFRunLoopDoObservers + 400
    20  CoreFoundation                      0x009d335a __CFRunLoopRun + 1226
    21  CoreFoundation                      0x009d2bcb CFRunLoopRunSpecific + 443
    22  CoreFoundation                      0x009d29fb CFRunLoopRunInMode + 123
    23  GraphicsServices                    0x0452424f GSEventRunModal + 192
    24  GraphicsServices                    0x0452408c GSEventRun + 104
    25  UIKit                               0x0149e8b6 UIApplicationMain + 1526
    26  TelerikTestApplication              0x000d9acd main + 141
    27  libdyld.dylib                       0x03451ac9 start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException








  2. Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 19 Nov 2014 Link to this post

    Hi Avner,

    Thank you for contacting us.

    The issue with drawing the chart in the case with only one data point is addressed and will be available in our next release. I can confirm that we have an issue when you try to zoom and the axis range is 0, like in the described scenario. I logged it and it will be addressed in our upcoming release that is scheduled for the end of this month. I updated your Telerik points for reporting this issue.

    Do not hesitate to contact us in case you need any help.

    Regards,
    Adrian
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Naos
    Naos avatar
    4 posts
    Member since:
    Sep 2014

    Posted 26 Sep in reply to Adrian Link to this post

    Hi Adrian,

    was this issue fixed? I have a chart with one data point and when I set chart.xAxis.zoom - it crashes. Also if I have chart.xAxis.allowPan = YES then it crashes when I pan it.

  5. Miroslava
    Admin
    Miroslava avatar
    19 posts

    Posted 27 Sep Link to this post

    Hello Naos,

    Thank you for contacting us.

    1. I was able to reproduce the issue when you use zoom property of xAxis. I logged it in our feedback portal. You can use the following link to track the issues status. 

    2. Currently we are not able to reproduce such issue with allowPan property. Could you please send us a code snippet or a sample project where the issue occurs? Thanks.

    If you need further assistance, do not hesitate to contact us.


    Regards,
    Miroslava
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner