igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
172 lines (171 loc) • 7.08 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { Snapper } from "./Snapper";
import { markType } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
/**
* @hidden
*/
var LinearCategorySnapper = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(LinearCategorySnapper, _super);
function LinearCategorySnapper(a) {
var _rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
_rest[_i - 1] = arguments[_i];
}
var _this = _super.call(this) || this;
_this.g = 0;
_this.h = 0;
a = (a == void 0) ? 0 : a;
switch (a) {
case 0:
{
var c = _rest[0];
var d = _rest[1];
var e = _rest[2];
var f = _rest[3];
var g = [c, d, e, NaN, 0, f];
{
var i = g[0];
var j = g[1];
var k = g[2];
var l = g[3];
var m = g[4];
var n = g[5];
if (n > 0) {
_this.f = n;
_this.b = true;
}
var o = !isNaN_(l);
_this.g = l;
_this.h = 0;
var p = Math.min(10, truncate((k / _this.f)));
if (_this.b && !isInfinity(_this.f) && !isNaN_(_this.f)) {
p = Math.min(10 + 1, truncate(((k + _this.f) / _this.f)));
if (p == 0) {
p = 1;
}
}
if (p > 0) {
var q = _this.i(i, j, p, true);
if (_this.b && (q + 1) > p) {
if (!o) {
_this.g = NaN;
}
else {
_this.g = l;
}
q = _this.i(i, j, p - 1, true);
if (_this.b && (q + 1) > p) {
if (!o) {
_this.g = NaN;
}
else {
_this.g = l;
}
q = _this.i(i, j, p - 1, false);
}
}
p = q;
if (k / p > _this.f * 10) {
_this.h = 10;
}
else {
if (k / p > _this.f * 5) {
_this.h = 5;
}
else {
if (k / p > _this.f * 2) {
_this.h = 2;
}
}
}
}
}
}
break;
case 1:
{
var c = _rest[0];
var d = _rest[1];
var e = _rest[2];
var f = _rest[3];
var g = _rest[4];
var h = _rest[5];
if (h > 0) {
_this.f = h;
_this.b = true;
}
var i = !isNaN_(f);
_this.g = f;
_this.h = 0;
var j = Math.min(10, truncate((e / _this.f)));
if (_this.b && !isInfinity(_this.f) && !isNaN_(_this.f)) {
j = Math.min(10 + 1, truncate(((e + _this.f) / _this.f)));
if (j == 0) {
j = 1;
}
}
if (j > 0) {
var k = _this.i(c, d, j, true);
if (_this.b && (k + 1) > j) {
if (!i) {
_this.g = NaN;
}
else {
_this.g = f;
}
k = _this.i(c, d, j - 1, true);
if (_this.b && (k + 1) > j) {
if (!i) {
_this.g = NaN;
}
else {
_this.g = f;
}
k = _this.i(c, d, j - 1, false);
}
}
j = k;
if (e / j > _this.f * 10) {
_this.h = 10;
}
else {
if (e / j > _this.f * 5) {
_this.h = 5;
}
else {
if (e / j > _this.f * 2) {
_this.h = 2;
}
}
}
}
}
break;
}
return _this;
}
LinearCategorySnapper.prototype.i = function (a, b, c, d) {
var e = Snapper.e(b - a, false);
if (isNaN_(this.g)) {
var f = Math.max(c - 1, 1);
this.g = Snapper.e(e / f, d);
}
if (this.g < 1) {
this.g = 1;
}
var g = Math.floor(a / this.g) * this.g;
var h = Math.ceil(b / this.g) * this.g;
var i = truncate(Math.round((h - g) / this.g));
return i;
};
LinearCategorySnapper.$t = markType(LinearCategorySnapper, 'LinearCategorySnapper', Snapper.$);
return LinearCategorySnapper;
}(Snapper));
export { LinearCategorySnapper };