|
|
@ -5,7 +5,7 @@ |
|
|
|
* A dynamic, browser-based visualization library. |
|
|
|
* |
|
|
|
* @version 2.0.1-SNAPSHOT |
|
|
|
* @date 2014-07-01 |
|
|
|
* @date 2014-07-03 |
|
|
|
* |
|
|
|
* @license |
|
|
|
* Copyright (C) 2011-2014 Almende B.V, http://almende.com
|
|
|
@ -4563,9 +4563,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; |
|
|
|
|
|
|
@ -4573,19 +4576,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; |
|
|
|
} |
|
|
@ -10164,7 +10162,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; |
|
|
|
}; |
|
|
@ -15269,7 +15267,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; |
|
|
|