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

底部barchart长按事件异常 #2

Open
StevenZhangHl opened this issue May 23, 2019 · 1 comment
Open

底部barchart长按事件异常 #2

StevenZhangHl opened this issue May 23, 2019 · 1 comment

Comments

@StevenZhangHl
Copy link

Highlight h = mChart.getHighlightByTouchPoint(e.getX(), e.getY());
if (h != null) {
h.setDraw(e.getX(), e.getY());
mChart.highlightValue(h, true);
mChart.disableScroll();
}
这里的当mChart是底部的barchart的时候,h对象是空,导致长按底部的barchart区域无法触发高亮

@Qianlan77
Copy link
Owner

Highlight h = mChart.getHighlightByTouchPoint(e.getX(), e.getY());
if (h != null) {
h.setDraw(e.getX(), e.getY());
mChart.highlightValue(h, true);
mChart.disableScroll();
}
这里的当mChart是底部的barchart的时候,h对象是空,导致长按底部的barchart区域无法触发高亮

那你要检查下是不是给两个图表都设置了监听:(3个监听都需要设置,不能写反也不能写错)
cp.setOnChartGestureListener(new CoupleChartGestureListener(this, cp, cv));//设置手势联动监听
cv.setOnChartGestureListener(new CoupleChartGestureListener(this, cv, cp));
cp.setOnChartValueSelectedListener(new CoupleChartValueSelectedListener(this, cp, cv));//设置高亮联动监听
cv.setOnChartValueSelectedListener(new CoupleChartValueSelectedListener(this, cv, cp));
cp.setOnTouchListener(new ChartFingerTouchListener(cp, this));//手指长按滑动高亮
cv.setOnTouchListener(new ChartFingerTouchListener(cv, this));

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

2 participants