robinhood / spark

A simple Android sparkline chart view.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dinamic graph

aingerusanchez opened this issue · comments

I've drawn a graph with pulse shape from a csv file, the csv has at least 1000 data point to draw but I send only 250 to the data float[] that shows on the sparkview adapter.

Now I need this graph to became dynamic, so it has to shift rightward showing new data and hiding the old data (showed at beggining on the left side), but containing the same data amount showed (250 x points).

Does any of your methods work in this way?

Thanks in advance.

We don't have anything built in for this type of animation. You can pretty easily get this effect by using two SparkViews on top of each other in a FrameLayout, though. Load your first set of data into SparkView 1, which is shown to the user. Set SparkView 2's translationX so that it's all the way to the left of SparkView 1. Now load the next set of data into SparkView 2, and animate the translationX of both SparkViews to the right until SparkView 1 is offscreen, and SparkView 2 is in SparkView 1's original spot.

Hope that helps!