| categorizeChange: function(c){ | |
| if (isNaN(c)) { return 0; | |
| } else if ( c < -0.25) { return -3; | |
| } else if ( c < -0.05){ return -2; | |
| } else if ( c < -0.001){ return -1; | |
| } else if ( c <= 0.001){ return 0; | |
| } else if ( c <= 0.05){ return 1; | |
| } else if ( c <= 0.25){ return 2; | |
| } else { return 3; } | |
| } |
totalSort: function(alpha) { | |
| var that = this; | |
| return function(d){ | |
| var targetY = that.centerY; | |
| var targetX = that.width / 2; | |
| if (d.isNegative) { | |
| if (d.changeCategory > 0) { | |
| d.x = - 200 | |
| } else { | |
| d.x = 1100 | |
| } | |
| } | |
|
| |
| d.y = d.y + (targetY - d.y) * (that.defaultGravity + 0.02) * alpha | |
| d.x = d.x + (targetX - d.x) * (that.defaultGravity + 0.02) * alpha | |
| }; | |
| }; |
| buoyancy: function(alpha) { | |
| var that = this; | |
| return function(d){ | |
| var targetY = that.centerY - (d.changeCategory / 3) * that.boundingRadius | |
| d.y = d.y + (targetY - d.y) * (that.defaultGravity) * alpha * alpha * alpha * 100 | |
| }; | |
| }, |