what's the difference between selection.style and selection.attr in D3.js?

前端 未结 2 1737
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-01 19:37

I found both of them works in my test:

    .on(\"mouseover\",
        function() {
            d3.select(this)
                .select(\"text\")
                         


        
2条回答
  •  鱼传尺愫
    2021-02-01 20:27

    If you look at the HTML you get, you'll see something like:

    ...
    

    and

    ...
    

    ..which are both legal in SVG, but using attr when you need style could trip you up if you use it for something else.

提交回复
热议问题