Skip to main content
100%

Gene Browser

✓ Published0🌍 Public
CCraftbd
Last edited May 1, 2018
Created on Feb 1, 2018

This example demonstrates how D3.js v4 binds an array of JavaScript objects to SVG rectangles, producing a simple three-color gene visualization. It shows a static sequence of blue, green, and red bars arranged vertically, each fixed at a width of 200 pixels and a height of 50 pixels. The code uses `d3.selectAll("rect").data(gene).enter().append("rect")` to join the data array—which contains `fill`, `x`, and `y` properties—to new rectangles, setting their positions and colors via attribute functions. The data originates from a hardcoded array named `gene`, and the visualization is rendered directly into an SVG canvas using D3’s selection and data-join API, with no interactive or animated behavior.

AI-generated description

Built with blockbuilder.org

forked from <a href='http://bl.ocks.org/Craftbd/'>Craftbd</a>'s block: <a href='http://bl.ocks.org/Craftbd/1a2f08f675b1f679cafde65673562b1f'>New array flag</a>

mit Licensed

Similar vizzes