diff --git a/src/network/networkMixins/physics/HierarchialRepulsion.js b/src/network/networkMixins/physics/HierarchialRepulsion.js index e2980406..6cc39b55 100644 --- a/src/network/networkMixins/physics/HierarchialRepulsion.js +++ b/src/network/networkMixins/physics/HierarchialRepulsion.js @@ -98,7 +98,7 @@ var hierarchalRepulsionMixin = { distance = 0.01; } - distance = Math.max(0.8*edgeLength,Math.min(1.2*edgeLength, distance)); + distance = Math.max(0.8*edgeLength,Math.min(5*edgeLength, distance)); // the 1/distance is so the fx and fy can be calculated without sine or cosine. springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; diff --git a/src/timeline/Timeline.js b/src/timeline/Timeline.js index dfbb8a9f..d8da83ef 100644 --- a/src/timeline/Timeline.js +++ b/src/timeline/Timeline.js @@ -724,7 +724,7 @@ Timeline.prototype._toScreen = function(time) { * @private */ // TODO: move this function to Range -Graph2d.prototype._toGlobalScreen = function(time) { +Timeline.prototype._toGlobalScreen = function(time) { var conversion = this.range.conversion(this.props.root.width); return (time.valueOf() - conversion.offset) * conversion.scale; }; diff --git a/src/timeline/component/Linegraph.js b/src/timeline/component/Linegraph.js index aee2ea8d..5f3de406 100644 --- a/src/timeline/component/Linegraph.js +++ b/src/timeline/component/Linegraph.js @@ -853,9 +853,12 @@ Linegraph.prototype._drawPoints = function (dataset, group, JSONcontainer, svg, */ Linegraph.prototype._preprocessData = function (datapoints, group) { var extractedData = []; - var xValue, yValue, increment; + var xValue, yValue; var toScreen = this.body.util.toScreen; + var increment = 1; + var amountOfPoints = datapoints.length; + var yMin = datapoints[0].y; var yMax = datapoints[0].y; @@ -863,19 +866,14 @@ Linegraph.prototype._preprocessData = function (datapoints, group) { // of width changing of the yAxis. if (group.options.sampling == true) { var xDistance = this.body.util.toGlobalScreen(datapoints[datapoints.length-1].x) - this.body.util.toGlobalScreen(datapoints[0].x); - var amountOfPoints = datapoints.length; var pointsPerPixel = amountOfPoints/xDistance; increment = Math.min(Math.ceil(0.2 * amountOfPoints), Math.max(1,Math.round(pointsPerPixel))); } - else { - increment = 1; - } for (var i = 0; i < amountOfPoints; i += increment) { xValue = toScreen(datapoints[i].x) + this.width - 1; yValue = datapoints[i].y; extractedData.push({x: xValue, y: yValue}); - yMin = yMin > yValue ? yValue : yMin; yMax = yMax < yValue ? yValue : yMax; }