diff --git a/ui/src/shared/components/Dygraph.js b/ui/src/shared/components/Dygraph.js
index f30d88826..d65a1509a 100644
--- a/ui/src/shared/components/Dygraph.js
+++ b/ui/src/shared/components/Dygraph.js
@@ -301,8 +301,9 @@ class Dygraph extends Component {
render() {
const {isHidden, staticLegendHeight} = this.state
- const {staticLegend} = this.props
+ const {staticLegend, children} = this.props
+ const nestedGraph = (children && children.length && children[0]) || children
let dygraphStyle = {...this.props.containerStyle, zIndex: '2'}
if (staticLegend) {
const cellVerticalPadding = 16
@@ -344,12 +345,13 @@ class Dygraph extends Component {
this.handleReceiveStaticLegendHeight
}
/>}
+ {nestedGraph && React.cloneElement(nestedGraph, {staticLegendHeight})}
)
}
}
-const {array, arrayOf, bool, func, shape, string} = PropTypes
+const {array, arrayOf, bool, func, node, shape, string} = PropTypes
Dygraph.defaultProps = {
axes: {
@@ -408,6 +410,7 @@ Dygraph.propTypes = {
dygraphRef: func,
onZoom: func,
mode: string,
+ children: node,
}
const mapStateToProps = ({annotations: {mode}}) => ({
diff --git a/ui/src/shared/components/LineGraph.js b/ui/src/shared/components/LineGraph.js
index 3110e3ac8..54b23734c 100644
--- a/ui/src/shared/components/LineGraph.js
+++ b/ui/src/shared/components/LineGraph.js
@@ -118,17 +118,18 @@ class LineGraph extends Component {
containerStyle={containerStyle}
staticLegend={staticLegend}
isGraphFilled={showSingleStat ? false : isGraphFilled}
- />
- {showSingleStat
- ?