Browse Source

Merge remote-tracking branch 'origin/graph2d' into develop

Conflicts:
	dist/vis.js
	dist/vis.min.js
css_transitions
jos 10 years ago
parent
commit
91af97ed9a
3 changed files with 6 additions and 8 deletions
  1. +1
    -1
      src/network/networkMixins/physics/HierarchialRepulsion.js
  2. +1
    -1
      src/timeline/Timeline.js
  3. +4
    -6
      src/timeline/component/Linegraph.js

+ 1
- 1
src/network/networkMixins/physics/HierarchialRepulsion.js View File

@ -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;

+ 1
- 1
src/timeline/Timeline.js View File

@ -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;
};

+ 4
- 6
src/timeline/component/Linegraph.js View File

@ -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;
}

Loading…
Cancel
Save