当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - replacing null data d3js with focus context chart line

问题描述:

I'm using d3.js Multi-series line chart interactive example and I want to make continuous lines.

When i zoom on, but like the example, lines are discontinued even with

var line = d3.svg.line()

.interpolate("monotone")

.x(function(d) {

return x(d.date);

})

.y(function(d) {

return y(d.rating);

});

Can someone help?

PS. Click on "Drug Abuse" on the right of the graph to see exactly what I mean.

网友答案:

i got it, the problem is related to the transition function that i' using when i remove the .call(transition)

function transition(path) {
    path.transition()
            .duration(2000)
            .attrTween("stroke-dasharray", tweenDash)
            .attr("stroke-dashoffset", 0)
            .ease("linear");
}
function tweenDash() {
    var l = this.getTotalLength(),
            i = d3.interpolateString("0," + l, l + "," + l);
    return function(t) {
        return i(t);
    };
}

it work fine

分享给朋友:
您可能感兴趣的文章:
随机阅读: