Skip to main content
100%

Posts with d3-component

✓ Published0🌍 Public
CCurran Kelleher
Last edited Mar 25, 2017
Created on Feb 28, 2017

This example demonstrates how to compose reusable components with d3-component in a D3 v4 visualization, rendering a list of blog posts as styled div elements. Each post component combines a heading and paragraph component, with data passed through chained selection calls. The code uses `d3.component` to define three components (`heading`, `paragraph`, and `post`), and `selection.call` to invoke nested renders. The static content is hardcoded as an array of post objects, and the result is inserted into a container div with a bordered style. This highlights a pattern for building modular DOM structures with D3’s data-join alternatives.

AI-generated description

This example demonstrates basic usage of d3-component. Three components are created:

  • heading Renders an <h1> element and sets its text.
  • paragraph Renders a <p> element and sets its text.
  • post Renders a <div> element with a class of "post", and composes the heading and post components.

Built with blockbuilder.org

<!-- Start of SimpleHitCounter Code --> <div align="center"><img src="http://simplehitcounter.com/hit.php?uid=2239580&f=16777215&b=0" border="0" height="18" width="83"></a><br></div> <!-- End of SimpleHitCounter Code -->
mit Licensed

Similar vizzes