【问题标题】:brush and context for a line graph线图的画笔和上下文
【发布时间】:2015-08-18 18:32:01
【问题描述】:

我正在使用画笔和上下文处理折线图,请参阅this link 了解我目前的情况。刷光效果只出现在刻度上,而不是折线图上。我无法弄清楚如何更改brushed() 函数,以便折线图也出现刷亮。

function brushed(){
        console.log("brush called");
        x.domain(brush.empty() ? x1.domain() : brush.extent());
        focus.select(".line").attr("d", line);
        focus.select(".x.axis").call(xAxis);
        }

【问题讨论】:

    标签: d3.js


    【解决方案1】:

    我需要重写刷过的函数来更新折线图。

      function brushed(){
            console.log("brush called");
            x.domain(brush.empty() ? x1.domain() : brush.extent());
            **focus.selectAll(".line").attr("d", function(d) { return line(d.values); })**
            focus.select(".x.axis").call(xAxis);
        }
    

    updated plnkr link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-02
      • 2020-04-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多