marmelab / EventDrops

A time based / event series interactive visualization using d3.js
http://marmelab.com/EventDrops/
MIT License
1.24k stars 237 forks source link

Explicit draw() call does not update internal state of the chart #252

Open val-janeiko opened 6 years ago

val-janeiko commented 6 years ago

What you were expecting:

After calling draw() with a scale parameter different than the current state of the chart, when a user tries to zoom/pan the chart it should zoom/scroll from the scale specified in the draw() call.

What happened instead:

After calling draw() with a scale parameter different than the current state of the chart, when a user tries to zoom/pan the chart it resets zoom and pan to the state it was before draw() was issued.

Related code:

https://jsfiddle.net/6rqxusw5/271/

var scale = d3.scaleTime().domain([new Date('01/01/2017 12:00:00 AM'), new Date('02/01/2017 12:00:00 AM')]).range(chart.scale().range());
chart.draw(config, scale)(d3.select('#events').data([repositoriesData]));

Environment

Busteren commented 5 years ago

You can probably modify the source and make a programmatical zoom function or something. Then you can zoom to domain: zoom to domain in D3

You probably only want to draw the chart once, and then use zoom programmatically to change the domain (ranges of dates you view).