UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

815 lines (814 loc) 29.3 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 { CategorySeries } from "./CategorySeries"; import { IIsCategoryBased_$type } from "./IIsCategoryBased"; import { IHasSingleValueCategory_$type } from "./IHasSingleValueCategory"; import { IHasCategoryTrendline_$type } from "./IHasCategoryTrendline"; import { ITrendLineSeries_$type } from "./ITrendLineSeries"; import { IAnchoredCategorySeriesInteractionManager_$type } from "./IAnchoredCategorySeriesInteractionManager"; import { DVContainer } from "igniteui-angular-core"; import { Point_$type, enumGetBox, typeCast, runOn, delegateCombine, markType, markDep } from "igniteui-angular-core"; import { DependencyProperty } from "igniteui-angular-core"; import { Series } from "./Series"; import { TrendLineType_$type } from "igniteui-angular-core"; import { Brush } from "igniteui-angular-core"; import { PenLineCap_$type } from "igniteui-angular-core"; import { DoubleCollection } from "igniteui-angular-core"; import { CategoryFrame } from "./CategoryFrame"; import { ICategoryScaler_$type } from "./ICategoryScaler"; import { IScaler_$type } from "./IScaler"; import { CategorySeriesView } from "./CategorySeriesView"; import { CategorySeriesMarkerCollisionAvoidance_$type } from "./CategorySeriesMarkerCollisionAvoidance"; import { ConsolidatedItemHitTestBehavior_$type } from "./ConsolidatedItemHitTestBehavior"; import { CategoryFramePreparer } from "./CategoryFramePreparer"; import { DataLegendSeriesValueInfo } from "igniteui-angular-core"; import { DataLegendSeriesContext } from "igniteui-angular-core"; import { List$1 } from "igniteui-angular-core"; import { Rect } from "igniteui-angular-core"; import { ISortingAxis_$type } from "./ISortingAxis"; import { IFastItemsSource_$type } from "igniteui-angular-core"; import { NumericAxisBase } from "./NumericAxisBase"; import { CategoryBucketCalculator } from "./CategoryBucketCalculator"; import { AxisRange } from "./AxisRange"; import { NumericYAxis } from "./NumericYAxis"; import { ScalerParams } from "./ScalerParams"; import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay"; import { CategoryMarkerManager } from "./CategoryMarkerManager"; import { CollisionAvoider } from "./CollisionAvoider"; import { NonCollisionAvoider } from "./NonCollisionAvoider"; import { CategoryAxisBase } from "./CategoryAxisBase"; import { ChartSelection } from "./ChartSelection"; import { PropertyMetadata } from "igniteui-angular-core"; import { truncate, isNaN_, isInfinity } from "igniteui-angular-core"; import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory"; /** * @hidden */ export let AnchoredCategorySeries = /*@__PURE__*/ (() => { class AnchoredCategorySeries extends CategorySeries { constructor() { super(); this.aay = null; this.aa5 = false; this.aa0 = null; this.aav = null; this.abc = null; this.abb = null; this.aa2 = true; this.aa6 = 0; this.aa7 = 0; this.yy = new CategoryFramePreparer(1, this, this.y2, this, this, this.y2.cw); } get aaz() { if (this.aay == null) { this.aay = DVContainer.instance.createInstance(IAnchoredCategorySeriesInteractionManager_$type, () => this.dr.n); } return this.aay; } getHostReferenceValue() { return this.ix(); } md() { return AnchoredCategorySeries.$$p[5]; } cs() { let a = new AnchoredCategorySeriesView(this); return a; } q0(a) { super.q0(a); this.aau = a; } kp(a, b) { let c = this.nc(b); if (c == AnchoredCategorySeries.$$p[5]) { return this.kq(a, b, this.abm); } if (c == AnchoredCategorySeries.$$p[1]) { return this.kq(a, b, this.abe); } return super.kp(a, b); } mc(a) { let b = this.nc(a); if (b == AnchoredCategorySeries.$$p[5]) { return this.abm; } if (b == AnchoredCategorySeries.$$p[1]) { return this.abe; } return super.mc(a); } get valueColumn() { return this.aa0; } set valueColumn(a) { if (this.aa0 != a) { let b = this.aa0; this.aa0 = a; if (!this.aa5) { this.raisePropertyChanged("ValueColumn", b, this.aa0); } } } getDataLegendSeriesContextAt(a, b) { let c = new DataLegendSeriesValueInfo(); c.a = 0; c.l = this.i4({ $type: Point_$type, x: a, y: b }, false, false); c.r = this.abm != null ? this.abm : "Value"; c.q = "Value"; c.s = this.abi != null ? this.abi : "V:"; c.t = this.abk != null ? this.abk : ""; let d = new DataLegendSeriesContext(); d.e = ((() => { let $ret = new List$1(DataLegendSeriesValueInfo.$, 0); $ret.add(c); return $ret; })()); d.h = this.mb(); return d; } get ab9() { return this.c(AnchoredCategorySeries.abv); } set ab9(a) { this.h(AnchoredCategorySeries.abv, a); } gc(a) { let b = new Rect(0, 0, 0, 1, 1); let c = this.fetchXAxis(); let d = this.fetchYAxis(); let e = this.wk(this.cv); let f = c != null ? this.yy.r(typeCast(ICategoryScaler_$type, c), b, b, e) : 0; return this.aaz.c$a(this, this.valueColumn, c, d, f, a); } aar(a, b, c) { if (b < a || a < 0 || a > this.valueColumn.count || b < 0 || b > this.valueColumn.count || c == null) { return null; } let d = new Array((b - a) + 1); let e = c.cn; let f = null; if (e) { f = c.i$b; } for (let g = a; g <= b; g++) { let h = g; if (e) { h = f._inner[h]; } d[g - a] = this.dn.item(g); } return d; } q8(a, b, c, d) { super.q8(a, b, c, d); if (this.aau.c8 && this.aau.c7.g$b(a, b, c, d)) { let e = false; if (b == "FastItemsSource") { e = this.gf && c != null; } this.rq(e); this.qk(); } switch (b) { case AnchoredCategorySeries.$$p[3]: case AnchoredCategorySeries.$$p[4]: this.qe(); break; case "FastItemsSource": if (typeCast(IFastItemsSource_$type, c) != null) { c.deregisterColumn(this.valueColumn); this.valueColumn = null; } if (typeCast(IFastItemsSource_$type, d) != null) { this.valueColumn = this.dk(this.abm); } let f = typeCast(NumericAxisBase.$, this.fetchYAxis()); if (f != null && !f.c1()) { this.aau.cw.g(this.ic); this.rq(this.gf && c != null); } break; case AnchoredCategorySeries.$$p[5]: if (this.dn != null) { this.dn.deregisterColumn(this.valueColumn); this.valueColumn = this.dk(this.abm); } this.abc = this.abm; break; case AnchoredCategorySeries.$$p[1]: this.abb = this.abe; this.rq(true); break; case "ValueColumn": if (this.aau.c8) { this.aau.c7.g$i(); } let g = typeCast(NumericAxisBase.$, this.fetchYAxis()); if (g != null && !g.c1()) { this.aau.cw.g(this.ic); this.rq(this.gf && this.d7); } this.abu(); this.sm(); break; case "TrendLineBrush": this.re(b); break; case "ErrorBarSettings": this.rq(false); break; case "TrendLineType": this.qk(); break; case AnchoredCategorySeries.$$p[2]: this.rq(false); break; } } ay(a) { if (this.valueColumn == null || this.valueColumn.count == 0) { return null; } if (a == this.fetchXAxis()) { return new AxisRange(0, this.valueColumn.count - 1); } if (a == this.fetchYAxis()) { return new AxisRange(this.valueColumn.minimum, this.valueColumn.maximum); } return null; } pa(a, b, c, d) { switch (a) { case 4: case 1: case 0: this.aau.cw.g(this.ic); break; } if (this.aau.c8) { this.aau.c7.g$e(a, b, c, d); } this.abu(); this.sm(); if (a == 0 || a == 2 || a == 3 || a == 4) { this.aa2 = true; } else if (a == 1) { for (let e = b; e < b + c; e++) { this.aa6 += this.valueColumn.item(e); } this.aa7 = this.aa6 / this.valueColumn.count; } } zt() { return this.aa8(this.y2); } aa8(a) { let b = 0; let c = a.by; let d = a.bx; let e = this.getEffectiveViewport1(a); let f = typeCast(NumericYAxis.$, this.fetchYAxis()); if (!c.isEmpty && !d.isEmpty && f != null) { let g = new ScalerParams(0, c, d, f.ch, e); if (f.cp) { g.b = this.ix(); } b = f.el(f.me, g); } return b; } abs(a, b, c) { let d = this.aa8(c); if (a.count > 0) { let e = d; a.add({ $type: Point_$type, x: a._inner[a.count - 1].x, y: e }); a.add({ $type: Point_$type, x: a._inner[0].x, y: e }); } } aas(a, b, c, d) { return this.aat(a, b, c, d, false); } aat(a, b, c, d, e) { return CategorySeries.ym(a, b, c, d, e); } ga() { return this.highlightedItemsSource != null || this.abe != null; } hs() { let a = super.hs(); { let b = ((() => { let $ret = new SeriesLayerPropertyOverlay(); $ret.ad = "ValueMemberPath"; $ret.p = true; $ret.y = "HighlightedValueMemberPath"; $ret.q = true; return $ret; })()); b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.abo)); a.add(b); } return a; } abo(a, b) { if (this.abe != null) { b.value = this.abe; return; } b.value = this.abm; } hd(a, b, c) { let d = super.hd(a, b, c); let e = c; if (this.valueColumn == null || this.valueColumn.count == 0 || e.cw.d < 1) { d = false; } return d; } o4(a, b) { super.o4(a, b); let c = b; c.c2(); if (c.c8) { c.c7.g$d(); } } aag(a, b) { super.aag(a, b); this.yz(b).d(a, b); } aaj(a, b) { super.aaj(a, b); let c = typeCast(AnchoredCategorySeriesView.$, b); c.b7 = true; if (c.c8) { c.c7.g$g(a.q); } if (this.xf()) { CategoryMarkerManager.e(this, a.n, b.cz, this.xh); this.z8(b, a); b.cr(); } this.abp(a, b); } rp(a, b, c, d, e) { super.rp(a, b, c, d, e); let f = this.ba.a$j.item(d); let g = f; g.cw.g(this.ic); f.a3(c); if (this.d5(g)) { return; } if (this.aav == null) { this.aav = new CategoryFrame(3); } this.aav.v(); this.aag(this.aav, g); this.aaj(this.aav, g); } abp(a, b) { } sg() { super.sg(); if (this.index < 0) { return; } this.aau.dc(); if (this.trendLineBrush != null) { this.aau.da(); } else { this.aau.c9(); } } kw(a, b) { if (this.aau.c8 && a == this.aau.c7.g$j) { return null; } return super.kw(a, b); } get currentCategoryMode() { return this.preferredCategoryMode(typeCast(CategoryAxisBase.$, this.yr())); } get scaler() { return typeCast(ICategoryScaler_$type, this.yr()); } get yScaler() { return typeCast(IScaler_$type, this.y8()); } get bucketizer() { return this.aau.cw; } get currentMode2Index() { return this.zx(); } provideCollisionDetector() { if (this.aaw == 1) { return new CollisionAvoider(); } return NonCollisionAvoider.b; } get trendlinePreparer() { return this.aau.c8 ? this.aau.c7 : null; } py(a) { super.py(a); if (this.aau.c8) { this.bc.exportTrendlineData(this, a, this.aau.c7.g$j); } } km(a) { let b = this.fetchXAxis(); let c = this.fetchYAxis(); return this.aaz.c$b(this, a, this.zu(this.cv), this.valueColumn, b, c, this.aax == 1, (d) => super.km(d)); } get mayContainUnknowns() { return this.valueColumn == null || this.valueColumn.mayContainUnknowns; } ix() { return Series.iy(this.valueColumn, typeCast(ISortingAxis_$type, this.fetchXAxis())); } get_aba() { return 0; } get aba() { return this.get_aba(); } az(a) { if (a.isEmpty && this.db != null) { a = this.db.v4; } if (this.valueColumn == null) { return null; } let b = this.wi(this.cv); let c = this.yr(); let d = new ScalerParams(0, a, this.db.wk, c.ch, this.getEffectiveViewport()); let e = (c.eo(b.left, d)); let f = (c.eo(b.right, d)); if (c.ch) { let g = e; e = f; f = g; } e -= this.aba; f += this.aba; let h = null; if (c.cn) { h = c; e = h.i$f(e); f = h.i$f(f); } else { e = Math.floor(e); f = Math.ceil(f); } if (isNaN_(e) || isNaN_(f)) { return null; } e = Math.max(0, Math.min(this.valueColumn.count - 1, e)); f = Math.max(0, Math.min(this.valueColumn.count - 1, f)); let i = 1.7976931348623157E+308; let j = -1.7976931348623157E+308; if (truncate(e) <= truncate(f)) { for (let k = truncate(e); k <= truncate(f); k++) { let l = k; if (h != null) { l = h.i$b._inner[k]; } let m = this.valueColumn.item(l); if (this.valueColumn.mayContainUnknowns) { if (isInfinity(m) || isNaN_(m)) { continue; } } i = Math.min(i, m); j = Math.max(j, m); } } let n = new AxisRange(i, j); n = this.ax(n, this.y8(), a); return n; } abu() { this.il = this.valueColumn == null || this.valueColumn.count == 0 ? NaN : this.valueColumn.item(this.valueColumn.count - 1); } abt() { if (this.aa2) { this.aa6 = 0; for (let a = 0; a < this.valueColumn.count; a++) { this.aa6 += this.valueColumn.item(a); } this.aa7 = this.aa6 / this.valueColumn.count; this.aa2 = false; } } i7(a, b) { if (b == null || !b.cj) { return NaN; } let c = this.y8(); if (b != c) { return NaN; } let d = this.aq(a); if (c.cp) { return d[1]; } else { return d[0]; } } aq(a) { let b = NaN; switch (a) { case 5: case 2: b = this.valueColumn.maximum; break; case 4: case 1: b = this.valueColumn.minimum; break; case 6: case 3: if (this.aa2) { this.abt(); } b = this.aa7; break; } let c = this.y8(); if (c.cp) { return [NaN, b]; } else { return [b, NaN]; } } we(a) { let b = NaN; switch (a) { case 5: case 2: b = this.valueColumn.maximum; break; case 4: case 1: b = this.valueColumn.minimum; break; case 6: case 3: if (this.aa2) { this.abt(); } b = this.aa7; break; } if (isNaN_(b)) { return { $type: Point_$type, x: NaN, y: NaN }; } let c = this.y8(); let d = this.getEffectiveViewport1(this.cv); let e = new ScalerParams(0, this.cv.by, this.cv.bx, c.ch, d); if (c.cp) { e.b = this.ix(); } e.c = d; if (c.cp) { return { $type: Point_$type, x: NaN, y: c.el(b, e) }; } else { return { $type: Point_$type, x: c.el(b, e), y: NaN }; } } wf(a) { let b = this.y8(); let c = this.getEffectiveViewport1(this.cv); let d = new ScalerParams(0, this.cv.by, this.cv.bx, b.ch, c); if (b.cp) { d.b = this.ix(); } d.c = c; if (b.cp) { return { $type: Point_$type, x: NaN, y: b.el(a[1], d) }; } else { return { $type: Point_$type, x: b.el(a[0], d), y: NaN }; } } aac(a, b, c, d, e, f, g) { if (c < 0 || d < 0) { return; } for (let h = c; h <= d; h++) { if (a == 1) { if (this.aa3(e, f, h)) { if (g == 7 || g == 6) { b.add(((() => { let $ret = new ChartSelection(); $ret.series = this; return $ret; })())); return; } this.z6(b, h, g); } } else { if (this.aa4(e, f, h)) { if (g == 7 || g == 6) { b.add(((() => { let $ret = new ChartSelection(); $ret.series = this; return $ret; })())); return; } this.z6(b, h, g); } } } } aa4(a, b, c) { return this.valueColumn.item(c) < b && a < this.valueColumn.item(c); } aa3(a, b, c) { return 0 < b && a < this.valueColumn.item(c); } z6(a, b, c) { if (c == 2 || c == 1) { a.add(((() => { let $ret = new ChartSelection(); $ret.item = this.dn.item(b); return $ret; })())); } else { a.add(((() => { let $ret = new ChartSelection(); $ret.item = this.dn.item(b); $ret.series = this; return $ret; })())); } } get useHighMarkerFidelity() { return this.zp; } } AnchoredCategorySeries.$t = markType(AnchoredCategorySeries, 'AnchoredCategorySeries', CategorySeries.$, [IIsCategoryBased_$type, IHasSingleValueCategory_$type, IHasCategoryTrendline_$type, ITrendLineSeries_$type]); AnchoredCategorySeries.abv = DependencyProperty.i("ActualTrendLineBrush", Brush.$, AnchoredCategorySeries.$, new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue))); AnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, AnchoredCategorySeries, 'raisePropertyChanged', ['ConsolidatedItemHitTestBehavior:aax:abw', [ConsolidatedItemHitTestBehavior_$type, enumGetBox(ConsolidatedItemHitTestBehavior_$type, 0)], 'HighlightedValueMemberPath:abe:abx', [2, null], 'MarkerCollisionAvoidance:aaw:aby', [CategorySeriesMarkerCollisionAvoidance_$type, enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, 1)], 'ValueMemberAsLegendLabel:abi:ab6', [2, null], 'ValueMemberAsLegendUnit:abk:ab7', [2, null], 'ValueMemberPath:abm:ab8', [2, null], 'TrendLineType::ab4', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::ab3', [1, 1.5], 'TrendLinePeriod::ab2', [1, 7], 'TrendLineBrush::abz', [Brush.$, null], 'TrendLineZIndex:aa9:ab5', [1, 1001], 'TrendLineDashArray:aca:ab0', [DoubleCollection.$], 'TrendLineDashCap:acb:ab1', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]); return AnchoredCategorySeries; })(); /** * @hidden */ export let AnchoredCategoryBucketCalculator = /*@__PURE__*/ (() => { class AnchoredCategoryBucketCalculator extends CategoryBucketCalculator { constructor(a) { super(a); this.i = null; this.h = null; this.j = 0; this.i = a; } getBucketWithoutUnknowns(a) { let b = this.h; let c = this.j; let d = a * this.d; let e = d + this.d - 1; let f = c - 1; d = d < f ? d : f; e = e < f ? e : f; let g = 1.7976931348623157E+308; let h = -1.7976931348623157E+308; let i = true; for (let j = d; j <= e; ++j) { let k = b[j]; g = g < k ? g : k; h = h > k ? h : k; i = false; } if (!i) { return [0.5 * (d + e), g, h]; } return [0.5 * (d + e), NaN, NaN]; } getBucket(a) { let b = this.h; let c = this.j; let d = a * this.d; let e = d + this.d - 1; let f = c - 1; d = d < f ? d : f; e = e < f ? e : f; let g = 0; let h = 0; let i = true; for (let j = d; j <= e; ++j) { let k = b[j]; if (!i) { if (!isNaN_(k)) { g = g < k ? g : k; h = h > k ? h : k; } } else { if (!isNaN_(k)) { g = k; h = k; i = false; } } } if (!i) { return [0.5 * (d + e), g, h]; } return [0.5 * (d + e), NaN, NaN]; } cacheValues() { this.j = this.i.c5.valueColumn.count; this.h = this.i.c5.valueColumn.asArray(); } unCacheValues() { this.h = null; } } AnchoredCategoryBucketCalculator.$t = markType(AnchoredCategoryBucketCalculator, 'AnchoredCategoryBucketCalculator', CategoryBucketCalculator.$); return AnchoredCategoryBucketCalculator; })(); /** * @hidden */ export let AnchoredCategorySeriesView = /*@__PURE__*/ (() => { class AnchoredCategorySeriesView extends CategorySeriesView { constructor(a) { super(a); this.c5 = null; this.c6 = null; this.c5 = a; } get c7() { if (this.c6 == null) { this.c6 = CategoryTrendLineManagerFactory.a(this.c6, this.e.a0(), this.e.su, this.e, this.e.dr); } return this.c6; } set c7(a) { this.c6 = a; } get c8() { return this.c6 != null; } dc() { this.c5.ab9 = null; } da() { this.c5.ab9 = this.c5.trendLineBrush; } c9() { this.c5.ab9 = this.c5.u8; } cx() { return new AnchoredCategoryBucketCalculator(this); } db() { this.cw.cacheValues(); } dd() { this.cw.unCacheValues(); } de(a) { let b = this.cz.item(a); return this.cu(b); } a7(a, b) { if (a.d) { if (this.c5.trendLineType != 0 && !b) { let c = this.c7.g$j; c.ad = this.c5.trendLineThickness; c._stroke = this.c5.ab9; c.ai = this.c5.aca; c.aj = this.c5.acb; a.v(c); } } super.a7(a, b); } getDefaultTooltipTemplate() { return this.c5.aaz.c$c(this.e, this.c5.abm); } } AnchoredCategorySeriesView.$t = markType(AnchoredCategorySeriesView, 'AnchoredCategorySeriesView', CategorySeriesView.$); return AnchoredCategorySeriesView; })();