Zoom improvements
So here is a feature that has been requested a lot; zoom programmatically!
Changes:
- ~~Added ID in the config to be able to set this on the SVG element. I found this quite useful when zooming programmatically.~~
- ZoomToDomain function. Takes in a domain and zooms to it. Ignores any restrictions to scale or translate (as default by D3). There are also optional arguments so it is possible to do transitions to have a neat effect. I did not manage to test the function itself, as when I tried, it says that SVGElement is unknown🤷🏼♂️
- Restrict panning. Default false as not to break backwards compatibility. If this is set, one cannot pan outside the start and end ranges (or what is set by default). If minimumScale on zoom is less than 1, you can zoom out, however, you won't be able to pan
- ~~Removed redundant
new Date()in isAfter, isBefore and withingRange.~~
Would be great if this PR could make it into master and then prepare this for a 1.4.0 release (as the bug fixes earlier are quite important in my opinion).
Closes #268, closes #260, closes #112, closes #88, closes #236, closes #168, closes #271
I would agree with the 1.4 release. There are several bugs fixed in the latest master that are not in 1.3 that vastly improve the user experience.
Ones that I ran into before looking here were the color/radius not updating on zoom and the responsive width of the chart. I could have worked around these bugs as well if I could draw manually which would also be implemented if I'm looking at this correctly.
TL;DR I'd love a 1.4 with the fixes!
So the colour flickering has been fixed as you mentioned. Not sure what you mean by responsive width of the chart? There is already a method to redraw the chart, however, with zoomToDomain one can actually set [startDate, endDate] and zoom to this, which is very useful in a lot of cases.
Think this, along with the bugfixes and vertical axis enhancement would make a great 1.4.0 Also think travis/dependencies might need an update.
Yes, lots of this stuff has been fixed but the fixes are not in 1.3 unless I'm mistaken. The responsive width of the chart was fixed with https://github.com/marmelab/EventDrops/pull/249 for example, but that fix is not in 1.3 afaik.
the color/radius thing was fixed with https://github.com/marmelab/EventDrops/pull/259 but again is not in 1.3 which is the published version on npm.
I'd love to see a 1.4 with the fixes since 1.3 Great work all you contributors btw!
Forgot to mention that there are some breaking changes with Travis CI, so updated it to work with the new xenial build environment. At the same time, I updated the node version to the latest LTS, as well as set Firefox to be the latest too.
@jpetitcolas Hey, could you review this PR? :)
Hi @fzaninotto, I have made the changes (even though it didn't flag them as resolved for some reason.