24-2.modifying elements 修改选择的元素

114 阅读1分钟

Modifying Elements

  • selection.attr - get or set an attribute.获取或设置属性
  • selection.classed - get, add or remove CSS classes.获取、添加或删除CSS类。
  • selection.style - get or set a style property.获取或设置样式属性。
  • selection.property - get or set a (raw) property.获取或设置(原始)属性。
  • selection.text - get or set the text content.获取或设置文本内容。
  • selection.html - get or set the inner HTML.获取或设置内部HTML。
  • selection.append - create, append and select new elements.创建、附加和选择新元素。
  • selection.insert - create, insert and select new elements.创建、插入和选择新元素。
  • selection.remove - remove elements from the document.从文档中删除元素。
  • selection.clone - insert clones of selected elements.插入选定元素的克隆。
  • selection.sort - sort elements in the document based on data.根据数据对文档中的元素进行排序。
  • selection.order - reorders elements in the document to match the selection.重新排列文档中的元素以匹配所选内容。
  • selection.raise - reorders each element as the last child of its parent.将每个元素作为其父元素的最后一个子元素重新排序。
  • selection.lower - reorders each element as the first child of its parent.将每个元素作为其父元素的第一个子元素重新排序
  • d3.create - create and select a detached element.创建并选择分离的图元。
  • d3.creator - create an element by name.按名称创建元素。