mirror of
https://github.com/dyzulk/raisen-app.git
synced 2026-01-27 07:05:31 +07:00
first commit
This commit is contained in:
43
vendor/template/plugins/flot/plugins/jquery.flot.saturated.js
vendored
Normal file
43
vendor/template/plugins/flot/plugins/jquery.flot.saturated.js
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
(function ($) {
|
||||
'use strict';
|
||||
var saturated = {
|
||||
saturate: function (a) {
|
||||
if (a === Infinity) {
|
||||
return Number.MAX_VALUE;
|
||||
}
|
||||
|
||||
if (a === -Infinity) {
|
||||
return -Number.MAX_VALUE;
|
||||
}
|
||||
|
||||
return a;
|
||||
},
|
||||
delta: function(min, max, noTicks) {
|
||||
return ((max - min) / noTicks) === Infinity ? (max / noTicks - min / noTicks) : (max - min) / noTicks
|
||||
},
|
||||
multiply: function (a, b) {
|
||||
return saturated.saturate(a * b);
|
||||
},
|
||||
// returns c * bInt * a. Beahves properly in the case where c is negative
|
||||
// and bInt * a is bigger that Number.MAX_VALUE (Infinity)
|
||||
multiplyAdd: function (a, bInt, c) {
|
||||
if (isFinite(a * bInt)) {
|
||||
return saturated.saturate(a * bInt + c);
|
||||
} else {
|
||||
var result = c;
|
||||
|
||||
for (var i = 0; i < bInt; i++) {
|
||||
result += a;
|
||||
}
|
||||
|
||||
return saturated.saturate(result);
|
||||
}
|
||||
},
|
||||
// round to nearby lower multiple of base
|
||||
floorInBase: function(n, base) {
|
||||
return base * Math.floor(n / base);
|
||||
}
|
||||
};
|
||||
|
||||
$.plot.saturated = saturated;
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user