import React from "react"; import { Pie } from "@vx/shape"; import { Group } from "@vx/group"; import { scaleOrdinal } from "@vx/scale"; import { LegendOrdinal } from "@vx/legend"; //import data from "./CategoryByDay.json"; const data = [ { "Category": "Category Name 1", "Total": 643401 }, { "Category": "Category Name 2", "Total": 1062500 }, { "Category": "Category Name 3", "Total": 670000 } ] function Label({ x, y, children }) { return ( {children} ); } export default ({ title, width, height, events = false, margin = { top: 30, left: 20, right: 20, bottom: 30, }, }) => { if (width < 10) return null; const radius = Math.min(width, height) / 2; const color = scaleOrdinal({ domain: data.Category, range: [ "#87cefa", "#d4ea62", "#d56464", ], }); return (

{title}

d.Total} outerRadius={radius - radius / 10} innerRadius={radius - radius / 1.8} fill={function(d) { return color(d.index); }} cornerRadius={0} padAngle={0} centroid={(centroid, arc) => { const [x, y] = centroid; const { startAngle, endAngle } = arc; if (endAngle - startAngle < 0.1) return null; return ( ); }} />
`${label}`} />
); };