Shinobi chart not accessible when inside a scrollview


#1

My application shows an horizontally scrollable area which should contain two different chart implemented using the Shinobi libraries. As my paged Scrollview is made using ATPagingView, I included the chart using the following code:

- (NSInteger)numberOfPagesInPagingView:(ATPagingView *)pagingView {
    return 2;
}
    - (UIView *)viewForPageInPagingView:(ATPagingView *)pagingView atIndex:(NSInteger)index {

        // Instantiate a tutorial item controller and initialise with the proper content
        self.chartView = [[ShinobiChart alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
        chartView.title = @"example charts";
        chartView.autoresizingMask = ~UIViewAutoresizingNone;
        // Use a number axis for the x axis.
        SChartNumberAxis *xAxis = [[SChartNumberAxis alloc] init];
        chartView.xAxis = xAxis;
        // Use a number axis for the y axis.
        SChartNumberAxis *yAxis = [[SChartNumberAxis alloc] init];
        chartView.yAxis = yAxis;
        chartView.datasource = self;
        chartView.userInteractionEnabled = YES;
        return chartView;
    }

The chart gets displayed correctly but, when I try to scroll it, the scrollable container doesn’t move to show the second chart. The strange thing is that if I resize the chart in order to have some space to interact with the underlying container or if I do the same operation with a plain view like:

- (UIView *)viewForPageInPagingView:(ATPagingView *)pagingView atIndex:(NSInteger)index {

        // Instantiate a tutorial item controller and initialise with the proper content
        self.chartView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
        return chartView;
    }

well…it works perfectly. It looks like the ShinobiChart view is somehow intercepting the touch event and not forwarding to the scrollview. As you can notice I tried to activate the user interaction but it doesn’t work. Boxing the chart inside another view doesn’t work either.

Any idea?


#2

Hi Claus79,

I’m afraid this is a known issue, check this thread:

http://www.shinobicontrols.com/forum/shinobicontrols/2013/5/propagate-gesture-events-to-containing-controller-(shinobicharts)/


#3

Hi Claus79,

Boo-lee is correct, we are aware of this problem, but the problem itself is with pie and donut charts. Any other chart should work fine as long as your ensure that your chart’s pan type is set to none:

chart.gesturePanType = SChartGesturePanTypeNone;

This disables the gesture recognizer responsible for panning the chart, allowing your pan gestures to reach your containing scroll view.

Jan


#4

thanks a lot!


#5

I’m facing this problem in the newest version 2.3.0

Should it be fixed already ?

Tobias


#6

Hi Tobi,

We do plan to review this behaviour of our charts but there are a few workarounds. The following forum posts might help you:


Thanks,
Jan