Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart's PanGesture conflicts with UITableView PanGesture #219

Closed
carrchr opened this issue Jul 15, 2015 · 5 comments
Closed

Chart's PanGesture conflicts with UITableView PanGesture #219

carrchr opened this issue Jul 15, 2015 · 5 comments

Comments

@carrchr
Copy link

carrchr commented Jul 15, 2015

I apologize in advance if this issue is more of a Stack Overflow question than a bug/limitation of this framework.
We have a LineChartView in a UITableViewCell subclass in a static UITableView.
Chart is configured like this:

[chart setScaleYEnabled:NO];
[chart setHighlightEnabled:NO];

When the scrolling of tableView finishes decelerating, the PanGesture contained in the LineChart intercepts vertical scrolling and, hence, the containing tableView will not scroll unless you begin a tap/pan outside of the LineChart.
I found private func panGestureRecognized(recognizer: UIPanGestureRecognizer) in BarLineChartViewBase.swift
I am not super familiar with Gesture Recognizers but do I need to change the behavior of this function to handle this scenario?
Thanks!

@danielgindi
Copy link
Collaborator

danielgindi commented Jul 15, 2015 via email

@carrchr
Copy link
Author

carrchr commented Jul 16, 2015

I don't quite understand what you mean by scrolling "on a direction
which it does not have any more scrolling." I've disabled YAxis scaling on the chart (XAxis is enabled as is pinch to zoom) and it does not pass a vertical pan gesture up to the containing tableView.
Are you saying I should turn YAxis scaling on and it should work?

@danielgindi
Copy link
Collaborator

Whenever there's no more scrolling on a chart, it will pass control to the
parent view for scrolling. It doesn't matter if scrolling enable or
disabled. Disabled scrolling will just pass control immediately.
When you scroll and reach the end, it will still not scroll the parent. You
have to let go and start scrolling again.

On Thu, Jul 16, 2015 at 4:08 PM, Chris Carr notifications@github.com
wrote:

I don't quite understand what you mean by scrolling "on a direction
which it does not have any more scrolling." I've disabled YAxis scaling on
the chart (XAxis is enabled as is pinch to zoom) and it does not pass a
vertical pan gesture up to the containing tableView.
Are you saying I should turn YAxis scaling on and it should work?


Reply to this email directly or view it on GitHub
#219 (comment)
.

@inix
Copy link

inix commented Dec 1, 2016

@carrchr

hi, I have similar scenario with you,that,I disable Y axis scale,but I can not scroll vertically tableview in the chart.
I just do a simple hack,that if chart disable Y axis scale,enable UITableView vertically scrolling.

		if !self.isScaleYEnabled {
			_outerScrollView?.nsuiIsScrollEnabled = true
		} else {
			_outerScrollView?.nsuiIsScrollEnabled = false
		}

in func @objc fileprivate func panGestureRecognized(_ recognizer: NSUIPanGestureRecognizer)
of BarLineChartViewBase.swift file

diff:

@@ -688,7 +688,11 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
                     if _outerScrollView !== nil
                     {
                         // Prevent the parent scroll view from scrolling
-                        _outerScrollView?.nsuiIsScrollEnabled = false
+                                               if !self.isScaleYEnabled {
+                                                       _outerScrollView?.nsuiIsScrollEnabled = true
+                                               } else {
+                                                       _outerScrollView?.nsuiIsScrollEnabled = false
+                                               }
                     }
                 }
                 

@shanyulaile
Copy link

@inix
Hi, Make the following configuration when configuring the chart
[self.combinedchartview setScaleXEnabled:YES];
[self.combinedchartview setScaleYEnabled:NO];//禁用Y轴缩放
[self.combinedchartview setDragEnabled:YES];

Then modify it in the way you modified it, but the tableview at the bottom of the vertical slide cannot slide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants