robinhood/spark

Why doesn't onScrubbed include both x and y?

JBlaz opened this issue · 6 comments

JBlaz commented

Just curious why there isn't a listener for both the x and y values?

What would the y value be? Scrubbing only control the x-axis of the line.

JBlaz commented

That's a great point. I asked my question incorrectly. I guess I want to know the index of the value as well as the value. Or just the index then I can get the value.

SparkView calls ScrubListener.onScrubbed() with the return value from SparkAdapter.getItem(nearestIndex):
https://github.com/robinhood/spark/blob/master/spark/src/main/java/com/robinhood/spark/SparkView.java#L910

Maybe you can make your getItem() return the generic item that you want?

JBlaz commented

I apologize for wasting anyone's time who read this. So obvious! Thank you @danh32. For some reason in my head it wasn't returning an object it was returning a float.

No worries at all! Just glad it's working for you!

JBlaz commented

Me too. Thanks again!