Javascript D3图例未更新

Javascript D3图例未更新,javascript,d3.js,Javascript,D3.js,希望你能帮我指出我的错误 我无法在直方图上方的鼠标上更新图例的第二行: 我不相信它是选择器,因为您可以为两者添加一个id属性没有问题,而且数据似乎在控制台上通过ok。log()…有点困惑 明白了 //create the perc col tr.append("tr") .attr("class","legendPerc") .text(function(d){return getLegend(d,lD);}); 应该是 //create the pe

希望你能帮我指出我的错误

我无法在直方图上方的鼠标上更新图例的第二行:

我不相信它是选择器,因为您可以为两者添加一个id属性没有问题,而且数据似乎在控制台上通过ok。log()…有点困惑

明白了

//create the perc col
    tr.append("tr")
        .attr("class","legendPerc")
        .text(function(d){return getLegend(d,lD);});
应该是

//create the perc col
    tr.append("td")
        .attr("class","legendPerc")
        .text(function(d){return getLegend(d,lD);});
//create the perc col
    tr.append("td")
        .attr("class","legendPerc")
        .text(function(d){return getLegend(d,lD);});