Connect line graph prefix and suffix to child single stat

pull/10616/head
Alex P 2018-02-08 11:12:19 -08:00
parent 1de16619be
commit 8d095d1bb3
2 changed files with 13 additions and 0 deletions

View File

@ -84,6 +84,14 @@ class LineGraph extends Component {
? SINGLE_STAT_LINE_COLORS
: overrideLineColors
let prefix
let suffix
if (axes) {
prefix = axes.y.prefix
suffix = axes.y.suffix
}
return (
<div className="dygraph graph--hasYLabel" style={{height: '100%'}}>
{isRefreshing ? <GraphLoadingDots /> : null}
@ -108,6 +116,8 @@ class LineGraph extends Component {
/>
{showSingleStat
? <SingleStat
prefix={prefix}
suffix={suffix}
data={data}
lineGraph={true}
colors={colors}

View File

@ -17,6 +17,7 @@ class SingleStat extends PureComponent {
cellHeight,
isFetchingInitially,
colors,
prefix,
suffix,
lineGraph,
} = this.props
@ -74,6 +75,7 @@ class SingleStat extends PureComponent {
'single-stat--small': cellHeight === SMALL_CELL_HEIGHT,
})}
>
{prefix}
{roundedValue}
{suffix}
{lineGraph && <div className="single-stat--shadow" />}
@ -98,6 +100,7 @@ SingleStat.propTypes = {
value: string.isRequired,
}).isRequired
),
prefix: string,
suffix: string,
lineGraph: bool,
}