Clicking on series does not always trigger the event handler

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
theyield
Newbie
Newbie
Posts: 16
Joined: Thu Sep 22, 2016 12:00 am

Clicking on series does not always trigger the event handler

Post by theyield » Mon Oct 10, 2016 12:52 am

Hi All,

Platform: Xamarin/iOS

I want my app to display a detailed information about each data point every time the user clicks on the point.
For this :
- I am setting <TChar>.ClickSeries to call my event handler every time the user clicks on the data point of the serie.
- I also setting <Serie>.ClickableLine to true to increase the 'tappable area'.

It works most of the time (70%) but in other times the user has to click may times before TeeChart calls my ClickSeries event handler.

Is this a bug ? otherwise how can I make sure that my event handler is always called.

Thanks
--maX

theyield
Newbie
Newbie
Posts: 16
Joined: Thu Sep 22, 2016 12:00 am

Re: Clicking on series does not always trigger the event handler

Post by theyield » Tue Oct 11, 2016 9:04 pm

Hi All,

My solution to this problem:
Since clicking on the serie data points was not reliable in my experience (it worked 70%). I did re-implement all the code using the TChart.ClickBackground event handler where I had more control. I am not using TChart.ClickSeries any more.

theChart.ClickBackground += (recognizer, touch) =>
{

CGPoint p = recognizer.LocationInView(<your view>);
... business logic based on the position of point p in <your view>
return true;
};

Thanks
--maX

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Clicking on series does not always trigger the event handler

Post by Pep » Thu Oct 13, 2016 10:05 am

Hello maX,

I'm glad to hear you've found a good solution to the problem.
Just let you know that we've been working on this area (improving the gesture event handlers) and also added a new ClickTolerance series property in order to help in these cases.
Changes will be included into the next maintenance release which will be published on our website during this month.

theyield
Newbie
Newbie
Posts: 16
Joined: Thu Sep 22, 2016 12:00 am

Re: Clicking on series does not always trigger the event handler

Post by theyield » Thu Oct 13, 2016 8:51 pm

Thanks Jorge,

Unfortunately it fixed one problem (detect where the Tap gesture recogniser is in relation to the graph) but broke the horizontal scrolling in the chart.

Below is my pseudo code. Where I want to do different actions depending if the gesture recogniser is tap or pane.

Code: Select all

bool theChart_ClickBackground(UIGestureRecognizer recognizer, UITouch touch)
		{
			var tap = recognizer as UITapGestureRecognizer;
			if (tap != null)
			{
				.. handle tap
				return true;
			}

			var pane = recognizer as UIPanGestureRecognizer;
			if (pane != null)
			{
				... handle scrolling
				return true;
			}
			return false;
		}
What is the meaning of ClickBackground return boolean?
Is there anything I can do to pass the touch ? (e.g recognizer.CancelsTouchesInView = false)
I tried all combinations of ClickBackground return true/false but none worked.
Even an empty ClickBackground broke the scrolling (I guess because it eats the pane begin touch event?)


Unfortunately we need to release next week

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Clicking on series does not always trigger the event handler

Post by Pep » Fri Oct 14, 2016 1:05 pm

Hello maX,

ok, I'm going to prepare an example that allows to show detail of data when the user taps over the series point and also that allows to scroll horizontally. I'll send asap.
What is the meaning of ClickBackground return boolean?
The event is defined as UITouchEventArgs which comes from the following Xamarin class :

Code: Select all

namespace UIKit
{
    //
    // Summary:
    //     A delegate used in conjunction with the UIKit.UIGestureRecognizer.ShouldReceiveTouch
    //     property.
    //
    // Parameters:
    //   recognizer:
    //     The recognizer that triggered this touch event.
    //
    //   touch:
    //     The actual touch event recognized.
    public delegate bool UITouchEventArgs(UIGestureRecognizer recognizer, UITouch touch);
}

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Clicking on series does not always trigger the event handler

Post by Pep » Tue Oct 18, 2016 2:40 pm

Hello maX,

just let you know that I've sent a mail directly to you with the example I mentioned above and a beta version of the next TeeChart for Xamarin.iOS maintenance release.

Post Reply