import React from 'react'; import PiePlot from '../plots/PiePlot'; import { PiePlotData } from '../types/plots'; interface SidebarPieChartProps { id: string; header: string; pieChartData?: PiePlotData; //add showLegend to hide/show legend showLegend?: boolean; } export default function TabPieChartContent(props: SidebarPieChartProps) { //summation of fullStat.value per marker icon let sumValues: number | null; if (props.pieChartData) { sumValues = props.pieChartData.slices .map((o) => o.value) .reduce((a, c) => { return a + c; }); } else { sumValues = null; } //width, height, margin - legend.y is the bottom of legend list, which makes things difficult to adjust let width = 300; //dynamically change height per the number of legend let numberLegend = props.pieChartData ? props.pieChartData.slices.length : 0; let height = 300 + numberLegend * 30; return ( ); }