简体   繁体   English

从D3条形图中删除最后一个条形?

[英]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. 但是最好的方法是从构成最后一个小节的数据数组中删除最后一个数据集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM