can you please help me to remove the overlap line on my line graph. This is a dynamic graph. So whenever I want to change the scale of my graph to a bigger domain, the whole path should be there. and when i change again the scale to smaller one, I dont want to see the line graph or just see the lines that covers the range of my scale. thanks.
var data = [
{"x":1, "y":1},
....
....
];
var line = d3.svg.line()
.x(function(d) { return xScale(d.x); })
.y(function(d) { return yScale(d.y); });
var path = svg.append("path")
.data([data])
.attr("d", line)
.attr("stroke", "black");
click the link for sample output.
As mentioned in the comments, use clip path. Here are a few examples that will help :
http://www.d3noob.org/2015/07/clipped-paths-in-d3js-aka-clippath.html
Svg clip-path within rectangle does not work
http://bl.ocks.org/couchand/6399221
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/clipPath
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.