Skip to main content
100%

World Visualization

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

This example displays an empty SVG canvas with visible margin areas, rendered through a React component that abstracts the D3 margin convention. The `VizContainer` component uses React’s JSX to create `<svg>` and `<g>` elements, applying a transform based on the provided margin object. It includes optional rectangles for debugging layout, toggled by a `showMargins` prop. The code relies on React 16.13.1 and D3 v6, loaded via CDN, with dimensions set to 960 by 500 pixels. No data or visual marks are drawn yet.

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
  • A 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