Fix an issue when clicking on a graph's first item

Clicking on the first chart is index=0, but the falsey check caused it   
to go to the default behaviour, which is to assume the user clicked on  
the last item in the graph.

An alternative for this would be to have the default behaviour set i=0
rather than i=length - 1.