import React from 'react'; import { createMuiTheme } from '@material-ui/core/styles'; import ThemePallete from 'ba-api/themePalette'; import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip } from 'recharts'; import { red } from '@material-ui/core/colors'; import { data1 } from './sampleData'; const theme = createMuiTheme(ThemePallete.greenNatureTheme); const color = ({ primary: theme.palette.primary.main, primarydark: theme.palette.primary.dark, secondary: theme.palette.secondary.main, secondarydark: theme.palette.secondary.dark, third: red[500], thirddark: red[900], }); const toPercent = (decimal, fixed = 0) => ( `${(decimal * 100).toFixed(fixed)}%` ); const getPercent = (value, total) => { const ratio = total > 0 ? value / total : 0; return toPercent(ratio, 2); }; const renderTooltipContent = (o) => { const { payload, label } = o; const total = payload.reduce((result, entry) => (result + entry.value), 0); return (
{`${label} (Total: ${total})`}