UNPKG

igniteui-angular-charts

Version:

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

1,289 lines (1,288 loc) 39.5 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 { TimeAxisBase } from "./TimeAxisBase"; import { ITimeRangeSelectorAxis_$type } from "./ITimeRangeSelectorAxis"; import { List$1 } from "igniteui-angular-core"; import { TimeAxisBreak } from "./TimeAxisBreak"; import { TimeAxisBreakCollection } from "./TimeAxisBreakCollection"; import { TimeAxisLabellingMode_$type } from "./TimeAxisLabellingMode"; import { TimeAxisLabelFormatCollection } from "./TimeAxisLabelFormatCollection"; import { OrderedDictionary$2 } from "./OrderedDictionary$2"; import { TimeAxisInterval } from "./TimeAxisInterval"; import { TimeAxisIntervalCollection } from "./TimeAxisIntervalCollection"; import { EventArgs, runOn, delegateCombine, typeCast, Number_$type, fromEnum, enumGetBox, fromEn, Date_$type, markType } from "igniteui-angular-core"; import { ScalerParams } from "./ScalerParams"; import { Rect } from "igniteui-angular-core"; import { NumericScaler } from "./NumericScaler"; import { KeyValuePair$2 } from "igniteui-angular-core"; import { LabelFormatOverrideEventArgs } from "./LabelFormatOverrideEventArgs"; import { NumericYAxis } from "./NumericYAxis"; import { LabelPosition } from "./LabelPosition"; import { Extensions } from "igniteui-angular-core"; import { SortedListView$1 } from "./SortedListView$1"; import { Dictionary$2 } from "igniteui-angular-core"; import { truncate, intDivide, isNaN_ } from "igniteui-angular-core"; import { dateFromTicks, dateMaxValue, dateSubtract, dateMinValue, dateGetMonth, dateAddMonths, dateFromValues, dateGetTimeOfDay, dateAddDays, dateAddHours } from "igniteui-angular-core"; import { timeSpanTicks, timeSpanInit3, timeSpanInit1, timeSpanFromMilliseconds, timeSpanFromSeconds, timeSpanFromMinutes, timeSpanFromHours, timeSpanFromDays, timeSpanFromTicks, timeSpanTotalMilliseconds } from "igniteui-angular-core"; import { dateToStringFormat } from "igniteui-angular-core"; /** * @hidden */ export class TimeXAxis extends TimeAxisBase { static { this.$t = markType(TimeXAxis, 'TimeXAxis', TimeAxisBase.$, [ITimeRangeSelectorAxis_$type]); } constructor() { super(); this.tu = 0; this.s3 = null; this.td = 0; this.tb = null; this._omission = 0; this.s1 = null; this.s8 = null; this.tz = null; this.uc = 0; this.tm = dateMaxValue(); this.tk = dateMaxValue(); this.tj = dateMaxValue(); this.tl = dateMinValue(); this.s5 = null; this.ua = 0; this.visibleRangeChanged = null; this.ab = TimeXAxis.$; this.omission = (0); this.tu = -2147483648; this.s3 = new TimeAxisBreakCollection(); let a = this.breaks; a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.uf)); this.s8 = new TimeAxisIntervalCollection(); let b = this.intervals; b.collectionChanged = delegateCombine(b.collectionChanged, runOn(this, this.ug)); this.tb = new TimeAxisLabelFormatCollection(); let c = this.labelFormats; c.collectionChanged = delegateCombine(c.collectionChanged, runOn(this, this.uh)); this.uc = (0); } al() { return new TimeXAxis(); } kw(a) { super.kw(a); this.kz(a, "LabellingMode"); } kz(a, b) { super.kz(a, b); let c = typeCast(TimeXAxis.$, a); if (c == null) { return; } if (b == "LabellingMode") { c.te = this.te; } } get_dw() { return this.breaks != null && this.breaks.count > 0; } gc(a, b) { if (!b.c.isEmpty) { let c = this.ts(a, NumericScaler.ac, b.c, Rect.empty); c = (c - b.d.left) / b.d.width; c = b.d.left + b.d.width * (c - b.e.left) / b.e.width; return c; } return this.ts(a, b.e, b.d, b.c); } ts(a, b, c, d) { let e = new KeyValuePair$2(TimeAxisBreak.$, Number_$type, 1, null, 0); let f = this.tu != -2147483648 ? this.tu : 0; let g = this.s1 != null ? this.s1.count : 0; while (f < g) { let h = this.s1.item1(f); if (h.d.getTime() <= a && h.c.getTime() >= a) { return NaN; } if (h.c.getTime() <= a) { e = new KeyValuePair$2(TimeAxisBreak.$, Number_$type, 1, h, this.s1.item(h)); f++; } else { break; } } if (f > 0) { f -= 1; } if (this.tu != -2147483648) { this.tu = f; } let i; let j; if (e.key != null) { i = e.value; j = e.key.c; } else { i = 0; j = this.actualMinimumValue; } let fromPrecedingBreak_ = +(dateFromTicks(truncate(a))) - +j; let k = (fromPrecedingBreak_ / ((this.actualMaximumValue.getTime() - this.actualMinimumValue.getTime()) - this.omission)); let l = i + k; l -= b.left; l /= b.width; let m = c.left; let n = c.right; let o = c.width; if (this.categoryMode != 0) { let p = this.getCategorySize(b, c, d); m += p / 2; n -= p / 2; o -= p; } if (this.dr) { return n - o * l; } return m + o * l; } lb(a, b, c, d) { this.tu = 0; for (let e = b; e < c; e++) { a.item(e, this.gc(a.item(e), d)); } this.tu = -2147483648; } startCursor() { this.tu = 0; } resetCursor() { this.tu = -2147483648; } gf(a, b) { if (!b.c.isEmpty) { let c = b.e.left + b.e.width * (a - b.d.left) / b.d.width; c = (c * b.d.width) + b.d.left; c = this.getUnscaledValue3(c, NumericScaler.ac, b.c, this.categoryMode); return c; } return this.tt(a, b.e, b.d, b.c); } tt(a, b, c, d) { let e = c.left; let f = c.width; if (this.categoryMode != 0) { let g = this.getCategorySize(b, c, d); e += g / 2; f -= g; } let h = b.left + b.width * (a - e) / f; if (this.dr) { h = 1 - h; } let i = new KeyValuePair$2(TimeAxisBreak.$, Number_$type, 1, null, 0); if (this.s1 != null) { for (let j of fromEnum(this.s1)) { if (j.value >= h && j.value <= h) { return j.key.d.getTime(); } if (j.value < h && j.value > i.value) { i = j; } } } let precedingBreakEnd_; let k; if (i.key != null) { k = i.value; precedingBreakEnd_ = i.key.c; } else { k = 0; precedingBreakEnd_ = this.actualMinimumValue; } let portionFromPrecedingBreak_ = h - k; let actualRange_ = +(this.actualMaximumValue) - +(this.actualMinimumValue) - this.omission; return (precedingBreakEnd_.getTime() + portionFromPrecedingBreak_ * actualRange_); } get breaks() { return this.s3; } get te() { return this.td; } set te(a) { let b = this.te; if (a != b) { this.td = a; this.l2("LabellingMode", enumGetBox(TimeAxisLabellingMode_$type, b), enumGetBox(TimeAxisLabellingMode_$type, this.te)); } } get labelFormats() { return this.tb; } lk(a, b, c, d) { super.lk(a, b, c, d); switch (b) { case "ActualMaximumValue": this.ue(); break; case "DateTimeColumn": this.ua = this.t8(); break; case "LabellingMode": this.l8(false); break; } } mo(a, b) { super.mo(a, b); this.ud(); this.sv(); } mn(a, b) { super.mn(a, b); this.ud(); this.sv(); } ek() { let a = super.ek(); this.ud(); return a; } get omission() { return this._omission; } set omission(a) { this._omission = a; } ue() { let a = this.th(this.breaks); let b = (0); for (let c of fromEnum(a)) { b += (+(c.c) - +(c.d)); } this.omission = b; } th(a) { let b = new List$1(TimeAxisBreak.$, 0); if (a == null || +(this.actualMaximumValue) == +(dateMaxValue())) { return b; } for (let c of fromEn(a)) { if (c.c >= this.actualMinimumValue && c.d <= this.actualMaximumValue) { b.add(c); } if (c.i != (0)) { let d = +(c.c) - +(c.d); let e = this.tn(c.d, c.i); while (e <= this.actualMaximumValue) { let f = this.tn(e, d); let g = ((() => { let $ret = new TimeAxisBreak(); $ret.d = e; $ret.c = f; return $ret; })()); if (g.c >= this.actualMinimumValue && g.d <= this.actualMaximumValue) { b.add(g); } if (dateSubtract(+(dateMaxValue()), +(c.i)) < g.d) { break; } e = this.tn(g.d, c.i); } } } return b; } tn(a, b) { let c = dateFromTicks(a.getTime()); c.setMilliseconds(c.getMilliseconds() + b); return c; } ud() { this.s1 = new OrderedDictionary$2(TimeAxisBreak.$, Number_$type); if (+(this.actualMaximumValue) == +(dateMaxValue()) || this.breaks == null || this.breaks.count == 0 || this.b7 == null) { return; } let a = new List$1(TimeAxisBreak.$, 1, this.th(this.breaks)); a.aa((b, c) => b.d < c.d ? -1 : b.d > c.d ? 1 : 0); let b = this.b7.yv; let c = new ScalerParams(0, this.b7.yv, this.b7.zd, this.dr, this.b7.yz); let d = +(this.actualMaximumValue) - +(this.actualMinimumValue) - this.omission; let e = 0; for (let f of fromEnum(a)) { let g = timeSpanTicks((+(f.d) - +(this.actualMinimumValue))) / timeSpanTicks(d); let h = timeSpanTicks((+(f.c) - +(this.actualMinimumValue))) / timeSpanTicks(d); if (h < 0 || g - e > 1) { continue; } this.s1.addItem(f, g - e); e += (h - g); } } jh(a) { if (isNaN_(a)) { return null; } let ticks_ = truncate(a); let b = (new Date(ticks_)); let c = this.h2(b); if (c == null) { return null; } return c.toString(); } h2(a) { if (!(typeCast(Date_$type, a) !== null)) { return super.h2(a); } let b = dateMinValue(); let c = false; if (this.tz != null) { if (typeCast(Date_$type, this.tz) !== null) { b = this.tz; c = true; } } let d = TimeXAxis.ty(a, c, b, this.te, this.uc, this.labelFormats, this.hf); return d == null ? super.h2(a) : d; } static ty(a, b, c, d, e, f, g) { let h = TimeXAxis.ta(e, f, g); if (h != null) { let i = ((() => { let $ret = new LabelFormatOverrideEventArgs(); $ret.dateTime = a; $ret.format = h; return $ret; })()); let j = h.o(h, i); if (j != null) { return j; } } let k = TimeXAxis.tx(h, a, b, c, g); if (k != null) { return k; } let l = TimeXAxis.t3(a, b, c, d, e, f, g); return dateToStringFormat(a, l, g); } static tx(a, b, c, d, e) { if (a == null) { return null; } let f = 0; if (c) { f = TimeXAxis.tf(b, d); } if (f == 3) { if (a.k != null) { return a.k.i(b); } if (a.ad != null) { return dateToStringFormat(b, a.ad, e); } f = 2; } if (f == 2) { if (a.l != null) { return a.l.i(b); } if (a.ai != null) { return dateToStringFormat(b, a.ai, e); } f = 1; } if (f == 1) { if (a.m != null) { return a.m.i(b); } if (a.an != null) { return dateToStringFormat(b, a.an, e); } } if (a.i != null) { return a.i.i(b); } if (a.x != null) { return dateToStringFormat(b, a.x, e); } return null; } static ta(a, b, c) { let d = null; let e = Number.MAX_VALUE; let f = null; for (let g of fromEnum(b)) { if (g.at < e) { e = g.at; f = g; } if (g.at > a) { continue; } if (d == null || g.at > d.at) { d = g; } } if (d == null) { d = f; } if (d == null) { return null; } return d; } static t3(a, b, c, d, e, f, g) { let h = 0; if (b) { h = TimeXAxis.tf(a, c); } let i; if (f == null || f.count == 0) { i = TimeXAxis.t2(e, h, d); } else { let j = TimeXAxis.ta(e, f, g); if (j == null) { return null; } switch (h) { case 3: if (j.af != null) { i = j.af; } else if (j.ad != null) { i = j.ad; } else if (j.ak != null) { i = j.ak; } else if (j.ai != null) { i = j.ai; } else if (j.ap != null) { i = j.ap; } else if (j.an != null) { i = j.an; } else if (j.z != null) { i = j.z; } else { i = j.x; } break; case 2: if (j.ak != null) { i = j.ak; } else if (j.ai != null) { i = j.ai; } else if (j.ap != null) { i = j.ap; } else if (j.an != null) { i = j.an; } else if (j.z != null) { i = j.z; } else { i = j.x; } break; case 1: if (j.ap != null) { i = j.ap; } else if (j.an != null) { i = j.an; } else if (j.z != null) { i = j.z; } else { i = j.x; } break; default: if (j.z != null) { i = j.z; } else { i = j.x; } break; } } return i; } static tf(a, b) { if (a.getFullYear() == b.getFullYear() && dateGetMonth(a) == dateGetMonth(b) && a.getDate() == b.getDate()) { return 3; } else if (a.getFullYear() == b.getFullYear() && dateGetMonth(a) == dateGetMonth(b)) { return 2; } else if (a.getFullYear() == b.getFullYear()) { return 1; } return 0; } get_ry() { return super.get_ry() || (this.intervals != null && this.intervals.count > 0); } set_ry(a) { super.set_ry(a); } get intervals() { return this.s8; } t1(a, b) { return TimeXAxis.t2(this.uc, a, b); } static t2(a, b, c) { if (c != 2) { b = 0; } a = Math.abs(a); if (a > timeSpanInit3(1825, 0, 0, 0)) { return "yyyy"; } if (a > timeSpanInit3(365, 0, 0, 0)) { switch (b) { case 3: case 2: case 1: return "MMM"; } return "MMM yyyy"; } ; if (a > timeSpanInit3(4, 0, 0, 0)) { switch (b) { case 3: case 2: return "dd"; } return "MMM dd"; } ; if (a > timeSpanInit3(1, 0, 0, 0)) { switch (b) { case 3: return "hh:mmtt"; case 2: return "dd hh:mmtt"; } return "MMM dd hh:mmtt"; } ; if (a > timeSpanInit1(0, 10, 0)) { return "hh:mm"; } return "hh:mm:ss"; } static { this.s0 = null; } static s2() { if (TimeXAxis.s0 == null) { TimeXAxis.s0 = ((() => { let $ret = new OrderedDictionary$2(Number_$type, TimeAxisInterval.$); $ret.addItem((0), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 0; $ret.f = 1; return $ret; })())); $ret.addItem(timeSpanFromMilliseconds(1), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 1; $ret.f = 1; return $ret; })())); $ret.addItem(timeSpanFromSeconds(1), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 2; $ret.f = 1; return $ret; })())); $ret.addItem(timeSpanFromSeconds(30), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 2; $ret.f = 30; return $ret; })())); $ret.addItem(timeSpanFromMinutes(2), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 3; $ret.f = 2; return $ret; })())); $ret.addItem(timeSpanFromMinutes(5), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 3; $ret.f = 5; return $ret; })())); $ret.addItem(timeSpanFromHours(1), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 4; $ret.f = 1; return $ret; })())); $ret.addItem(timeSpanFromDays(1), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 5; $ret.f = 1; return $ret; })())); $ret.addItem(timeSpanFromDays(2), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 5; $ret.f = 2; return $ret; })())); $ret.addItem(timeSpanFromDays(5), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 5; $ret.f = 5; return $ret; })())); $ret.addItem(timeSpanFromDays(10), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 5; $ret.f = 10; return $ret; })())); $ret.addItem(timeSpanFromDays(30), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 7; $ret.f = 1; return $ret; })())); $ret.addItem(timeSpanFromDays(60), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 7; $ret.f = 3; return $ret; })())); $ret.addItem(timeSpanFromDays(365), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 8; $ret.f = 1; return $ret; })())); $ret.addItem(timeSpanFromDays(365 * 10), ((() => { let $ret = new TimeAxisInterval(); $ret.b = 8; $ret.f = 10; return $ret; })())); return $ret; })()); } return TimeXAxis.s0; } s6() { if (this.el && (this.a4 == null || this.a4.angle == 0)) { let a = this.gr(); let b = this.pk.width; let c = truncate(Math.floor(b / a)); let d = Number.MAX_VALUE; let e = c == 0 ? d : timeSpanFromTicks((intDivide(timeSpanTicks(this.uc), c))); let f = null; for (let g of fromEnum(TimeXAxis.s2())) { f = g.value; if (g.key > e) { break; } } let h = this.s5; if (h != f) { this.md(); } this.s5 = f; return f; } let i = this.uc; if (i == (0)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 8; $ret.f = 1; return $ret; })()); } if (i >= timeSpanFromDays(365 * 100)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 8; $ret.f = 10; return $ret; })()); } if (i >= timeSpanFromDays(365 * 5)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 8; $ret.f = 1; return $ret; })()); } if (i >= timeSpanFromDays(365 * 2)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 7; $ret.f = 3; return $ret; })()); } if (i >= timeSpanFromDays(150)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 7; $ret.f = 1; return $ret; })()); } if (i >= timeSpanFromDays(60)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 5; $ret.f = 10; return $ret; })()); } if (i >= timeSpanFromDays(30)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 5; $ret.f = 5; return $ret; })()); } if (i >= timeSpanFromDays(20)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 5; $ret.f = 2; return $ret; })()); } if (i >= timeSpanFromDays(4)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 5; $ret.f = 1; return $ret; })()); } if (i >= timeSpanFromDays(1)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 4; $ret.f = 12; return $ret; })()); } if (i >= timeSpanFromHours(6)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 4; $ret.f = 1; return $ret; })()); } if (i >= timeSpanFromMinutes(30)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 3; $ret.f = 5; return $ret; })()); } if (i >= timeSpanFromMinutes(10)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 3; $ret.f = 2; return $ret; })()); } return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 2; $ret.f = 30; return $ret; })()); } s7() { if (this.intervals == null || this.intervals.count == 0) { return this.s6(); } if (this.uc == (0)) { return ((() => { let $ret = new TimeAxisInterval(); $ret.b = 8; $ret.f = 1; return $ret; })()); } let a = null; for (let b of fromEnum(this.intervals)) { if (b.k > this.uc) { continue; } if (a == null || b.k > a.k) { a = b; } } return a == null ? this.s6() : a; } l9(a) { super.l9(a); let b = this.b7 != null ? this.b7.yv : Rect.empty; let c = !b.isEmpty ? this.pk : Rect.empty; let d = this.pf(); let e = this.pe(); let f = new ScalerParams(0, b, c, this.dr, d); if (this.ru == null && !this.r0() && !this.r1()) { return; } if (!b.isEmpty && !c.isEmpty) { let g = c.bottom; let h = g - c.top; if (this.an != null) { let i = typeCast(NumericYAxis.$, this.an); if (i != null) { let j = this.me(g, h, b, c, d, c.top, c.bottom); g = j.p0; h = j.p1; } } if (isNaN_(g)) { g = 0; } this.le(this.bp.bb(), g, c, this.bp.g(), true); this.a1.bn = h; let k = truncate(Math.ceil(e.right)); let l = truncate(Math.floor(e.left)); let m = this.bp.be(); let n = this.bp.h(); let o = this.bp.bc(); this.sv(); let p = new List$1(Date_$type, 1, this.tg()); let q = new List$1(Number_$type, 0); for (let r = 0; r < p.count; r++) { q.add(p._inner[r].getTime()); } this.lb(q, 0, q.count, f); this.tz = null; for (let s = 0; s < p.count; s++) { let t = p._inner[s]; let u = q._inner[s]; let v = truncate(Math.round(u)); if (v <= k) { if (s % 2 == 0) { let w = s < q.count - 1 ? q._inner[s + 1] : e.right; this.mm(m, u, w, c); } this.ml(o, u, c, n, false); this.p8.add(u); } if (this.ct && v >= l && v <= k) { let x = this.h2(t); this.tz = t; if (x != null) { this.ev.add1(x); this.ew.add(new LabelPosition(0, u)); } } } this.tz = null; } if ((this.a4 == null || this.a4.visibility == 0) && this.an != null) { if (this.a4 != null && (this.a4.location == 4 || this.a4.location == 5)) { this.b7.pt(); } } this.a1.bg = this.ev; this.a1.bh = this.ew; this.a1.cr(); this.rg(); } tg() { let a = this.b7 != null ? this.b7.yv : Rect.empty; let b = !a.isEmpty ? this.pk : Rect.empty; let c = this.pf(); let d = this.pe(); let e = new ScalerParams(0, a, b, this.dr, c); let f = this.s7(); let g = this.tp; if (!this.r1() && f != null) { if (f.b == 7 && g.getDate() != 1) { g = dateAddMonths(g, 1); g = dateFromValues(g.getFullYear(), dateGetMonth(g), 1, 0, 0, 0, 0); } else if (f.b == 5 && dateGetTimeOfDay(g) != (0)) { g = dateAddDays(g, 1); g = dateFromValues(g.getFullYear(), dateGetMonth(g), g.getDate(), 0, 0, 0, 0); } else if (f.b == 4 && g.getMinutes() != 0) { g = dateAddHours(g, 1); g = dateFromValues(g.getFullYear(), dateGetMonth(g), g.getDate(), g.getHours(), 0, 0, 0); } } let h = new List$1(Date_$type, 0); let i = 0; let j = 10000; if (f.f == 0) { return h; } while (g <= this.visibleMaximum && i++ < j) { let k = this.ti(g); let l = g; if (k.key != null) { l = f.d(k.key.c); } h.add(l); while (g <= l) { g = f.c(g); if (+g == +(dateMaxValue())) { break; } } } return h; } ti(a) { if (this.s1 == null) { return new KeyValuePair$2(TimeAxisBreak.$, Number_$type); } for (let b of fromEnum(this.s1)) { if (b.key.d <= a && b.key.c >= a) { return b; } } return new KeyValuePair$2(TimeAxisBreak.$, Number_$type); } get visibleMinimum() { return this.tm; } set visibleMinimum(a) { this.tm = a; } get tp() { return this.tk; } set tp(a) { this.tk = a; } get to() { return this.tj; } set to(a) { this.tj = a; } get visibleMaximum() { return this.tl; } set visibleMaximum(a) { this.tl = a; } sv() { super.sv(); if (this.b7 == null || !Extensions.b(this.b7.zd)) { return; } let a = new ScalerParams(0, this.b7.yv, this.b7.zd, this.dr, this.b7.yz); let b = this.pe(); let c = b.left; let d = b.right; let e = b.left; let f = b.right; if (this.categoryMode != 0) { let g = this.getCategorySize(a.e, a.d, a.c); e += g / 2; f -= g / 2; } let h = truncate(this.gf(c, a)); let i = truncate(this.gf(d, a)); let j = truncate(this.gf(e, a)); let k = truncate(this.gf(f, a)); if (j < 0 || k < 0) { this.uc = (0); return; } h = Math.min(dateMaxValue().getTime(), h); i = Math.min(dateMaxValue().getTime(), i); h = Math.max(dateMinValue().getTime(), h); i = Math.max(dateMinValue().getTime(), i); j = Math.min(dateMaxValue().getTime(), j); k = Math.min(dateMaxValue().getTime(), k); let l = dateFromTicks(Math.min(h, i)); let m = dateFromTicks(Math.max(h, i)); let n = dateFromTicks(Math.min(j, k)); let o = dateFromTicks(Math.max(j, k)); let p = +(this.visibleMinimum) != +n || +(this.visibleMaximum) != +o; this.visibleMinimum = n; this.visibleMaximum = o; this.tp = l; this.to = m; if (p && this.visibleRangeChanged != null) { this.visibleRangeChanged(this, EventArgs.empty); } this.uc = +(this.visibleMaximum) - +(this.visibleMinimum); } qf(a, b, c, d, e) { return 0; } i$f(a) { let b = this; if (b.i$b == null || b.i$b.count == 0) { return -1; } let c = new SortedListView$1(Date_$type, this.ru, b.i$b); let ticks_ = a; let d = (new Date(ticks_)); let e = this.se(d, c); e = Math.max(0, Math.min(b.i$b.count - 1, e)); let f = c.item(e); let g; let h; if (f < d) { g = e; h = g + 1; } else { h = e; g = e - 1; } g = this.tw(g, c); h = this.tv(h, c); if (g < 0) { return h; } if (h >= b.i$b.count) { return g; } let i = c.item(g); let j = c.item(h); let k = new ScalerParams(0, this.b7.ze, this.pk, this.dr, this.b7.yz); this.startCursor(); let l = this.gc(i.getTime(), k); let m = this.gc(a, k); let n = this.gc(j.getTime(), k); this.resetCursor(); if (i < this.tp && j <= this.to) { return this.r3._inner[h]; } if (j > this.to && i >= this.tp) { return this.r3._inner[g]; } if (Math.abs(l - m) < Math.abs(n - m)) { return this.r3._inner[g]; } else { return this.r3._inner[h]; } } tv(a, b) { if (a < 0 || a >= b.count - 1) { return a; } let c = b.item(a); let d = 0; while (d < this.s1.count) { let e = this.s1.item1(d); if (c >= e.d && c <= e.c) { break; } d++; } if (d >= this.s1.count) { return a; } let f = a; while (f < b.count) { if (f < 0 || f >= b.count - 1) { return a; } c = b.item(f); let g = this.s1.item1(d); if (c >= g.d && c <= g.c) { f++; continue; } d++; if (d > this.s1.count - 1) { break; } g = this.s1.item1(d); if (c >= g.d && c <= g.c) { f++; continue; } break; } if (f < 0 || f > b.count - 1) { return a; } return f; } tw(a, b) { if (a < 0 || a >= b.count - 1) { return a; } let c = b.item(a); let d = 0; while (d < this.s1.count) { let e = this.s1.item1(d); if (c >= e.d && c <= e.c) { break; } d++; } if (d >= this.s1.count) { return a; } let f = a; while (f >= 0) { if (f < 0 || f >= b.count - 1) { return a; } c = b.item(f); let g = this.s1.item1(d); if (c >= g.d && c <= g.c) { f--; continue; } d--; if (d < 0) { break; } g = this.s1.item1(d); if (c >= g.d && c <= g.c) { f--; continue; } break; } if (f < 0 || f > b.count - 1) { return a; } return f; } uf(a, b) { this.ue(); this.ud(); if (this.a1 != null) { this.a1.an = this.breaks.count > 0; } this.l8(false); for (let c of fromEnum(this.et())) { c.sa(false); } } uh(a, b) { this.l8(false); } ug(a, b) { this.l8(false); } get_dj() { return false; } getWindowRectForSelection(a, b) { let c = +(this.actualMaximumValue) - +(this.actualMinimumValue); let d = timeSpanTotalMilliseconds((+a - +(this.actualMinimumValue))) / timeSpanTotalMilliseconds(c); let e = 1 - (timeSpanTotalMilliseconds((+(this.actualMaximumValue) - +b)) / timeSpanTotalMilliseconds(c)); e = Math.min(1, e); return new Rect(0, d, NaN, Math.max(0, e - d), NaN); } getCategorySize(a, b, c) { if (this.uc != (0)) { let d = timeSpanFromTicks(truncate((timeSpanTicks(this.uc) * (a.width / (this.b7 != null ? this.b7.yv.width : 1))))); let e = timeSpanTicks(d) / timeSpanTicks(this.ua); let f = b.width / 4; return Math.min(f, b.width / (e + 1)); } return super.getCategorySize(a, b, c); } static t9(a, b) { let c = Math.min(5, b); let d = a(0); let e = new Dictionary$2(Number_$type, Number_$type, 0); let f = 0; let g = (0); for (let h = 0; h < c; h++) { let i = a(h); let j = +i - +d; if (!e.containsKey(j)) { e.addItem(j, 0); } e.item(j, e.item(j) + 1); if (e.item(j) > f) { f = e.item(j); g = j; } d = i; } return g; } t8() { if (this.ru == null || this.ru.count < 2 || this.r3 == null) { return (0); } return TimeXAxis.t9((a) => this.ru.item(this.r3._inner[a]), this.ru.count); } sr() { super.sr(); this.ua = this.t8(); } static t5(a) { if (a >= timeSpanFromDays(1)) { return "D"; } return "g"; } itemLabelFormat() { return TimeXAxis.t5(this.ua); } sd(a, b, c, d) { return this.sc(this.visibleMinimum); } sg(a, b, c, d) { return this.sf(this.visibleMaximum); } get isVertical() { return this.d3; } j$d(a, b) { return this.gf.apply(this, arguments); } j$c(a, b) { return this.gc.apply(this, arguments); } j$e(a, b, c, d, e) { this.la.apply(this, arguments); } j$f(a, b, c, d) { this.lb.apply(this, arguments); } j$g(a, b, c, d) { this.lc.apply(this, arguments); } get j$b() { return this.dr; } j$a() { return this.ag.apply(this, arguments); } get i$a() { return this.dm; } }