简体   繁体   中英

Recover scale, when I make a custom zoom

I have a problem, when zooming with a rectangle who drew on the chart, it should make a zoom into the selected area. The error occurs when I try to return me zooming out, this should work but for some reason this is locked and I can not return to the starting position.

Here is the code to perform the zoom with the rectangle, first pressing the shift key and click to draw down the area on which you need to perform zoom in.

http://jsfiddle.net/cristian540/VFqeV/8/

This is happening because you have set .scaleExtent([1, Infinity]) , and when you zoom using a rectangle selection you aren't resetting the scale.

Perhaps you'd be better turning off .scaleExtent , since there is only a single scale value for d3.behavior.zoom whereas the zoom rectangle effectively has two (one for x- and one for y-).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM