Index of bar clicked in BarGraph is only 0 or -1

Issue #9 resolved
Luis Alberto Pérez García created an issue

The problem is in the onTouchEvent method. You should use the same implementation you used in PieGraph, that one works great.

The main difference is that you check if index is greater than -1 in PieGraph...

if (r.contains((int)point.x,(int) point.y) && listener != null){
                                if (indexSelected > -1){
                                        listener.onClick(indexSelected);
                                }
                                indexSelected = -1;
                        }

... but you do not in BarGraph:

if (r.contains((int)point.x,(int) point.y) && listener != null){
                    listener.onClick(indexSelected);
                }

Comments (5)

  1. Log in to comment