This is a simple example of line chart with Zoom in X direction or Y direction based on user's initial mouse movement. This uses d3-brush to implement zoom.
Here is the demo http://blockbuilder.org/Shravya-Siluveru/d958edfcbd6333e1a07054c15060ebd9
Here is the code https://gist.github.com/Shravya-Siluveru/d958edfcbd6333e1a07054c15060ebd9
https://d3js.org/d3.v4.min.js