How do i use instance of <rect>
of a svg
to get it's class?
I have to remove lines which have same class as the clicked <rect>
.
I tried using selection.class()
which obviously didn't work nor did selection.classed()
help.
select selects the first matching element whilst d3. selectAll selects all matching elements. Both functions take a string as its only argument. The string specifies which elements to select and is in the form of a CSS selector string (e.g. div.
The <g> SVG element is a container used to group other SVG elements. Transformations applied to the <g> element are performed on its child elements, and its attributes are inherited by its children. We can create a group element with D3. js by appending a g element using any selection.
The d3. js is used to select the first element that matches the specified selector string. If any element is not matched then it returns the empty selection. If multiple elements are matched with the selector then only the first matching element will be selected.
It appends a 'g' element to the SVG. g element is used to group SVG shapes together, so no it's not d3 specific.
when using d3 I have found this works
selection.attr("class");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With