igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
176 lines (175 loc) • 5.99 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, __values } from "tslib";
import { fromEnum, markType } from "igniteui-react-core";
import { NumericYAxis } from "./NumericYAxis";
import { NumericScaler } from "./NumericScaler";
import { AxisRange } from "./AxisRange";
import { PercentChangeAxisRenderer } from "./PercentChangeAxisRenderer";
import { isNaN_ } from "igniteui-react-core";
import { AutoRangeCalculator } from "./AutoRangeCalculator";
/**
* @hidden
*/
var PercentChangeYAxis = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PercentChangeYAxis, _super);
function PercentChangeYAxis() {
return _super !== null && _super.apply(this, arguments) || this;
}
PercentChangeYAxis.prototype.ak = function () {
return new PercentChangeYAxis();
};
PercentChangeYAxis.prototype.ot = function () {
return new VerticalPercentChangeScaler(this);
};
PercentChangeYAxis.prototype.oh = function () {
var e_1, _a;
var a = 1.7976931348623157E+308;
var b = -1.7976931348623157E+308;
try {
for (var _b = __values(fromEnum(this.ed())), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
var d = c.ay(this);
if (d == null) {
continue;
}
var e = c.i0();
if (isNaN_(e) || e == 0) {
continue;
}
var f = d.b - e;
var g = e - d.c;
var h = Math.abs(f / e * 100);
var i = Math.abs(g / e * 100);
a = Math.min(a, -i);
b = Math.max(b, h);
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
return new AxisRange(a, b);
};
PercentChangeYAxis.prototype.op = function (a) {
return new PercentChangeAxisRenderer(a);
};
PercentChangeYAxis.prototype.e3 = function (a, b) {
var c = ((a - b.b) / b.b) * 100;
if (c < this.pr) {
var d = ((this.pr / 100) * b.b) + b.b;
return d;
}
if (c > this.pq) {
var e = ((this.pq / 100) * b.b) + b.b;
return e;
}
return a;
};
PercentChangeYAxis.prototype.j$d = function (a, b) {
return this.fw.apply(this, arguments);
};
PercentChangeYAxis.prototype.j$c = function (a, b) {
return this.ft.apply(this, arguments);
};
PercentChangeYAxis.prototype.j$e = function (a, b, c, d, e) {
this.j5.apply(this, arguments);
};
PercentChangeYAxis.prototype.j$f = function (a, b, c, d) {
this.j6.apply(this, arguments);
};
PercentChangeYAxis.prototype.j$g = function (a, b, c, d) {
this.j7.apply(this, arguments);
};
Object.defineProperty(PercentChangeYAxis.prototype, "j$b", {
get: function () {
return this.df;
},
enumerable: false,
configurable: true
});
PercentChangeYAxis.prototype.j$a = function () {
return this.ag.apply(this, arguments);
};
PercentChangeYAxis.$t = markType(PercentChangeYAxis, 'PercentChangeYAxis', NumericYAxis.$);
return PercentChangeYAxis;
}(NumericYAxis));
export { PercentChangeYAxis };
/**
* @hidden
*/
var VerticalPercentChangeScaler = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(VerticalPercentChangeScaler, _super);
function VerticalPercentChangeScaler(a) {
var _this = _super.call(this) || this;
_this.ad = null;
_this.ad = a;
return _this;
}
VerticalPercentChangeScaler.prototype.t = function (a, b, c, d, e) {
var f = AutoRangeCalculator.a(this.ad, b, c, false, -1, d, e);
d = f.p5;
e = f.p6;
return {
p3: d,
p4: e
};
};
VerticalPercentChangeScaler.prototype.p = function (a, b) {
if (!b.c.isEmpty) {
var c = this.ae(a, NumericScaler.ac, b.c, b.b, b.a);
c = (c - b.d.top) / b.d.height;
c = b.d.top + b.d.height * (c - b.e.top) / b.e.height;
return c;
}
return this.ae(a, b.e, b.d, b.b, b.a);
};
VerticalPercentChangeScaler.prototype.ae = function (a, b, c, d, e) {
var f;
if (isNaN_(d)) {
f = a;
}
else {
var g = (a - d) / Math.abs(d) * 100;
f = g;
}
var h = (f - this.o) / this.m;
if (!e) {
h = 1 - h;
}
return c.top + c.height * (h - b.top) / b.height;
};
VerticalPercentChangeScaler.prototype.q = function (a, b) {
var c = b.b;
var d = b.e.top + b.e.height * (a - b.d.top) / b.d.height;
if (!b.a) {
d = 1 - d;
}
var e = this.o + d * (this.m);
var f;
if (isNaN_(c)) {
f = e;
}
else {
var g = ((e) * Math.abs(c) / 100) + c;
f = g;
}
return f;
};
VerticalPercentChangeScaler.$t = markType(VerticalPercentChangeScaler, 'VerticalPercentChangeScaler', NumericScaler.$);
return VerticalPercentChangeScaler;
}(NumericScaler));
export { VerticalPercentChangeScaler };