简体   繁体   中英

how to get rid of overlap line graph in d3js

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.

from: CLICK HERE FOR SAMPLE IMAGE

to: CLICK HERE FOR SAMPLE OUTPUT IMAGE

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