UNPKG

igniteui-webcomponents-charts

Version:

Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.

710 lines (709 loc) 25.2 kB
/* 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 { AnnotationLayer } from "./AnnotationLayer"; import { Series } from "./Series"; import { DependencyProperty } from "igniteui-webcomponents-core"; import { CategoryItemHighlightType_$type } from "./CategoryItemHighlightType"; import { MarkerType_$type } from "./MarkerType"; import { Brush } from "igniteui-webcomponents-core"; import { DataTemplate } from "igniteui-webcomponents-core"; import { CategoryItemHighlightLayerFrame } from "./CategoryItemHighlightLayerFrame"; import { Base, enumGetBox, fromEnum, typeCast, Point_$type, markType, markDep, runOn } from "igniteui-webcomponents-core"; import { Dictionary$2 } from "igniteui-webcomponents-core"; import { ItemHighlightFrameRect } from "./ItemHighlightFrameRect"; import { List$1 } from "igniteui-webcomponents-core"; import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference"; import { Rect } from "igniteui-webcomponents-core"; import { MarkerSeries } from "./MarkerSeries"; import { DataContext } from "igniteui-webcomponents-core"; import { Pool$1 } from "igniteui-webcomponents-core"; import { Rectangle } from "igniteui-webcomponents-core"; import { ContentControl } from "igniteui-webcomponents-core"; import { PropertyMetadata } from "igniteui-webcomponents-core"; import { isNaN_, isInfinity, truncate } from "igniteui-webcomponents-core"; import { AnnotationLayerView } from "./AnnotationLayerView"; import { Marker } from "./Marker"; import { BrushUtil } from "igniteui-webcomponents-core"; import { Color } from "igniteui-webcomponents-core"; import { DataTemplatePassInfo } from "igniteui-webcomponents-core"; import { DataTemplateRenderInfo } from "igniteui-webcomponents-core"; import { DataTemplateMeasureInfo } from "igniteui-webcomponents-core"; /** * @hidden */ export var CategoryItemHighlightLayer = /** @class */ /*@__PURE__*/ (function (_super) { __extends(CategoryItemHighlightLayer, _super); function CategoryItemHighlightLayer() { var _this = _super.call(this) || this; _this.aay = false; _this.aax = true; _this.aa1 = 10; var a = new CategoryItemHighlightLayerFrame(); var b = new CategoryItemHighlightLayerFrame(); var c = new CategoryItemHighlightLayerFrame(); _this.xx = a; _this.xw = b; _this.xy = c; _this.ab = CategoryItemHighlightLayer.$; return _this; } CategoryItemHighlightLayer.prototype.bk = function () { return new CategoryItemHighlightLayer(); }; CategoryItemHighlightLayer.prototype.get_eu = function () { return true; }; CategoryItemHighlightLayer.prototype.ct = function () { return new CategoryItemHighlightLayerView(this); }; CategoryItemHighlightLayer.prototype.rh = function (a) { _super.prototype.rh.call(this, a); this.aas = a; }; CategoryItemHighlightLayer.prototype.zd = function (a, b) { if (this.aaw == null || this.aaw == a) { if (!this.a1.c) { this.r8(b); } } }; CategoryItemHighlightLayer.prototype.x4 = function (a) { if (!_super.prototype.x4.call(this, a)) { return false; } if (this.aba != null) { if (a.isFragment) { var b = a.nn(); if (!Base.equalsStatic(this.aba, b)) { return false; } } else { if (!Base.equalsStatic(this.aba, a.name)) { return false; } } } var c = this.oz(a, this.aap); if (!c.c) { return false; } return true; }; CategoryItemHighlightLayer.prototype.zf = function (a, b) { var e_1, _a; var _this = this; _super.prototype.zf.call(this, a, b); var c = a; var d = this.aa0; c.j.clear(); if (isNaN_(this.aap.x) && isNaN_(this.aap.y)) { return; } if (this.x4(this.aaw)) { this.abg(this.aaw, c, d); } else { try { for (var _b = __values(fromEnum(this.dc.b9)), _c = _b.next(); !_c.done; _c = _b.next()) { var e = _c.value; if (this.x4(e)) { this.abg(e, c, d); } if (e.isStacked) { e.qh(function (f) { if (_this.x4(f)) { _this.abg(f, c, d); } if (f.ei) { f.qf(function (g) { if (_this.x4(g)) { _this.abg(g, c, d); } return true; }); } return true; }); } if (e.ei) { e.qf(function (f) { if (_this.x4(f)) { _this.abg(f, c, d); } return true; }); } } } 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; } } } }; CategoryItemHighlightLayer.prototype.rq = function (a, b, c, d) { _super.prototype.rq.call(this, a, b, c, d); switch (b) { case CategoryItemHighlightLayer.$$p[4]: case CategoryItemHighlightLayer.$$p[5]: case CategoryItemHighlightLayer.$$p[2]: case CategoryItemHighlightLayer.$$p[3]: this.r8(true); break; case CategoryItemHighlightLayer.$$p[7]: case CategoryItemHighlightLayer.$$p[8]: this.r8(true); break; case CategoryItemHighlightLayer.$$p[9]: this.aay = d; this.r8(true); break; case CategoryItemHighlightLayer.$$p[1]: this.r8(true); break; case CategoryItemHighlightLayer.$$p[0]: this.aa1 = this.aa2; this.r8(true); break; case CategoryItemHighlightLayer.$$p[6]: this.aax = d; this.r8(true); break; } }; CategoryItemHighlightLayer.prototype.abg = function (a, b, c) { if (this.cw == null || this.cw.ca.isEmpty || this.cw.b9.isEmpty) { return; } if (!a.e1 && !a.fa) { return; } var d = a; if (d.categoryAxis == null) { return; } var e = this.aap.x; e = this.cw.b9.left + this.cw.b9.width * (e - this.cw.ca.left) / this.cw.ca.width; var f = this.aap.y; f = this.cw.b9.top + this.cw.b9.height * (f - this.cw.ca.top) / this.cw.ca.height; var g = this.aaz; var h = true; var i = typeCast(IHasCategoryModePreference_$type, a); var j = 0; if (i != null) { j = i.preferredCategoryMode(d.categoryAxis); if (j == 2) { h = false; } } var k = true; if (!h || this.aat == 2) { k = false; } if (this.aat == 1) { k = true; } var l = this.oz(a, this.aap); if (!l.c) { return; } if (k) { var m = a.ww(l.d, this.aa0, g); if (j != 0 && !d.categoryAxis.dv) { var n = m.x; if (a.fa) { n -= a.getOffsetValue(); n += a.getCategoryWidth() * 0.5; m = { $type: Point_$type, x: n, y: m.y }; } else if (a.e1) { n -= a.getOffsetValue(); n += a.getCategoryWidth() * 0.5; m = { $type: Point_$type, x: n, y: m.y }; } } if (!isNaN_(m.x) && !isNaN_(m.y)) { m = this.w2(m); } this.abe(m, b, a); } else { var o = a.ww(l.d, this.aa0, g); var p = void 0; var q = this.getEffectiveViewport1(this.cw); if (a.isVertical) { var r = o.y; var s = d.categoryAxis; var t = this.aa1; if (j != 0) { t = s.pz(this.cw.ca, this.cw.b9, q); } if (isNaN_(t) || isInfinity(t)) { return; } p = new Rect(0, this.xd.left, r - t / 2, this.xd.width, t); } else { var u = o.x; var v = d.categoryAxis; var w = this.aa1; if (j != 0) { w = v.pz(this.cw.ca, this.cw.b9, q); } if (isNaN_(w) || isInfinity(w)) { return; } p = new Rect(0, u - w / 2, this.xd.top, w, this.xd.height); } p.intersect(this.cw.b9); this.abf(p, b, a); } }; CategoryItemHighlightLayer.prototype.abe = function (a, b, c) { var d = new ItemHighlightFrameRect(); d.b = a.x; d.e = a.y; d.i = this.aab(); if (this.abu != null) { d.i = this.abu; } d.j = this.aac(); if (this.abv != null) { d.j = this.abv; } if (d.i == null) { if (c.hasMarkers) { d.i = this.aas.c1(c.v5()); } else { d.i = this.aas.c1(c.vt); } } if (d.j == null) { if (c.hasMarkers) { d.j = this.aas.c1(c.v6()); } else { d.j = this.aas.c1(c.vx); } } d.d = this.il; d.f = Base.getHashCodeStatic(c); d.g = this.aau(c, a); var e = (typeCast(MarkerSeries.$, c) !== null) ? c.yl : null; if (e == null || e == MarkerSeries.yo || (this.aav != 2 && this.aav != 0)) { var f = MarkerSeries.xw(c, 2); if (this.aav != 2 && this.aav != 0) { f = this.aav; } switch (f) { case 3: case 13: e = this.dc.uh; break; case 4: e = this.dc.uq; break; case 5: e = this.dc.un; break; case 6: e = this.dc.uo; break; case 7: e = this.dc.ui; break; case 8: e = this.dc.ul; break; case 9: e = this.dc.uj; break; case 10: e = this.dc.up; break; case 11: e = this.dc.um; break; case 12: e = this.dc.uk; break; } } d.h = this.abj != null ? this.abj : e; if (!isNaN_(d.b) && !isNaN_(d.e)) { b.j.addItem(d.f, d); } }; CategoryItemHighlightLayer.prototype.aau = function (a, b) { var c = a.kw(b); var d = a.iy(b); if (this.aa0 && d != Math.floor(d)) { c = null; } return ((function () { var $ret = new DataContext(); $ret.series = a; $ret.item = c; return $ret; })()); }; CategoryItemHighlightLayer.prototype.abf = function (a, b, c) { var d = new ItemHighlightFrameRect(); d.b = a.left; d.e = a.top; d.c = a.right; d.a = a.bottom; d.i = this.aab(); d.j = this.aac(); if (d.i == null) { if (c != null) { d.i = this.aas.c2(c.vt); } } if (d.j == null) { if (c != null) { d.j = this.aas.c2(c.vx); } } d.d = this.il; d.f = Base.getHashCodeStatic(c); if (!a.isEmpty) { b.j.addItem(d.f, d); } }; CategoryItemHighlightLayer.prototype.zi = function (a, b) { var e_2, _a; _super.prototype.zi.call(this, a, b); var c = this.aas.cp; var d = this.aas.co; var e = 0; var f = 0; var g = a; try { for (var _b = __values(fromEnum(g.j.values)), _c = _b.next(); !_c.done; _c = _b.next()) { var h = _c.value; if (h.h != null) { var i = d.item(f); this.abh(h, i); f++; } else { var j = c.item(e); this.abi(h, j); e++; } } } 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; } } c.count = e; d.count = f; }; CategoryItemHighlightLayer.prototype.abh = function (a, b) { if (isNaN_(a.b) || isNaN_(a.e) || isNaN_(a.d) || a.g == null) { b._visibility = 1; return; } var c = { $type: Point_$type, x: a.b, y: a.e }; var d = a.g; d.itemBrush = a.i; var e = d.series.ww(c, this.d4() || this.aay, this.aax); if (isNaN_(e.x) || isNaN_(e.y)) { b._visibility = 1; return; } this.aas.cv(b, e.x, e.y); b.ah = a.h; b.content = a.g; }; CategoryItemHighlightLayer.prototype.abi = function (a, b) { if (isNaN_(a.b) || isNaN_(a.e) || isNaN_(a.a) || isNaN_(a.c) || isNaN_(a.d)) { b._visibility = 1; return; } this.aas.cw(b, a.b, a.e, a.c - a.b, a.a - a.e); b._fill = a.i; b._stroke = a.j; b.ad = a.d; if (this.wm != null) { b.ai = this.wm; } else { b.ai = null; } b.aj = this.wn; b.am = this.wp; b.al = this.wo; b.ak = this.wo; b.ac = this.jp; }; CategoryItemHighlightLayer.prototype.gg = function () { return true; }; CategoryItemHighlightLayer.$t = markType(CategoryItemHighlightLayer, 'CategoryItemHighlightLayer', AnnotationLayer.$); CategoryItemHighlightLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CategoryItemHighlightLayer, 'raisePropertyChanged', ['BandHighlightWidth:aa2:abk', [1, 10], 'HighlightType:aat:abl', [CategoryItemHighlightType_$type, enumGetBox(CategoryItemHighlightType_$type, 0)], 'MarkerBrush:abu:abm', [Brush.$, null], 'MarkerOutline:abv:abn', [Brush.$, null], 'MarkerTemplate:abj:abo', [DataTemplate.$, null], 'MarkerType:aav:abp', [MarkerType_$type, enumGetBox(MarkerType_$type, 2)], 'SkipUnknownValues:aaz:abq', [0, true], 'TargetSeriesName:aba:abr', [2, null], 'TargetSeries:aaw:abs', [Series.$, null], 'UseInterpolation:aa0:abt', [0, false]]); return CategoryItemHighlightLayer; }(AnnotationLayer)); /** * @hidden */ export var CategoryItemHighlightLayerView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(CategoryItemHighlightLayerView, _super); function CategoryItemHighlightLayerView(a) { var _this = _super.call(this, a) || this; _this.cn = null; _this.cp = null; _this.co = null; _this.cq = null; _this.cr = null; _this.cn = a; _this.cq = new List$1(ContentControl.$, 0); _this.cr = new List$1(Rectangle.$, 0); return _this; } CategoryItemHighlightLayerView.prototype.a4 = function () { var _this = this; _super.prototype.a4.call(this); this.cp = ((function () { var $ret = new Pool$1(Rectangle.$); $ret.create = runOn(_this, _this.c3); $ret.activate = runOn(_this, _this.cx); $ret.disactivate = runOn(_this, _this.cz); $ret.destroy = runOn(_this, _this.cy); return $ret; })()); this.co = ((function () { var $ret = new Pool$1(ContentControl.$); $ret.create = runOn(_this, _this.c0); $ret.activate = runOn(_this, _this.cs); $ret.disactivate = runOn(_this, _this.cu); $ret.destroy = runOn(_this, _this.ct); return $ret; })()); }; CategoryItemHighlightLayerView.prototype.c3 = function () { var a = new Rectangle(); a.ab = false; this.cr.add(a); return a; }; CategoryItemHighlightLayerView.prototype.cx = function (a) { a._visibility = 0; }; CategoryItemHighlightLayerView.prototype.cz = function (a) { a._visibility = 1; }; CategoryItemHighlightLayerView.prototype.cy = function (a) { this.cr.remove(a); }; CategoryItemHighlightLayerView.prototype.c0 = function () { var a = new Marker(); this.cq.add(a); return a; }; CategoryItemHighlightLayerView.prototype.cs = function (a) { a._visibility = 0; }; CategoryItemHighlightLayerView.prototype.cu = function (a) { a._visibility = 1; }; CategoryItemHighlightLayerView.prototype.ct = function (a) { this.cq.remove(a); }; CategoryItemHighlightLayerView.prototype.c1 = function (a) { if (a == null) { return a; } return BrushUtil.o(a, 0.3); }; CategoryItemHighlightLayerView.prototype.c2 = function (a) { if (a != null) { var b = BrushUtil.o(a, 0.3); if (b.isGradient) { var c = b; if (c.gradientStops != null) { for (var d = 0; d < c.gradientStops.length; d++) { var e = c.gradientStops[d]; e.color = Color.u(truncate(Math.round((e.color.l) * 0.3)), e.color.o, e.color.n, e.color.m); e.color = e.color; } } } else { b.color = Color.u(truncate(Math.round((b.color.l & 255) * 0.3)), b.color.o, b.color.n, b.color.m); b.color = b.color; } return b; } else { return null; } }; CategoryItemHighlightLayerView.prototype.cw = function (a, b, c, d, e) { a._visibility = 0; a.n = b; a.o = c; a.width = d; a.height = e; }; CategoryItemHighlightLayerView.prototype.cv = function (a, b, c) { a.n = b; a.o = c; }; CategoryItemHighlightLayerView.prototype.bv = function (a, b) { _super.prototype.bv.call(this, a, b); var c = a; var d = c.content; if (d != null) { if (d.itemBrush != null) { d.actualItemBrush = d.itemBrush; } var e = d.series; if (e.hasMarkers) { d.outline = e.v6(); } d.thickness = e.iu(); } }; CategoryItemHighlightLayerView.prototype.bj = function (a, b) { var e_3, _a; _super.prototype.bj.call(this, a, b); if (a.d && !b) { for (var c = 0; c < this.cr.count; c++) { var d = this.cr._inner[c]; if (d._visibility == 0) { a.w(d); } } if (this.cq.count > 0) { var e = new DataTemplatePassInfo(); e.isHitTestRender = b; e.context = a.h(); e.viewportTop = this.b9.top; e.viewportLeft = this.b9.left; e.viewportWidth = this.b9.width; e.viewportHeight = this.b9.height; e.passID = "ItemMarkers"; var f = new DataTemplateRenderInfo(); f.isHitTestRender = b; f.passInfo = e; var g = new DataTemplateMeasureInfo(); g.passInfo = e; var h = false; var i = a.h(); g.context = i; f.context = i; g.renderContext = a; f.renderContext = a; var j = 0; var k = 0; var l = new Dictionary$2(DataTemplate.$, DataTemplate.$, 0); for (var m = 0; m < this.cq.count; m++) { var n = this.cq._inner[m]; if (n == null || n.ah == null) { continue; } var o = n.ah; if (!l.containsKey(o)) { l.addItem(o, o); if (o != null && o.passStarting != null) { o.passStarting(e); } } if (n._visibility == 1) { continue; } this.bu(n, m, b); if (!h) { g.data = n.content; g.width = n.width; g.height = n.height; if (o.measure != null) { g.data = n.content; o.measure(g); h = g.isConstant; if (h) { j = g.width; k = g.height; } } f.availableWidth = g.width; f.availableHeight = g.height; } else { f.availableWidth = j; f.availableHeight = k; } if (!isNaN_(n.width) && !isInfinity(n.width)) { f.availableWidth = n.width; } if (!isNaN_(n.height) && !isInfinity(n.height)) { f.availableHeight = n.height; } a.q(f, n); n.m = f.availableWidth; n.l = f.availableHeight; } try { for (var _b = __values(fromEnum(l.keys)), _c = _b.next(); !_c.done; _c = _b.next()) { var p = _c.value; if (p != null && p.passCompleted != null) { p.passCompleted(e); } } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_3) throw e_3.error; } } } } }; CategoryItemHighlightLayerView.prototype.ax = function (a) { _super.prototype.ax.call(this, a); for (var b = 0; b < this.cr.count; b++) { this.f.bc.exportRectangleData(a, this.cr._inner[b], "catItemRect", ["Main", "CategoryItem"]); } for (var c = 0; c < this.cq.count; c++) { this.f.bc.exportMarkerVisualDataFromMarker(this.f, a, this.cq._inner[c]); } }; CategoryItemHighlightLayerView.$t = markType(CategoryItemHighlightLayerView, 'CategoryItemHighlightLayerView', AnnotationLayerView.$); return CategoryItemHighlightLayerView; }(AnnotationLayerView));