Remove height prop from line graphs

pull/10616/head
Alex P 2017-02-21 16:27:40 -08:00
parent 8ad290dc85
commit 36177b204d
2 changed files with 8 additions and 28 deletions

View File

@ -10,9 +10,7 @@ const RefreshingLineGraph = AutoRefresh(LineGraph);
const RefreshingSingleStat = AutoRefresh(SingleStat); const RefreshingSingleStat = AutoRefresh(SingleStat);
const { const {
children,
arrayOf, arrayOf,
node,
number, number,
shape, shape,
string, string,
@ -114,9 +112,12 @@ export const LayoutRenderer = React.createClass({
} }
return ( return (
<Wrapper key={cell.i}> <div key={cell.i}>
<RefreshingLineGraph queries={qs} autoRefresh={autoRefreshMs} showSingleStat={cell.type === "line-plus-single-stat"} /> <h2 className="hosts-graph-heading">{cell.name}</h2>
</Wrapper> <div className="hosts-graph graph-container ">
<RefreshingLineGraph queries={qs} autoRefresh={autoRefreshMs} showSingleStat={cell.type === "line-plus-single-stat"} />
</div>
</div>
); );
}); });
}, },
@ -147,24 +148,4 @@ export const LayoutRenderer = React.createClass({
}, },
}); });
const Wrapper = React.createClass({ export default LayoutRenderer;
propTypes: {
children: node.isRequired,
},
render() {
const that = this;
const newChildren = React.Children.map(this.props.children, (child) => {
return React.cloneElement(child, {
height: that.props.style.height,
})
})
return (
<div {...this.props}>
{newChildren}
</div>
);
}
});
export default LayoutRenderer;

View File

@ -25,7 +25,6 @@ export default React.createClass({
y: arrayOf(number), y: arrayOf(number),
y2: arrayOf(number), y2: arrayOf(number),
}), }),
height: string,
title: string, title: string,
isFetchingInitially: bool, isFetchingInitially: bool,
isRefreshing: bool, isRefreshing: bool,
@ -105,7 +104,7 @@ export default React.createClass({
<div className={classNames({"graph--hasYLabel": !!(options.ylabel || options.y2label)})}> <div className={classNames({"graph--hasYLabel": !!(options.ylabel || options.y2label)})}>
{isRefreshing ? this.renderSpinner() : null} {isRefreshing ? this.renderSpinner() : null}
<Dygraph <Dygraph
containerStyle={{width: '95%', height: this.props.height && parseInt(this.props.height, 10) - 20 + 'px' || '100%'}} containerStyle={{width: '100%', height: '100%'}}
overrideLineColors={overrideLineColors} overrideLineColors={overrideLineColors}
isGraphFilled={isGraphFilled} isGraphFilled={isGraphFilled}
timeSeries={timeSeries} timeSeries={timeSeries}