This question is locked. New answers and comments are not allowed.
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
@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