SChartDelegate zooming support not there anymore?


#1

Hi there,

In a previous test version (2.9.8), we had a subclass of SChartDelegate overriding these 3 methods:

    public override void DidStartPanning(ShinobiChart chart)
    {
        ...
    }

    public override void DidStartZooming(ShinobiChart chart)
    {
        ...
    }

    public override void DidResetZoom(ShinobiChart chart)
    {
        ...
    }

However, it seems that they’re not there anymore in the latest version (2.10.1). Is there a link pointing to such changes and perhaps guidelines on how to “replace” those methods?

Thanks in advance!

Regards,
Sylvain


#2

As a follow-up, I just read the CHANGELOG.txt file and it says that from 2.9.8 to 2.10.0, a bunch of deprecated methods were removed, including the 3 that I listed above.

Now my question is, what’s the proper way to evolve away from this (or adapt) going forward?

Best regards,
Sylvain


#3

Hi @spatenaude,

Those methods were deprecated in v2.8.5 (November 2015) and removed in v2.10.0 (June 2018). The intention was to simplify the delegate methods relating to range changes.

-sChart:didAlterRangeOnAxis: should cover most cases where the chart is panning or zooming.
-sChart:didFinishAnimatingAxis: may also be a helpful entry point.

If you’re not sure how to use these methods in place of your previous implementations, could you let us know what your previous implementations were doing so we can try to help you further?

Kind regards,

Alison


#4

Hi @aclarke ,
I tried using the 2 methods you mentioned above, but there is still some behavior that is not the same as before. I’ll try explaining what it is we want to do.

Basically, we have a chart that auto-updates itself with data that is continuously polled, but as soon as the user pans or zooms in the chart (on former “DidStartPanning” and “DidStartZooming” callbacks), the polling/auto-update is paused. It would then resume on the former “DidResetZoom” callback. which is probably on a “bounce back” or when the chart returns to its original zoom factor (no zoom in or out).

Regards,
Sylvain


#5

Edit: I didn’t notice this before because I’m not that familiar yet with our app, but the way to resume the polling, a.k.a. triggering the former ‘DidResetZoom’ method, is to double-tap on the chart.

Edit 2: So basically, what I would ideally need is the callback/method/delegate that is called/triggered on a double-tap on the chart with our actual API (shinobi charts 2.10.1).


#6

Hi @spatenaude,

Thanks for the clarification.

If you’re responding to the user’s gesture’s, you may be better off using SChartGestureManager. You could add your own targets and selectors to the pinchAndPanGesture to pause the polling, and to the doubleTapGesture to restart it when the user double-taps.

There’s an example of how to use the gesture manager in this post.

I hope that helps.

Alison


#7

Hi @aclarke

I tried using the SChartGestureManager and its 2 recognizers that you mentioned (PinchAndPanGesture and DoubleTapGesture) and it seems to work fine (by adding some target methods), so a big thanks for that!

Now there’s a specific case where I need to distinguish between Pan and Zoom for the PinchAndPanGesture, so I’m looking into it right now.

Best regards,
Sylvain


#8

FYI, I’m still trying to distinguish between Pan and Zoom, so if someone has any idea, I’m all ears.

Once I use ‘PinchAndPanGesture’ to add a target/callback, I would’ve thought that I could query a status of the chart (or parameter of the target/callback function) to get the zooming and or panning status.

The other way to approach this issue would be to use different gestures, but it seems that they’re bundled together with the ‘PinchAndPanGesture’.

Anyway, still digging…


#9

In the latest doc (https://www.shinobicontrols.com/docs/ios/shinobicharts/latest/zooming-and-panning.html), they’re referring to a ‘sChartIsZooming’ method (which looks like a protocol method) and also ‘isPanning’ and ‘isZooming’ methods. I can’t find these methods though…


#10

Also, I was wondering, no compile or runtime error since we’re overriding methods that don’t exist anymore??
Such as:
[Export(“sChartDidStartPanning:”)]
protected virtual void DidStartPanning(ShinobiChart chart)
{

}


#11

Hi @spatenaude,

The best way to do this is to record the value of the axes’ -zoom in -sChart:didAlterRangeOnAxis:, so you can detect whether the zoom levels are changing, and then flag whether you’re in the middle of a pan or zoom.

I’m really sorry about that: it looks like we didn’t update that section of the user guide when we changed the API. I’ve logged this and we’ll do our best to fix it in the next release.

The methods were implementations of protocol methods rather than overrides, so now that those methods aren’t in the protocol, they’re just methods in your class, that don’t get called by anything.


#12

Ok thanks for the replies @aclarke!

We were able to simplify our code in a way that we don’t need anymore to distinguish between pan and zoom user actions, so sChart:didAlterRangeOnAxis: will do the job just fine!