Flot mousehover algorithm to detect purely based on x location?

﹥>﹥吖頭↗ 提交于 2019-12-03 16:10:19

The only way I found is to change the source. (it sucks ok, but it's often better a well commented hack than a un-maintainable workaround)

Find this code: (function findNearbyItem(), on line 2278 on my revision)

if (s.lines.show || s.points.show) {
                    for (j = 0; j < points.length; j += ps) {
                        var x = points[j], points[j + 1];
                        if (x == null)
                            continue;

Change to:

if (s.lines.show || s.points.show) {
                    for (j = 0; j < points.length; j += ps) {
                        var x = points[j], y =0; // points[j + 1];
                        if (x == null)
                            continue;

Hope this answer will help anybody with the same problem.

y = 0 will not work for large y-values. y = axisy.datamin fixes the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!