sChartDidFinishZooming isn't fired, am I missing something?


#1
UIView *chart3View = [[UIView alloc] initWithFrame: CGRectMake (128, 638, 866, 128)];
    chart3 = [[ShinobiChart alloc] initWithFrame:chart3View.frame];
    chart3.title = @"Periode";
    
   //_chart2.autoresizingMask = ~UIViewAutoresizingNone;
    
        
    // add a pair of axes
    SChartDateTimeAxis *xAxis3 = [[SChartDateTimeAxis alloc] init];
    chart3.xAxis = xAxis3;
    
    SChartNumberAxis *yAxis3 = [[SChartNumberAxis alloc] initWithRange:[[SChartNumberRange alloc] initWithMinimum:[NSNumber numberWithDouble:minY] andMaximum:[NSNumber numberWithDouble:maxY]]];
    chart3.yAxis = yAxis3;
    
    chart3.xAxis.enableGestureZooming = YES;
    //chart3.yAxis.enableGestureZooming = YES;
        
    chart3.datasource = self;
    
        chart3.delegate = self;
        
    [self.view addSubview:chart3];
    (...)
  • (void)sChartDidFinishZooming:(ShinobiChart *)chart

{

    NSLog(@“didfinishzooming fired”);

    if( chart == chart3 )

    {

        //        chart.autoCalculateAxisRanges = NO;

        [_chart reloadData];

        [_chart redrawChart];

        [_chart2 reloadData];

        [_chart2 redrawChart];

    }

}


#2

Hi NeoSylvain,

You’ve correctly set the delegate property on the chart, so the method you have defined should be being called. Does the chart render as expected? If you’re adding chart3 as a subview of chart3View, then I’d expect it to look a little weird because you have created the chart with the same frame as its container view. This might make more sense:

UIView *chart3View = [[UIView alloc] initWithFrame: CGRectMake (128, 638, 866, 128)];
chart3 = [[ShinobiChart alloc] initWithFrame:chart3View.bounds];

You also haven’t actually added chart3 as a subview of anything, but I expect that that is because you have just given a sample of the code.

Some things that might be worth trying:

  1. Do any of the delegate methods get called?
  2. Does the zooming delegate method get called for any of the other charts?
  3. Do any other delegte methods get called for other charts?
  4. Do you also need to implement the equivalent delegate method for panning?

Sorry I can’t be more specific. If you still can’t get it to work as expected it might be worth posting a simple project which demonstrates your problem, or contacting the Shinobi support team, with your project file.

_sam