I work on a chart with dragging, zooming and updates. This mostly works, however, after adding new data, the dragging position does not update.
Steps to reproduce:
- see the demo
- wait some seconds so that some data is added to the graph
- then try dragging the graph to the left or right
- the graph will be pushed back to the beginning and from that point dragging works the way it should
So I guess, when adding new data, I somehow have to update the drag origin. But how? So far I was not able to find any example of that. I also looked at the code of the dragging functionality of D3, but it's still not clear to me. Same thing happens for the zooming, I guess it is the same problem there.
Code and demo can be seen here: http://jsbin.com/irixag/1/edit
Edit: If it is not clear what I mean, please tell me so that I can rephrase the question.</div