Shinobi barchart crosshair NSRangeException


#1

Hi I am using Shinobi barchart where Y axis is number and X axis is Years .

I have enabled crosshair : 

colSeries.crosshairEnabled = YES;

But when I press on bar I get following exception: 

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 2009 beyond bounds [0 .. 4]'

Workaround but not working in all cases

As a work around, I created my own UIView ((CMPopTipView) just like crosshair and pop my view in the following method. I am using pixepPoint x and y to display CMPopTipView coordinates. But it looks like pixelPoint.x is way off. It has a value of 101532 but pixelPoint.y is corrent with value of 28. How I resolve this issue so that my CMPopTipView is positioned right above the bar I selected.

- (void)sChart:(ShinobiChart *)chart toggledSelectionForPoint:(SChartDataPoint *)dataPoint inSeries:(SChartSeries *)series atPixelCoordinate:(CGPoint)pixelPoint{
     NSLog(@"I am toggledSelectionForPoint");
    SChartPoint point;
    point.x = [dataPoint.xValue doubleValue];
    point.y = [dataPoint.yValue doubleValue];
    //self.graphSelectionLabel.text = [NSString stringWithFormat:@"Year: %d, Procedures: %d",(int) point.x,(int)point.y];
    
    
    [self dismissAllPopTipViews];
    CMPopTipView *popTipView = [[CMPopTipView alloc] initWithTitle:@"" message:[NSString stringWithFormat:@"Year: %d, Procedures: %d",(int) point.x,(int)point.y]];
    popTipView.textFont = [UIFont fontWithName:@"Heiti SC" size: 14.0f];
    popTipView.textColor = [UIColor whiteColor];
    popTipView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7];
    //popTipView.has3DStyle = YES;
    popTipView.preferredPointDirection = PointDirectionDown;
    
    UIView *v = [[UIView alloc] initWithFrame:CGRectMake((int)pixelPoint.x, (int)pixelPoint.y, 5, 5)];
    v.backgroundColor = [UIColor blackColor];
    NSLog(@"%d",(int)pixelPoint.x);
    NSLog(@"%d",(int)pixelPoint.y);

    [_graph addSubview:v];
    [self.visiblePopTipViews addObject:popTipView];
    //[self.visiblePopTipViews addObject:v];
    

    [popTipView presentPointingAtView:v inView:graphView animated:YES];
    popTipView.animation = arc4random() % 2;
    popTipView.has3DStyle = (BOOL)(arc4random() % 2);
    
    popTipView.dismissTapAnywhere = YES;
    //[v removeFromSuperview];
    [popTipView autoDismissAnimated:YES atTimeInterval:3.0];

#2

Same problem we all are facing : http://www.shinobicontrols.com/forum/shinobicontrols/2013/8/shinobi-charts-release-23-broke-my-crosshairs-(-and-cross-hair-labels/?nf=true#comment23827  :confused: :cry:


#3

Hi,

Thank you for raising this issue. We shall investigate at this end, and see if we can replicate the problem.

Many thanks,

Dan


#4

Hi all,

We’re putting together a bug fix release which should address this issue. Once that is out, we shall let you know.

Many thanks,

Dan


#5

Hi all,

We’ve now released version 2.5.6 of charts, which should address this issue.

Many thanks,

Dan