简体   繁体   中英

Remove the last bar from D3 bar chart?

这可能是一个简单的问题,但是如果我们有一个使用D3.js构建的条形图,那么我如何才能仅删除最后一个条形图?

Something like this can remove the last bar

k = d3.selectAll("rect")[0];
k.pop().remove()

But the best way, would be to remove the last data set from the data array which makes the last bar.

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