start and end dates can be updated on stats graph

This commit is contained in:
Sam
2019-01-04 19:17:16 +01:00
parent 1915c1f374
commit 2a2d3e02ab
5 changed files with 69 additions and 3 deletions

View File

@ -2,8 +2,14 @@ import React from 'react'
import { formatValue } from '../../../utils/stats'
/**
* @return {null}
*/
export default function CustomLabel (props) {
const { displayedData, x, y, width, value } = props
if (!value) {
return null
}
const radius = 10
const formattedValue = formatValue(displayedData, value)

View File

@ -79,6 +79,9 @@ export default class StatsCharts extends React.PureComponent {
/>
{sports.map((s, i) => (
<Bar
// disable for now due to problems w/ CustomLabel
// see https://github.com/recharts/recharts/issues/829
isAnimationActive={false}
key={s.id}
dataKey={s.label}
stackId="a"

View File

@ -30,8 +30,10 @@ class Statistics extends React.PureComponent {
}
render() {
const { displayedSports, sports, statistics, statsParams } = this.props
if (Object.keys(statistics).length === 0) {
const {
displayedSports, sports, statistics, statsParams, displayEmpty
} = this.props
if (!displayEmpty && Object.keys(statistics).length === 0) {
return 'No workouts'
}
const stats = formatStats(statistics, sports, statsParams, displayedSports)