import React from 'react';
import PropTypes from 'prop-types';
import { Theme, withStyles } from '@material-ui/core/styles';
import Grid from '@material-ui/core/Grid';
import cyan from '@material-ui/core/colors/cyan';
import { PieChart, Pie, Cell, Tooltip } from 'recharts';
import { defaultChartColor } from './theme';
import { PatternGraphData } from './graph';
const styles = (theme: Theme) => ({
pieChart: {
margin: '0 auto',
}
});
function customizedLabel(props: {cx: number, cy: number,
x: number, y: number,
fill: string, name: string}) {
const {cx, cy, x, y, fill, name} = props;
let anchor = "middle";
const EPS = 2;
let dx = 0;
let dy = 0;
if (x < cx - EPS) {
dx = -5;
anchor = "end"
} else if (x > cx + EPS) {
dx = 5;
anchor = "start";
}
if (y < cy - EPS) {
dy = -5;
} else if (y > cy + EPS) {
dy = 10;
}
return ({`${name}`});
}
function PatternPieChart(props: {
classes: {
patternTableWrapper: string,
pieChart: string
},
data: PatternGraphData[] }) {
return (
{props.data.map((d, i) => | )}
`${value.toFixed(2)} hr`}/>
);
}
export const StyledPatternPieChart = withStyles(styles)(PatternPieChart);
function DoublePieChart(props: {
classes: {
patternTableWrapper: string,
pieChart: string
},
patternGraphData: PatternGraphData[],
calendarGraphData: PatternGraphData[] }) {
return (
{props.calendarGraphData.map((d, i) => | )}
`${value.toFixed(2)} hr`}/>
);
}
export const AnalyzePieChart = withStyles(styles)(DoublePieChart);