我知道SVG的geometricPrecision样式选项,但路径仍然显示出难看的锯齿量。我使用的数据集相当密集,大约400点。看看下面的红色路径。
SVG中的抗锯齿路径还有其他选项吗?
修改
该行是根据制表符分隔的数据创建的,如下所示(减去不重要的细节):
var x = d3.scaleLinear()
.range([0, width]);
var y = d3.scaleLinear()
.rangeRound([height, 0]);
x.domain([0,240000]);
y.domain([0,30]);
var line = d3.line()
.x(function(d) { return x(d.income); })
.y(function(d) { return y(d.tax); });
...
...
...
g.append("path").classed("linedata", true)
.datum(data)
.attr("fill", "none")
.attr("stroke", "#e04444")
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr("stroke-width", 2.3)
.attr("d", line);