Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

属性设置相关 d3.attr / d3.classed / d3.text / d3.html #8

Open
ckinmind opened this issue Jul 17, 2017 · 0 comments
Open

属性设置相关 d3.attr / d3.classed / d3.text / d3.html #8

ckinmind opened this issue Jul 17, 2017 · 0 comments

Comments

@ckinmind
Copy link
Owner

ckinmind commented Jul 17, 2017

<div class="title">
    <a href="#">About</a>
    <a href="#">Products</a>
    <a href="#">Contact</a>
  </div>
d3.selectAll('a:nth-child(2)')
  .attr('href', 'http://google.com')
  .classed('red', true)
  .html('Inventory <b>SALE</b>');

selection.attr - 设置或获取特性。
selection.classed - 获取,添加或移除CSS类。
selection.style - 设置或获取样式。
selection.property - 设置或获取行内属性。
selection.text - 设置或获取文本内容。
selection.html - 设置或获取inner HTML。
selection.append - 创建,添加或选择新的元素。
selection.remove - 移除文档中的元素。
selection.sort - 基于数据给文档中的元素排序。
selection.order - 重排列文档中的元素以匹配选择中的顺序。
selection.raise - 重新排列每个元素为父元素的最后一个子节点。
selection.lower - 重新排列每个元素为父元素的第一个子节点。
d3.creator - 通过名称创建元素

参考资料:d3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant