From 513fc1e2faac736bcefe71aba64e74196524001d Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 14 Feb 2019 13:38:33 -0500 Subject: ... --- src/Chart.tsx | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/Chart.tsx') diff --git a/src/Chart.tsx b/src/Chart.tsx index 3b541fa..c7b59c4 100644 --- a/src/Chart.tsx +++ b/src/Chart.tsx @@ -1,18 +1,21 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; +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 => ({ +const styles = (theme: Theme) => ({ pieChart: { margin: '0 auto', } }); -function customizedLabel(props) { +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; @@ -35,7 +38,12 @@ function customizedLabel(props) { return ({`${name}`}); } -function PatternPieChart(props) { +function PatternPieChart(props: { + classes: { + patternTableWrapper: string, + pieChart: string + }, + data: PatternGraphData[] }) { return (
@@ -50,7 +58,7 @@ function PatternPieChart(props) { label={customizedLabel}> {props.data.map((d, i) => )} - `${value.toFixed(2)} hr`}/> + `${value.toFixed(2)} hr`}/>
@@ -59,7 +67,13 @@ function PatternPieChart(props) { export const StyledPatternPieChart = withStyles(styles)(PatternPieChart); -function DoublePieChart(props) { +function DoublePieChart(props: { + classes: { + patternTableWrapper: string, + pieChart: string + }, + patternGraphData: PatternGraphData[], + calendarGraphData: PatternGraphData[] }) { return ( @@ -77,16 +91,11 @@ function DoublePieChart(props) { label={customizedLabel}> {props.calendarGraphData.map((d, i) => )} - `${value.toFixed(2)} hr`}/> + `${value.toFixed(2)} hr`}/> ); } -DoublePieChart.propTypes = { - patternGraphData: PropTypes.array.isRequired, - calendarGraphData: PropTypes.array.isRequired, -}; - export const AnalyzePieChart = withStyles(styles)(DoublePieChart); -- cgit v1.2.3-70-g09d2