Skip to main content
Public

Share visualization

Loading preview…

ICE-6: Rendering Marks and Channels with React & D3

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

ICE-6: Rendering Marks and Channels with React & D3

0
Ssri7harsha
Last edited Mar 5, 2022
Created on Mar 5, 2022
Forked from Heatmap with p5.js

This example shows car sales populations for 10 countries in 2020 using horizontal bars rendered as SVG rectangles. The visualization maps country names to the y-axis with a band scale and population values to the x-axis with a linear scale, displaying tick marks and labels generated manually from scale ticks. It uses React with hooks (useState, useEffect) to load and store CSV data via d3.csv, while d3.scaleBand and d3.scaleLinear define the scales and the axis elements are drawn directly as SVG groups and lines. The data originates from a Kaggle-derived CSV file fetched from a GitHub gist.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter. My dataset was not appropriate for the heatmap, so I found this one https://www.kaggle.com/yamqwe/pregnancy-birth-abortion-rates-in-the-united-stae/version/2 and I took only 8 states to make it readable.

Comments

Sign in to join the discussion.

MIT Licensed