foreignObject를 이용해 html element를 svg 안에 붙일 수 있다.
먼저 붙일 test를 지정하고
const test = d3.select('g')
test에 foreignObject를 append로 붙여주면 된다.
test.append('foreignObject')
.attr('x', node.x)
.attr('y', node.y + 21)
.attr('width', node.width + 'px')
.attr('height', '40px')
.html(function (d) {
return '<input type="text" value="" />'
})
참고
'공부 > TIL' 카테고리의 다른 글
[Vue, Bootstrap vue] b-form-select 선택된 object 그대로 가져오기 (0) | 2022.09.19 |
---|---|
[Tip] VSCode console.log 단축키 등록 (0) | 2022.08.12 |
[TIL] Bootstrap columns grid 커스터마이징(ex. cols="2.5") (0) | 2022.07.29 |
[TIL] VSCode Extension : GitLens 설치했는데 작동 안할 때 (0) | 2022.07.22 |
[TIL] docker-compose 실행 에러 : ERROR: 2 matches found based on name: network <nameofservice>_default is ambiguous (0) | 2022.07.21 |