I have a scenario where I am displaying the svg which has 5 rect and I want to add the delete icon (import DeleteIcon from '@mui/icons-material/Delete';) from material ui for each of the rect in front of the rect box, so total there should be 5 delete icon.
Material UI: https://mui.com/material-ui/material-icons/?query=delete&selected=Delete
Here is the code :
function svg() {
g.selectAll("g.legendCells")
.data(data)
.enter()
.append("g")
.append("rect")
g.selectAll("rect")
.attr("height", 1)
.attr("width", 1)
.style("fill", function (data) {
return data["color"];
});
g.selectAll("rect")
.attr("x", function (_d: number, i: number) {
return i;
})
.attr("y", 0);
}
Jsfiddle : https://jsfiddle.net/b2motr3c/2/