Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

cannavis1

Public visualization

cannavis1

0 stars0🌍 Public
Ggiterdun345
Last edited Feb 2, 2020
Created on Feb 2, 2020
Forked from D3 and React Hooks

This example shows a D3.js pie chart built within a React application for visualizing the chemical composition of cannabis strains. It displays the percentage of each compound as a labeled slice of the pie, with the strain name shown on a button. The visualization is rendered using SVG and React function components, contrasting two approaches: one uses a React Hook to manage the D3 drawing lifecycle, while the other uses pure, non-side-effect SVG rendering. The chart uses `d3.pie()` and `d3.arc()` to compute and draw the arcs, with `d3.scaleOrdinal(d3.schemeCategory10)` for color and `d3.format('.2f')` for label formatting.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed