Heya folks,
Another question from me. I am working on my second app using TeeChart for .NET on iOS and with MonoTouch. In my first app, an iPhone/iPod Touch only app, we experienced a problem where putting a chart that took up the entire screen on the view controller would not allow us to scroll or use swipe gestures. We eventually found that if we made the chart a bit smaller and swiped in the area not occupied by the chart's rectangle, we could actually use the swipe and/or scroll gestures.
On my new app, an iPad only app, I am having the same problem. If I try to swipe or scroll when starting with my finger on one of the charts, the page will not scroll or swipe (actually, only scroll in this case - we don't have swipe gestures, just a uiscrollview that the charts are being added to). I have a page that contains 7 different charts. If I scroll making sure to touch between them, it works fine. Unfortunately, this is not very user friendly because users don't think to start their scroll in between graphs.
I understand that this is probably related to the fact that the Charts have their own scrolling capabilities. But I have disabled all scrolling and panning in them. Is there another way to tell the charts to completely ignore the touch, swipe or scroll and allow the page to handle it?
Thanks!
Bob
Scrolling on iOS with TChart on page.
Re: Scrolling on iOS with TChart on page.
Hi Bob,
I remember I did some tests related with that.
I think you should be able to accomplish it by adding manually the gestures to the Chart object. As the Chart inherits from a UIView you can add specific gestures to it as if it was a standard UIView, something like :
Another way could be to use the clickBackGround event of the Chart object, and once it's fired check whether recognizer is a PanGesture, Tap, or other, and do the necessary work. Something like :
Please check if this helps, and let me know something in the case you still having problems.
I remember I did some tests related with that.
I think you should be able to accomplish it by adding manually the gestures to the Chart object. As the Chart inherits from a UIView you can add specific gestures to it as if it was a standard UIView, something like :
Code: Select all
UIPanGestureRecognizer onmove;
onmove = new UIPanGestureRecognizer(this,new MonoTouch.ObjCRuntime.Selector("PanGesture"));
onmove.Delegate = new PanGestureDelegate();
chart.AddGestureRecognizer(onmove);
public class PanGestureDelegate : UIGestureRecognizerDelegate
{
public override bool ShouldReceiveTouch(UIGestureRecognizer aRecogniser, UITouch aTouch)
{
return true;
}
}
Code: Select all
private bool chart_clickBackGround(UIGestureRecognizer recognizer, UITouch touch)
{
//Console.WriteLine("BackGround clicked");
return false;
}
chart.ClickBackground += new UITouchEventArgs(chart_clickBackGround);
Pep Jorge
http://support.steema.com
http://support.steema.com
Re: Scrolling on iOS with TChart on page.
Josep,
Sorry, it's been a while since I looked at this issue. Sometimes I don't get notified when you guys respond.
Ok, so you referenced doing some testing of this before. I believe you worked on a problem we had where touching on a series and then trying to pan the chart would cause a crash. You confirmed the bug, issued a new DLL and that was fixed. This is a different problem, however. This is an issue where when you place a chart rectangle on a view and then try to scroll the view, it will not work if you are trying from anywhere on the chart rectangle. I have a page where I layout about 7 - 9 different charts in two columns. If the user tries to scroll from the majority of the view (which is taken up mostly by the charts) it will not work. However, if they strategically put their finger between the charts and scroll, it works. It also works between two charts (one above another) when touching the space between then. And it works on the left and right margins of the view. In the image below, the green areas represent every where that I you can touch to start a scroll.
If this is not making sense, please let me know. Or just put a chart or two on a uiscrollview and try to scroll. You'll see what I mean.
Bob
Sorry, it's been a while since I looked at this issue. Sometimes I don't get notified when you guys respond.
Ok, so you referenced doing some testing of this before. I believe you worked on a problem we had where touching on a series and then trying to pan the chart would cause a crash. You confirmed the bug, issued a new DLL and that was fixed. This is a different problem, however. This is an issue where when you place a chart rectangle on a view and then try to scroll the view, it will not work if you are trying from anywhere on the chart rectangle. I have a page where I layout about 7 - 9 different charts in two columns. If the user tries to scroll from the majority of the view (which is taken up mostly by the charts) it will not work. However, if they strategically put their finger between the charts and scroll, it works. It also works between two charts (one above another) when touching the space between then. And it works on the left and right margins of the view. In the image below, the green areas represent every where that I you can touch to start a scroll.
If this is not making sense, please let me know. Or just put a chart or two on a uiscrollview and try to scroll. You'll see what I mean.
Bob
Re: Scrolling on iOS with TChart on page.
Hi Bob,
ok, I'm going to check with an example, disabling the gestures for Chart should be the trick.
I'll send the results asap..
ok, I'm going to check with an example, disabling the gestures for Chart should be the trick.
I'll send the results asap..
Pep Jorge
http://support.steema.com
http://support.steema.com
Re: Scrolling on iOS with TChart on page.
Thanks again Josep! Your help is very much appreciated!Pep wrote:Hi Bob,
ok, I'm going to check with an example, disabling the gestures for Chart should be the trick.
I'll send the results asap..
Bob
Re: Scrolling on iOS with TChart on page.
Hi Bob,
sorry for dealy on answer.
I've been checking the issue here, and using the UserInteractionEnabled property for each chart should solve it :
sorry for dealy on answer.
I've been checking the issue here, and using the UserInteractionEnabled property for each chart should solve it :
Code: Select all
chart1.UserInteractionEnabled = false;
chart2.UserInteractionEnabled = false;
Pep Jorge
http://support.steema.com
http://support.steema.com
Re: Scrolling on iOS with TChart on page.
Josep,
That's it! Thanks again! Once again, you have come through for me! Many thanks!
Bob
That's it! Thanks again! Once again, you have come through for me! Many thanks!
Bob