Browse Source

Fixed #716: Height of graph `2px` too large when configuring a fixed height.

flowchartTest
jos 9 years ago
parent
commit
a75b8e7715
2 changed files with 10 additions and 4 deletions
  1. +4
    -0
      HISTORY.md
  2. +6
    -4
      lib/timeline/component/LineGraph.js

+ 4
- 0
HISTORY.md View File

@ -27,6 +27,10 @@ http://visjs.org
- Renamed option `animate` to `animation`, and changed it to be either a boolean - Renamed option `animate` to `animation`, and changed it to be either a boolean
or an object `{duration: number, easingFunction: string}`. or an object `{duration: number, easingFunction: string}`.
### Graph2d
- Fixed #716: Height of graph `2px` too large when configuring a fixed height.
### Network ### Network
- Rebuilt the cluster system - Rebuilt the cluster system

+ 6
- 4
lib/timeline/component/LineGraph.js View File

@ -538,7 +538,9 @@ LineGraph.prototype.redraw = function(forceGraphUpdate) {
// calculate actual size and position // calculate actual size and position
this.props.width = this.dom.frame.offsetWidth; 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 // update the graph if there is no lastWidth or with, used for the initial draw
if (this.lastWidth === undefined && this.props.width) { 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. // update the height of the graph on each redraw of the graph.
if (this.updateSVGheight == true) { 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; this.updateSVGheight = false;
} }

Loading…
Cancel
Save