Skip to main content
100%

RightAxis

✓ Published0🌍 Public
AAnnie Ulichney
Last edited Feb 24, 2021
Created on Feb 24, 2021

This example displays an empty SVG canvas with visible margins, demonstrating a reusable React and D3 container component called `VizContainer` that abstracts SVG grouping and follows the margin convention. The component renders an outer and inner rectangle to highlight the plotting area, with conditional `showMargins` prop controlling their display. It uses `React.createElement` and JSX, with dimensions and margins defined as variables, and leverages the `d3` library version 6 for future charting. The setup includes CDN links for React, ReactDOM, and d3, providing a boilerplate foundation for adding custom visualizations.

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