import React from 'react' import { Bar, BarChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts' import { formatValue } from '../../../utils/stats' import { workoutColors } from '../../../utils/workouts' import CustomTooltip from './CustomTooltip' import CustomLabel from './CustomLabel' export default class StatsCharts extends React.PureComponent { constructor(props, context) { super(props, context) this.state = { displayedData: 'distance', } } handleRadioChange(changeEvent) { this.setState({ displayedData: changeEvent.target.name, }) } render() { const { displayedData } = this.state const { sports, stats, t } = this.props if (Object.keys(stats).length === 0) { return t('common:No workouts.') } return (