Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate adding single point #2911

Closed
kditraglia opened this issue Oct 26, 2017 · 4 comments
Closed

Animate adding single point #2911

kditraglia opened this issue Oct 26, 2017 · 4 comments

Comments

@kditraglia
Copy link

Is there currently any way to take a already existing dataset, and animate adding another point. Currently using the animation logic will redraw the entire line, is there a way to only animate drawing the new part of the line added from a single point?

@liuxuan30
Copy link
Member

liuxuan30 commented Oct 27, 2017

#189. it seems use Animated moveViewToX() #318

@kditraglia
Copy link
Author

"You can also use the animation util in Charts, that can animate a number for you already, including easing and stuff."

I don't see any option to animate a single data-set only the whole chart. Am I missing something?

@liuxuan30
Copy link
Member

liuxuan30 commented Oct 31, 2017

I double checked, looks like it's not implemented..

This is actually a feature that I thought about already, and planning to implement.
We have a lot on our plate right now - so in the meantime if this is really important to you - you could do this:

Create a function that takes dataset A, dataset B, and a phase value between 0 and 1.
This function will:

    Define a new dataset C
    Iterate on each value in A, and set C[i] = (B[i] - A[i]) * phase + A[i]
    Return C as the new dataset

Now you should animate a simple number from 0 to 1, and pass it to the function along with the "from" dataset and "to" dataset. The result should be passed to the chart view :-)

You can also use the animation util in Charts, that can animate a number for you already, including easing and stuff.

So it's pretty much a peach of cake, and as soon as I can I'm planning on adding this to the library. But at least you have a solution for the meanwhile ;-)

@amir-skn
Copy link

Is Animate adding single point finally added to the features?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants