igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
193 lines (192 loc) • 6.78 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 { Base, runOn, delegateRemove, delegateCombine, fromEnum, markType } from "igniteui-angular-core";
import { IAxisAnnotationManager_$type } from "./IAxisAnnotationManager";
import { LabelPosition } from "./LabelPosition";
/**
* @hidden
*/
var AxisAnnotationManager = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(AxisAnnotationManager, _super);
function AxisAnnotationManager() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._owner = null;
return _this;
}
Object.defineProperty(AxisAnnotationManager.prototype, "owner", {
get: function () {
return this._owner;
},
set: function (a) {
this._owner = a;
},
enumerable: false,
configurable: true
});
AxisAnnotationManager.prototype.onAddAnnotations = function (a) {
var b = 0;
for (var c = 0; c < a.ao.count; c++) {
b = this.a(a, a.ao._inner[c], b);
}
for (var d = 0; d < a.an.count; d++) {
b = this.a(a, a.an._inner[d], b);
}
a.bp.count = b;
a.bq.count = b;
};
AxisAnnotationManager.prototype.a = function (a, b, c) {
var d = NaN;
d = b.value;
var e = new LabelPosition(a.e6(d));
if (a.cc) {
var f = a;
if (f.categoryMode == 2) {
var g = a.bi.v4;
var h = a.kh;
var i = a.kc();
e.c += (a.ch ? -f.getCategorySize(g, h, i) * 0.5 : f.getCategorySize(g, h, i) * 0.5);
}
}
var j = e.c;
if (a.cp) {
if (e.c > a.kh.bottom || e.c < a.kh.top) {
return c;
}
}
else {
if (e.c > a.kh.right || e.c < a.kh.left) {
return c;
}
}
var k = a.bp.item(c);
var l = a.bq.item(c);
var m = 100 + c * 2;
c++;
l.al = b.resolveLabelValue();
if (b.textColor != null) {
l.ao = b.textColor;
}
k._fill = b.background;
k.ap = b.backgroundCornerRadius;
k.aq = b.backgroundCornerRadius;
k._stroke = b.outline;
k.ad = b.strokeThickness;
k.s = m;
l.s = m + 1;
b.checkForExtentReset(function () { return e.b = true; });
e.a = true;
e.d = b.backgroundPadding;
a.de.add(e);
a.dd.add1(l.al);
return c;
};
AxisAnnotationManager.prototype.arrangeAnnotations = function (a, b, c, d, e, f, g, h, i, j) {
for (var k = 0; k < a.bq.count; k++) {
var l = a.bp.item(k);
var m = -1;
for (var n = c.count - 1; n >= 0; n--) {
if (c._inner[n] == a.bq.item(k)) {
m = n;
break;
}
}
if (m == -1) {
continue;
}
if (e) {
b.z(l, a.bq.item(k), a.de._inner[m], d._inner[m], g, h, i, j);
b.ar(l, a.bq.item(k), a.de._inner[m], d._inner[m], g, h, i, j, f);
}
else {
b.z(l, a.bq.item(k), a.de._inner[m], d._inner[m], g, h, i, j);
b.ad(l);
}
}
};
AxisAnnotationManager.prototype.b = function (a, b) {
this.owner.cq = true;
this.owner.ia();
};
AxisAnnotationManager.prototype.c = function (a) {
if (a.oldItems != null) {
for (var b = 0; b < a.oldItems.count; b++) {
var c = a.oldItems.item(b);
if (c == null) {
continue;
}
var d = c;
d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.b));
}
}
if (a.newItems != null) {
for (var e = 0; e < a.newItems.count; e++) {
var f = a.newItems.item(e);
if (f == null) {
continue;
}
var g = f;
g.propertyChanged = delegateCombine(g.propertyChanged, runOn(this, this.b));
}
}
this.owner.cq = true;
this.owner.ia();
};
AxisAnnotationManager.prototype.onAnnotionsChanged = function (a, b, c) {
this.c(c);
};
AxisAnnotationManager.prototype.onAnnotionsReset = function (a, b, c) {
var e_1, _a;
try {
for (var _b = __values(fromEnum(b)), _c = _b.next(); !_c.done; _c = _b.next()) {
var d = _c.value;
d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.b));
}
}
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;
}
}
};
AxisAnnotationManager.prototype.onAutoAnnotionsChanged = function (a, b, c) {
this.c(c);
};
AxisAnnotationManager.prototype.onAutoAnnotionsReset = function (a, b, c) {
var e_2, _a;
try {
for (var _b = __values(fromEnum(b)), _c = _b.next(); !_c.done; _c = _b.next()) {
var d = _c.value;
d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.b));
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
};
AxisAnnotationManager.$t = markType(AxisAnnotationManager, 'AxisAnnotationManager', Base.$, [IAxisAnnotationManager_$type]);
return AxisAnnotationManager;
}(Base));
export { AxisAnnotationManager };