diff --git a/HISTORY.md b/HISTORY.md index 343f0f39..f9c3314a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -27,6 +27,10 @@ http://visjs.org - Renamed option `animate` to `animation`, and changed it to be either a boolean or an object `{duration: number, easingFunction: string}`. +### Graph2d + +- Fixed #716: Height of graph `2px` too large when configuring a fixed height. + ### Network - Rebuilt the cluster system diff --git a/lib/timeline/component/LineGraph.js b/lib/timeline/component/LineGraph.js index 5bb96daf..e38d7079 100644 --- a/lib/timeline/component/LineGraph.js +++ b/lib/timeline/component/LineGraph.js @@ -538,7 +538,9 @@ LineGraph.prototype.redraw = function(forceGraphUpdate) { // calculate actual size and position this.props.width = this.dom.frame.offsetWidth; - this.props.height = this.body.domProps.centerContainer.height; + this.props.height = this.body.domProps.centerContainer.height + - this.body.domProps.border.top + - this.body.domProps.border.bottom; // update the graph if there is no lastWidth or with, used for the initial draw if (this.lastWidth === undefined && this.props.width) { @@ -568,9 +570,9 @@ LineGraph.prototype.redraw = function(forceGraphUpdate) { // update the height of the graph on each redraw of the graph. if (this.updateSVGheight == true) { - if (this.options.graphHeight != this.body.domProps.centerContainer.height + 'px') { - this.options.graphHeight = this.body.domProps.centerContainer.height + 'px'; - this.svg.style.height = this.body.domProps.centerContainer.height + 'px'; + if (this.options.graphHeight != this.props.height + 'px') { + this.options.graphHeight = this.props.height + 'px'; + this.svg.style.height = this.props.height + 'px'; } this.updateSVGheight = false; }