Skip to main content
100%

Jinsu - Request

✓ Published0🌍 Public
MMinwoo Pak
Last edited Nov 18, 2021
Created on Nov 18, 2021

This example shows a React and D3.js scatterplot of a hepatitis C dataset loaded from a CSV file, with the margins clearly outlined for debugging layout. The visualization uses `useData` to fetch and parse the data with `d3.csv`, then renders it inside a `VizContainer` that abstracts the SVG and group elements following the margin convention. The code defines fixed dimensions and applies a shared `VizContainer` component to structure the chart, while the data itself is only loaded without any mapping, leaving the plot empty until further customization.

AI-generated description

Boilerplate code for a React + D3 visualization with:

  • CDN links for React, ReactDOM, and D3
  • Basic React boilerplate
  • Variables for dimensions and margins
  • useData hook to fetch a CSV URL.
  • VizContainer component that:
    • Abstracts SVG/group container elements
    • Follows the margin convention
    • Show the margins, which can be easily removed by deleting the showMargins={true} prop
MIT Licensed

Similar vizzes