UNPKG

igniteui-react-charts

Version:

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

1,486 lines (1,485 loc) 90.8 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 { Base, Type, typeCast, Delegate_$type, runOn, markType, getInstanceType, delegateRemove, delegateCombine, Point_$type, fromEnum, Number_$type, IEnumerable_$type, EnumUtil, Array_$type, enumGetBox, markDep } from "igniteui-react-core"; import { ServiceProvider_Spark } from "./ServiceProvider_Spark"; import { Dictionary$2 } from "igniteui-react-core"; import { MessageChannel_Spark } from "./MessageChannel_Spark"; import { AxisRenderMessage_Spark } from "./AxisRenderMessage_Spark"; import { ContainerResizedMessage_Spark } from "./ContainerResizedMessage_Spark"; import { ViewportChangedMessage_Spark } from "./ViewportChangedMessage_Spark"; import { PixelRatioMessage_Spark } from "./PixelRatioMessage_Spark"; import { RenderingContext } from "igniteui-react-core"; import { FontUtil } from "igniteui-react-core"; import { Brush } from "igniteui-react-core"; import { Color } from "igniteui-react-core"; import { Line } from "igniteui-react-core"; import { TextBlock } from "igniteui-react-core"; import { BindingFormatter } from "igniteui-react-core"; import { SparklineAxisVisualData } from "./SparklineAxisVisualData"; import { LineVisualData } from "igniteui-react-core"; import { AppearanceHelper } from "igniteui-react-core"; import { Visibility_$type } from "igniteui-react-core"; import { ClearMessage_Spark } from "./ClearMessage_Spark"; import { ISchedulableRender_$type } from "igniteui-react-core"; import { CanvasRenderScheduler } from "igniteui-react-core"; import { Path } from "igniteui-react-core"; import { PolygonMessage_Spark } from "./PolygonMessage_Spark"; import { ColumnMessage_Spark } from "./ColumnMessage_Spark"; import { WinLossColumnMessage_Spark } from "./WinLossColumnMessage_Spark"; import { MarkerMessage_Spark } from "./MarkerMessage_Spark"; import { NormalRangeMessage_Spark } from "./NormalRangeMessage_Spark"; import { TrendLineMessage_Spark } from "./TrendLineMessage_Spark"; import { TooltipMessage_Spark } from "./TooltipMessage_Spark"; import { ToooltipTemplateMessage_Spark } from "./ToooltipTemplateMessage_Spark"; import { ContainerMessage_Spark } from "./ContainerMessage_Spark"; import { BrushChangedMessage_Spark } from "./BrushChangedMessage_Spark"; import { VisibilityMessage_Spark } from "./VisibilityMessage_Spark"; import { NumberChangedMessage_Spark } from "./NumberChangedMessage_Spark"; import { ContainerSizeChangedMessage_Spark } from "./ContainerSizeChangedMessage_Spark"; import { MouseMoveMessage_Spark } from "./MouseMoveMessage_Spark"; import { MouseLeaveMessage_Spark } from "./MouseLeaveMessage_Spark"; import { CanvasGestureDOMEventProxy } from "igniteui-react-core"; import { CanvasViewRenderer } from "igniteui-react-core"; import { Rect } from "igniteui-react-core"; import { List$1 } from "igniteui-react-core"; import { TranslateTransform } from "igniteui-react-core"; import { DeviceUtils } from "igniteui-react-core"; import { GeometryGroup } from "igniteui-react-core"; import { EllipseGeometry } from "igniteui-react-core"; import { PathGeometry } from "igniteui-react-core"; import { PathFigure } from "igniteui-react-core"; import { LineSegment } from "igniteui-react-core"; import { RectangleGeometry } from "igniteui-react-core"; import { SparklineToolTipContext } from "./SparklineToolTipContext"; import { DataContext } from "igniteui-react-core"; import { SparklineVisualData } from "./SparklineVisualData"; import { RectData } from "igniteui-react-core"; import { PathVisualData } from "igniteui-react-core"; import { SparklineDisplayType_$type } from "./SparklineDisplayType"; import { truncate, isNaN_, isInfinity } from "igniteui-react-core"; import { SparkFrame } from "./SparkFrame"; import { TrendLineType_$type } from "igniteui-react-core"; import { TrendCalculators } from "igniteui-react-core"; import { LeastSquaresFit } from "igniteui-react-core"; import { DependencyObject } from "igniteui-react-core"; import { IFastItemsSourceProvider_$type } from "igniteui-react-core"; import { IFastItemsSource_$type } from "igniteui-react-core"; import { DependencyProperty } from "igniteui-react-core"; import { PropertyChangedMessage_Spark } from "./PropertyChangedMessage_Spark"; import { FastItemsSource } from "igniteui-react-core"; import { DataChangedMessage_Spark } from "./DataChangedMessage_Spark"; import { NotifyCollectionChangedEventArgs } from "igniteui-react-core"; import { FastItemsSourceReference } from "igniteui-react-core"; import { PropertyMetadata } from "igniteui-react-core"; import { UnknownValuePlotting_$type } from "igniteui-react-core"; import { Control } from "igniteui-react-core"; /** * @hidden */ var HorizontalAxisView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(HorizontalAxisView, _super); function HorizontalAxisView(a) { var _this = _super.call(this) || this; _this.j = null; _this.w = null; _this.m = null; _this.l = null; _this.s = 0; _this.v = 0; _this.u = 0; _this.k = null; _this.r = -1; _this.ag = null; _this.af = null; _this.ah = null; _this.a = ["border-top-width", "border-top-color", "color"]; _this.n = false; _this.q = 1; _this.g = null; _this.o = new Dictionary$2(Type.$, Delegate_$type, 0); _this.d = null; _this.c = null; _this.p.item(AxisRenderMessage_Spark.$, function (b) { return _this.ac(typeCast(AxisRenderMessage_Spark.$, b)); }); _this.p.item(ContainerResizedMessage_Spark.$, function (b) { return _this.y(typeCast(ContainerResizedMessage_Spark.$, b)); }); _this.p.item(ViewportChangedMessage_Spark.$, function (b) { return _this.ae(typeCast(ViewportChangedMessage_Spark.$, b)); }); _this.p.item(PixelRatioMessage_Spark.$, function (b) { return _this.ab(typeCast(PixelRatioMessage_Spark.$, b)); }); _this.j = a; return _this; } HorizontalAxisView.prototype.b = function () { if (!this.n) { this.n = true; this.k.a("ui-sparkline-axis-x", this.a); } return this.a; }; HorizontalAxisView.prototype.t = function () { var a = this.r; if (a >= 0) { return a; } var b = this.b()[0]; if (b != null) { a = parseInt(b); } this.r = a = (a < 1) ? 1 : a; return a; }; Object.defineProperty(HorizontalAxisView.prototype, "h", { get: function () { return this.g; }, set: function (a) { var b = this.g; this.g = a; this.k = a.getService("View"); this.aa(b, this.g); }, enumerable: false, configurable: true }); Object.defineProperty(HorizontalAxisView.prototype, "p", { get: function () { return this.o; }, set: function (a) { this.o = a; }, enumerable: false, configurable: true }); Object.defineProperty(HorizontalAxisView.prototype, "f", { get: function () { return this.d; }, set: function (a) { this.d = a; }, enumerable: false, configurable: true }); Object.defineProperty(HorizontalAxisView.prototype, "e", { get: function () { return this.c; }, set: function (a) { this.c = a; }, enumerable: false, configurable: true }); HorizontalAxisView.prototype.z = function (a) { var _this = this; var b; if (((function () { var c = _this.p.tryGetValue(getInstanceType(a), b); b = c.p1; return c.ret; })())) { b(a); } }; HorizontalAxisView.prototype.aa = function (a, b) { if (a != null) { this.f.detachTarget(runOn(this, this.z)); } if (b != null) { this.f = b.getService("RenderingMessages"); this.e = b.getService("InteractionMessages"); this.f.attachTarget(runOn(this, this.z)); } }; HorizontalAxisView.prototype.y = function (a) { this.w = a.j; this.m = a.b; this.l = this.k.o("ui-sparkline-axis-x"); if (this.l == null) { this.l = FontUtil.getFont(a.h); } if (this.m != null) { this.m.ad(this.l); } this.s = FontUtil.getCurrentFontHeight(a.h, this.l); if (this.j != null && this.j.fm != 1) { a.d = a.d - this.s; a.e = this.t(); } }; HorizontalAxisView.prototype.ae = function (a) { this.v = this.w.width(); this.u = this.s + this.t(); }; HorizontalAxisView.prototype.ac = function (a) { this.ad(a.c); }; HorizontalAxisView.prototype.ad = function (a) { this.ah = null; var b = (!a || this.j == null) ? null : this.m; if (b == null || !b.d) { return; } b.l(0, 0, this.v, this.u); if (this.l != null) { b.ad(this.l); } if (this.q != 1) { b.aa(); b.ab(this.q, this.q); } var c = this.t(), d = c / 2; var e = this.j.av == null || this.j.av.count == 0; if (e) { this.u = 0; } var f = e ? null : this.x(this.j.av.item(0)); var g = f == null ? "" : f.toString(); this.ag = new TextBlock(); this.ag.al = g; this.ag.n = 2; this.af = new TextBlock(); var h = e ? null : this.x(this.j.av.item(this.j.av.count - 1)); this.af.al = g = h == null ? "" : h.toString(); this.af.o = this.ag.o = c; this.af.n = this.v - b.g(g) - 4; var i = this.j.fb; var j = i == null ? null : i._fill; var k = new Color(); var l = true; if (i != null) { l = false; k = i.color; } i = new Brush(); if (l) { i._fill = (this.a[2] == null) ? "#000000" : this.a[2]; } else { i.color = k; } this.ag.ao = this.af.ao = i; b.x(this.ag); b.x(this.af); if (c < 0.5) { return; } i = new Brush(); if (j == null) { j = this.a[1]; } i._fill = (j == null) ? "#000000" : j; this.ah = new Line(); this.ah.an = 0; this.ah.ao = this.w.width(); this.ah.ap = d; this.ah.aq = d; this.ah._stroke = i; this.ah.ad = c; b.s(this.ah); if (this.q != 1) { b.z(); } }; HorizontalAxisView.prototype.x = function (dataItem_) { var a = null; if (this.j.ai != null) { a = this.j.ai.i(dataItem_); } if (this.j.ax()) { a = this.j.c1(dataItem_); } if (a != null) { return a; } var label_ = this.j.br; return (typeof dataItem_ != 'undefined') ? dataItem_ : ''; ; }; HorizontalAxisView.prototype.i = function () { var a = new SparklineAxisVisualData(); if (this.ah != null) { a.axisLine = new LineVisualData(1, "HorizontalAxisLine", this.ah); a.axisLine.appearance.isVisible = this.w.height() > 0; } var b = this.l; if (this.ag != null) { a.minLabel = AppearanceHelper.c(this.ag, this.l); } if (this.af != null) { a.maxLabel = AppearanceHelper.c(this.af, this.l); } return a; }; HorizontalAxisView.prototype.ab = function (a) { this.q = a.b; }; HorizontalAxisView.$t = markType(HorizontalAxisView, 'HorizontalAxisView'); return HorizontalAxisView; }(Base)); export { HorizontalAxisView }; /** * @hidden */ var VerticalAxisView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(VerticalAxisView, _super); function VerticalAxisView(a) { var _this = _super.call(this) || this; _this.ad = null; _this.ac = null; _this.al = null; _this.ak = null; _this.am = null; _this.w = -1; _this.u = -1; _this.j = null; _this.aa = null; _this.m = null; _this.l = null; _this.t = 0; _this.v = 0; _this.z = 0; _this.y = 0; _this.k = null; _this.s = -1; _this.a = ["border-top-width", "border-top-color", "color", "text-align"]; _this.n = false; _this.g = null; _this.p = new Dictionary$2(Type.$, Delegate_$type, 0); _this.d = null; _this.c = null; _this.r = 1; _this.q.item(AxisRenderMessage_Spark.$, function (b) { return _this.ai(typeCast(AxisRenderMessage_Spark.$, b)); }); _this.q.item(ContainerResizedMessage_Spark.$, function (b) { return _this.ae(typeCast(ContainerResizedMessage_Spark.$, b)); }); _this.q.item(ViewportChangedMessage_Spark.$, function (b) { return _this.aj(typeCast(ViewportChangedMessage_Spark.$, b)); }); _this.q.item(PixelRatioMessage_Spark.$, function (b) { return _this.ah(typeCast(PixelRatioMessage_Spark.$, b)); }); _this.j = a; return _this; } VerticalAxisView.prototype.b = function () { if (!this.n) { this.n = true; this.k.a("ui-sparkline-axis-y", this.a); } return this.a; }; VerticalAxisView.prototype.x = function () { var a = this.s; if (a >= 0) { return a; } var b = this.b()[0]; if (b != null) { a = parseInt(b); } this.s = a = (a < 1) ? 1 : a; return a; }; Object.defineProperty(VerticalAxisView.prototype, "h", { get: function () { return this.g; }, set: function (a) { var b = this.g; this.g = a; this.k = a.getService("View"); this.ag(b, this.g); }, enumerable: false, configurable: true }); Object.defineProperty(VerticalAxisView.prototype, "q", { get: function () { return this.p; }, set: function (a) { this.p = a; }, enumerable: false, configurable: true }); Object.defineProperty(VerticalAxisView.prototype, "f", { get: function () { return this.d; }, set: function (a) { this.d = a; }, enumerable: false, configurable: true }); Object.defineProperty(VerticalAxisView.prototype, "e", { get: function () { return this.c; }, set: function (a) { this.c = a; }, enumerable: false, configurable: true }); VerticalAxisView.prototype.af = function (a) { var _this = this; var b; if (((function () { var c = _this.q.tryGetValue(getInstanceType(a), b); b = c.p1; return c.ret; })())) { b(a); } }; VerticalAxisView.prototype.ag = function (a, b) { if (a != null) { this.f.detachTarget(runOn(this, this.af)); } if (b != null) { this.f = b.getService("RenderingMessages"); this.e = b.getService("InteractionMessages"); this.f.attachTarget(runOn(this, this.af)); } }; VerticalAxisView.prototype.ae = function (a) { this.aa = a.k; this.m = a.c; this.l = this.k.o("ui-sparkline-axis-y"); if (this.l == null) { this.l = FontUtil.getFont(a.h); } if (this.m != null) { this.m.ad(this.l); } this.t = FontUtil.getCurrentFontHeight(a.h, this.l); if (this.j != null && this.j.ft != 1) { this.o(false); a.g = a.g - this.v; a.f = this.x(); } }; VerticalAxisView.prototype.aj = function (a) { this.z = this.v + this.x(); this.y = this.aa.height(); }; VerticalAxisView.prototype.ai = function (a) { if (this.o(a.c)) { var b = new ClearMessage_Spark(); b.c = true; this.f.sendMessage(b); } }; VerticalAxisView.prototype.o = function (a) { this.am = null; if (this.j == null || this.m == null || !this.m.d || (a && this.ak == null)) { return false; } var b = this.m; if (a) { b.l(0, 0, this.z, this.y); } var c = false; if (b != null && this.l != null) { b.ad(this.l); } if (!a) { this.al = new TextBlock(); this.ak = new TextBlock(); var d = this.ab(this.j.a4); this.al.al = this.ad = d == null ? "" : d.toString(); var e = this.ab(this.j.a3); this.ak.al = this.ac = e == null ? "" : e.toString(); if (b != null) { this.w = b.g(this.ad) + 3; if (this.w > this.v) { c = true; this.v = this.w; } this.u = b.g(this.ac) + 3; if (this.u > this.v) { c = true; this.v = this.u; } } if (!c) { var f = Math.max(this.w, this.u); if (f < this.v) { this.v = f; c = true; } } if (c) { this.z = this.v; } } else if (b != null) { if (this.r != 1) { b.aa(); b.ab(this.r, this.r); } var g = this.j.fj; var h = 1; var i = g == null ? null : g._fill; var j = this.b()[3]; if (j == "left") { h = 0; } else if (j == "center") { h = 0.5; } this.ak.o = 2; this.ak.n = (this.v - this.u) * h + 1; this.al.n = (this.v - this.w) * h + 1; this.al.o = this.y - this.t - 2; var k = new Color(); var l = true; if (g != null) { k = g.color; l = false; } g = new Brush(); if (l) { g._fill = (this.a[2] == null) ? "#000000" : this.a[2]; } else { g.color = k; } this.al.ao = this.ak.ao = g; b.x(this.al); b.x(this.ak); var m = this.x(), n = m / 2; if (m >= 0.5) { g = new Brush(); if (i == null) { i = this.a[1]; } g._fill = (i == null) ? "#000000" : i; this.am = new Line(); this.am.an = this.z - n; this.am.ao = this.z - n; this.am.ap = 0; this.am.aq = this.y; this.am._stroke = g; this.am.ad = m; b.s(this.am); } if (this.r != 1) { b.z(); } } return c; }; VerticalAxisView.prototype.ab = function (dataItem_) { var a = null; if (this.j.aj != null) { a = this.j.aj.i(dataItem_); } if (this.j.ax()) { a = this.j.c1(dataItem_); } if (a != null) { return a; } var label_ = this.j.bt; return (typeof dataItem_ != 'undefined') ? dataItem_ : ''; ; }; VerticalAxisView.prototype.i = function () { var a = new SparklineAxisVisualData(); if (this.am != null) { a.axisLine = new LineVisualData(1, "VerticalAxisLine", this.am); a.axisLine.appearance.isVisible = this.aa.width() > 0; } if (this.al != null) { a.minLabel = AppearanceHelper.c(this.al, this.l); } if (this.ak != null) { a.maxLabel = AppearanceHelper.c(this.ak, this.l); } return a; }; VerticalAxisView.prototype.ah = function (a) { this.r = a.b; }; VerticalAxisView.$t = markType(VerticalAxisView, 'VerticalAxisView'); return VerticalAxisView; }(Base)); export { VerticalAxisView }; /** * @hidden */ var XamSparklineView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(XamSparklineView, _super); function XamSparklineView() { var _this = _super.call(this) || this; _this.bn = null; _this.bm = null; _this.ae = null; _this.af = null; _this.ag = null; _this.ah = null; _this.p = null; _this.q = null; _this.r = null; _this.n = null; _this.u = false; _this.b = new Array(6); _this.y = -1; _this.bw = new Path(); _this.bu = new Path(); _this.bx = new Path(); _this.bv = new Path(); _this.bs = new Path(); _this.bt = new Path(); _this.br = new Path(); _this.bp = new Path(); _this.bo = new Path(); _this.bq = new Path(); _this.j = null; _this.f = null; _this.g = null; _this.v = new Dictionary$2(Type.$, Delegate_$type, 0); _this.l = null; _this.s = false; _this.ai = null; _this.e = null; _this.d = null; _this.c = null; _this.t = false; _this.x = 1; _this.bs._visibility = 1; _this.bt._visibility = 1; _this.br._visibility = 1; _this.bp._visibility = 1; _this.bo._visibility = 1; _this.bq._visibility = 1; _this.bv._visibility = 1; var a = _this.w; a.item(ClearMessage_Spark.$, function (b) { return _this.aj(typeCast(ClearMessage_Spark.$, b)); }); a.item(PolygonMessage_Spark.$, function (b) { return _this.bc(typeCast(PolygonMessage_Spark.$, b)); }); a.item(ColumnMessage_Spark.$, function (b) { return _this.a5(typeCast(ColumnMessage_Spark.$, b)); }); a.item(WinLossColumnMessage_Spark.$, function (b) { return _this.bj(typeCast(WinLossColumnMessage_Spark.$, b)); }); a.item(MarkerMessage_Spark.$, function (b) { return _this.a8(typeCast(MarkerMessage_Spark.$, b)); }); a.item(NormalRangeMessage_Spark.$, function (b) { return _this.bd(typeCast(NormalRangeMessage_Spark.$, b)); }); a.item(TrendLineMessage_Spark.$, function (b) { return _this.bg(typeCast(TrendLineMessage_Spark.$, b)); }); a.item(TooltipMessage_Spark.$, function (b) { return _this.be(typeCast(TooltipMessage_Spark.$, b)); }); a.item(ToooltipTemplateMessage_Spark.$, function (b) { return _this.bf(typeCast(ToooltipTemplateMessage_Spark.$, b)); }); a.item(ContainerMessage_Spark.$, function (b) { return _this.ak(typeCast(ContainerMessage_Spark.$, b)); }); a.item(PixelRatioMessage_Spark.$, function (b) { return _this.aw(typeCast(PixelRatioMessage_Spark.$, b)); }); a.item(BrushChangedMessage_Spark.$, function (b) { return _this.a3(typeCast(BrushChangedMessage_Spark.$, b)); }); a.item(ContainerResizedMessage_Spark.$, function (b) { return _this.at(); }); a.item(VisibilityMessage_Spark.$, function (b) { return _this.bi(typeCast(VisibilityMessage_Spark.$, b)); }); a.item(NumberChangedMessage_Spark.$, function (b) { return _this.bb(typeCast(NumberChangedMessage_Spark.$, b)); }); a.item(ContainerSizeChangedMessage_Spark.$, function (b) { return _this.at(); }); _this.d = new CanvasRenderScheduler(); _this.c = new CanvasRenderScheduler(); _this.d.o(_this); _this.c.o(_this); return _this; } XamSparklineView.prototype.aw = function (a) { this.x = a.b; }; Object.defineProperty(XamSparklineView.prototype, "k", { get: function () { return this.j; }, set: function (a) { var b = this.j; this.j = a; this.av(b, this.j); this.l = null; }, enumerable: false, configurable: true }); Object.defineProperty(XamSparklineView.prototype, "h", { get: function () { return this.f; }, set: function (a) { this.f = a; }, enumerable: false, configurable: true }); Object.defineProperty(XamSparklineView.prototype, "i", { get: function () { return this.g; }, set: function (a) { this.g = a; }, enumerable: false, configurable: true }); Object.defineProperty(XamSparklineView.prototype, "w", { get: function () { return this.v; }, set: function (a) { this.v = a; }, enumerable: false, configurable: true }); XamSparklineView.prototype.av = function (a, b) { if (a != null) { this.i.detachTarget(runOn(this, this.ar)); this.h = null; } if (b != null) { this.i = b.getService("RenderingMessages"); this.h = b.getService("InteractionMessages"); this.i.attachTarget(runOn(this, this.ar)); this.a2(this.h); } }; XamSparklineView.prototype.a2 = function (a) { this.h = a; }; XamSparklineView.prototype.ar = function (a) { var _this = this; var b; if (((function () { var c = _this.w.tryGetValue(getInstanceType(a), b); b = c.p1; return c.ret; })())) { b(a); } }; Object.defineProperty(XamSparklineView.prototype, "m", { get: function () { if (this.l == null) { this.l = this.k.getService("Controller"); } return this.l; }, enumerable: false, configurable: true }); XamSparklineView.prototype.a1 = function (a, b, c) { var d = new MouseMoveMessage_Spark(); d.position = a; this.h.sendMessage(d); }; XamSparklineView.prototype.a0 = function (a) { var b = new MouseLeaveMessage_Spark(); this.h.sendMessage(b); }; XamSparklineView.prototype.a3 = function (a) { this.a4(a.b, a.c, null, -1, -1); }; XamSparklineView.prototype.a4 = function (a, b, c, d, e) { var f = null; var g = true, h = true; switch (a) { case "sparkpath": case XamSparkline.$$p[0]: f = this.bw; break; case "negativesparkpath": case XamSparkline.$$p[29]: f = this.bu; break; case "markers": case XamSparkline.$$p[24]: f = this.bs; break; case "firstmarker": case XamSparkline.$$p[3]: f = this.bo; break; case "lastmarker": case XamSparkline.$$p[17]: f = this.bq; break; case "highmarker": case XamSparkline.$$p[7]: f = this.bp; break; case "lowmarker": case XamSparkline.$$p[21]: f = this.br; break; case "negativemarkers": case XamSparkline.$$p[30]: f = this.bt; break; case "trendline": case XamSparkline.$$p[38]: f = this.bx; h = false; break; case "range": case XamSparkline.$$p[33]: f = this.bv; g = false; break; } if (f == null) { return; } if (b == null && c != null) { b = new Brush(); b._fill = c; } if (b != null) { if (h && (c == null || f._fill == null)) { f._fill = b; } if (g && (c == null || f._stroke == null)) { f._stroke = b; } } if (d > 0 && d < 1) { f._opacity = d; } if (e > 0 && (c == null || f.ad <= 0)) { f.ad = e; } this.aq(); }; XamSparklineView.prototype.bi = function (a) { switch (a.b) { case XamSparkline.$$p[26]: this.bs._visibility = a.c; break; case XamSparkline.$$p[5]: this.bo._visibility = a.c; break; case XamSparkline.$$p[19]: this.bq._visibility = a.c; break; case XamSparkline.$$p[9]: this.bp._visibility = a.c; break; case XamSparkline.$$p[23]: this.br._visibility = a.c; break; case XamSparkline.$$p[32]: this.bt._visibility = a.c; break; case XamSparkline.$$p[36]: this.bv._visibility = a.c; break; case XamSparkline.$$p[37]: this.u = a.c == 0; break; } this.aq(); }; XamSparklineView.prototype.bb = function (a) { var b = a.b; if (b <= 0) { return; } switch (a.c) { case XamSparkline.$$p[20]: this.bw.ad = this.bu.ad = b; break; case XamSparkline.$$p[40]: this.bx.ad = b; break; } this.aq(); }; XamSparklineView.prototype.ak = function (a) { if (a.b == null) { if (this.n != null) { this.n.av(); var b = this.n; b.onMouseLeave = delegateRemove(b.onMouseLeave, runOn(this, this.a0)); var c = this.n; c.onMouseOver = delegateRemove(c.onMouseOver, runOn(this, this.a1)); this.n = null; } this.ae = null; this.af = null; this.ag = null; this.ah = null; this.p = this.q = this.r = null; this.d.m(null); return; } var d = a.b; this.d.m(d); this.ae = d; this.ae.rootWrapper.setStyleProperty("position", "relative"); this.af = this.ae.createElement("canvas"); this.af.setStyleProperty("position", "absolute"); this.ag = this.ae.createElement("canvas"); this.ag.setStyleProperty("position", "absolute"); this.ah = this.ae.createElement("canvas"); this.ah.setStyleProperty("position", "absolute"); this.ae.append(this.af); this.ae.append(this.ag); this.ae.append(this.ah); this.p = new RenderingContext(new CanvasViewRenderer(), this.ae.get2DCanvasContext(this.af)); this.q = new RenderingContext(new CanvasViewRenderer(), this.ae.get2DCanvasContext(this.ag)); this.r = new RenderingContext(new CanvasViewRenderer(), this.ae.get2DCanvasContext(this.ah)); this.n = new CanvasGestureDOMEventProxy(this.af, this.ae, false); var e = this.n; e.onMouseLeave = delegateCombine(e.onMouseLeave, runOn(this, this.a0)); var f = this.n; f.onMouseOver = delegateCombine(f.onMouseOver, runOn(this, this.a1)); this.n.ap = function (g) { return false; }; this.ao(); this.at(); }; XamSparklineView.prototype.ao = function () { var a = ["sparkpath", "negativesparkpath", "trendline", "markers", "firstmarker", "lastmarker", "highmarker", "lowmarker", "negativemarkers", "range"]; var b = ["#8bdc5c", "#ee5879", "#565656", "#8b5bb1", "#f8a15f", "#ee5879", "#6db1ff", "#f7d262", "#ee5879", "#66666666"]; for (var c = 0; c < 10; c++) { var d = a[c]; var e = ["background-color", "opacity", "border-top-width"]; this.a("ui-sparkline-" + d, e); var f = XamSparklineView.ad(e[2], (c < 3) ? (c < 2 ? 2 : 1.5) : -1); if (c > 2 && c < 9) { this.b[c - 3] = f; } this.a4(d, null, (e[0] == null) ? b[c] : e[0], XamSparklineView.ad(e[1], -1), c < 3 ? f : -1); } }; XamSparklineView.ad = function (v_, a) { var d_ = (v_ == null || v_.length < 1) ? null : parseFloat(v_); return (d_ == null || d_.toString() == "NaN") ? a : d_; }; XamSparklineView.prototype.a = function (a, b) { this.ae.startCSSQuery(); for (var c = 0; c < b.length; c++) { b[c] = this.ae.getCssDefaultPropertyValue(a, b[c]); } this.ae.endCSSQuery(); return b; }; XamSparklineView.prototype.at = function () { if (this.ae == null || this.s) { return; } this.s = true; this.ap(this.m.q); var a = this.ae.rootWrapper.width(), b = this.ae.rootWrapper.height(); var c, d, e; c = this.af; d = this.ag; e = this.ah; var f = new ContainerResizedMessage_Spark(); f.g = a; f.d = b; f.b = this.q; f.h = this.ae; f.c = this.r; f.f = 0; f.e = 0; f.j = d; f.i = c; f.k = e; this.i.sendMessage(f); var g = f.e, h = f.f, i = f.g - h, j = f.d - g; var k = i, l = a - i, m = j, n = b - j; c.setStyleProperty("width", k.toString() + "px"); c.setStyleProperty("height", m.toString() + "px"); c.setAttribute("width", (k * this.x).toString()); c.setAttribute("height", (m * this.x).toString()); c.setStyleProperty("marginLeft", l + "px"); k = (i + h); this.az(d, k, n, k * this.x, n * this.x); d.setStyleProperty("marginTop", m + "px"); d.setStyleProperty("marginLeft", (a - i - h).toString() + "px"); this.az(e, l, m, l * this.x, m * this.x); this.bn = new Rect(0, 0, 0, i, j); if (this.n != null) { this.n.bl = this.bn; } this.bh(); var o = new ViewportChangedMessage_Spark(); o.newLeft = this.bn.left; o.newTop = this.bn.top; o.newHeight = this.bn.height; o.newWidth = this.bn.width; this.i.sendMessage(o); this.s = false; }; XamSparklineView.prototype.al = function (a) { if (a) { this.y = -1; } else if (this.y < 0) { this.bh(); } }; XamSparklineView.prototype.bh = function () { var a = this.bn.left; var b = this.bn.width; var c = this.bn.height; var d = this.ab(true); var e = new Rect(0, a + d, d, b - d * 2, c - d * 2); var f = new ViewportChangedMessage_Spark(); f.newLeft = e.left; f.newTop = e.top; f.newHeight = e.height; f.newWidth = e.width; this.bm = e; this.h.sendMessage(f); }; XamSparklineView.prototype.aj = function (a) { if (Rect.l_op_Equality(this.bn, null)) { return; } switch (a.b) { case 2: this.bs.an = null; this.bo.an = null; this.bq.an = null; this.bp.an = null; this.br.an = null; this.bt.an = null; break; case 8: this.bv.an = null; break; case 1: this.bw.an = null; this.bu.an = null; break; case 4: this.am(null); break; case 16: this.bx.an = null; break; } if (a.c) { this.at(); } }; XamSparklineView.prototype.ab = function (a) { if (a) { this.y = -1; } var b = this.y; if (b >= 0) { return b; } b = 0; var c = this.m.q; if (c.fp == 0) { b = this.ac(b, c.bd, 0); } if (c.fk == 0) { b = this.ac(b, c.a6, 1); } if (c.fn == 0) { b = this.ac(b, c.a8, 2); } if (c.fl == 0) { b = this.ac(b, c.a7, 3); } if (c.fo == 0) { b = this.ac(b, c.bc, 4); } if (c.fq == 0) { b = this.ac(b, c.bi, 5); } this.y = b; return b; }; XamSparklineView.prototype.ac = function (a, b, c) { if (b >= 0) { return b > a ? b : a; } return this.b[c] > a ? this.b[c] : a; }; XamSparklineView.prototype.a8 = function (a) { this.a9(this.bs, a.e, a.k, 0); this.a9(this.bt, a.f, a.l, 5); this.a9(this.br, a.d, a.j, 4); this.a9(this.bp, a.c, a.h, 3); this.ba(this.bo, a.m, a.g, 1); this.ba(this.bq, a.n, a.i, 2); this.aq(); }; XamSparklineView.prototype.ba = function (a, b, c, d) { var e = ((function () { var $ret = new List$1(Point_$type, 0); $ret.add(b); return $ret; })()); this.a9(a, e, c, d); }; XamSparklineView.prototype.a9 = function (a, b, c, d) { if (c < 0) { c = this.b[d]; } a.an = this.bl(b, c < 0.1 ? DeviceUtils.g(3) : c); if (this.m.q.aq != 3) { var e = new TranslateTransform(); e.j = this.m.o.d; a.j = e; } else { a.j = null; } }; XamSparklineView.prototype.bl = function (a, b) { var e_1, _a; var c = new GeometryGroup(); c.c = 1; var d = this.bn.right; var e = this.bn.bottom; try { for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) { var f = _c.value; if ((!f)) { continue; } if (f.x < 0 || f.y < 0 || f.x > d || f.y > e) { continue; } var g = new EllipseGeometry(); g.c = b; g.d = b; g.e = f; c.d.add(g); } } 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 c; }; XamSparklineView.prototype.bc = function (a) { var e_2, _a; var b = new PathGeometry(); var c = this.m.q.aq == 1; try { for (var _b = __values(fromEnum(a.points)), _c = _b.next(); !_c.done; _c = _b.next()) { var d = _c.value; var e = d.length; if (e == 0) { continue; } var f = new PathFigure(); f._isClosed = f._isFilled = c; f._startPoint = d[0]; for (var g = 1; g < e; g++) { var h = new LineSegment(1); h.c = d[g]; f._segments.add(h); } b.c.add(f); } } 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; } } this.bw.an = b; this.aq(); }; XamSparklineView.prototype.bk = function (a, b) { var e_3, _a; var c = typeCast(WinLossColumnMessage_Spark.$, b); var d = typeCast(ColumnMessage_Spark.$, b); var e = new GeometryGroup(); var f = c != null ? c.i : d.i; var g = c != null ? c.h : d.h; var h = f * 0.1; try { for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) { var i = _c.value; var j = f * 2 - h * 2; var k = Math.abs(g - i.y); var l = i.x + h; var m = (i.y > g ? g : i.y); var n = new RectangleGeometry(); n.e = new Rect(0, l, m, j, k); e.d.add(n); } } 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; } } return e; }; XamSparklineView.prototype.a5 = function (a) { this.a6(this.bw, a.d, a); this.a6(this.bu, a.g, a); this.aq(); }; XamSparklineView.prototype.a7 = function (a, b, c) { var d = ((function () { var $ret = new List$1(Point_$type, 0); $ret.add(b); return $ret; })()); this.a6(a, d, c); }; XamSparklineView.prototype.a6 = function (a, b, c) { a.an = this.bk(b, c); }; XamSparklineView.prototype.bj = function (a) { this.a6(this.bw, a.d, a); this.a6(this.bu, a.g, a); this.aq(); }; XamSparklineView.prototype.bd = function (a) { var b = new RectangleGeometry(); b.e = new Rect(0, a.k, a.l, a.j, a.i); this.bv.an = b; this.aq(); }; XamSparklineView.prototype.bg = function (a) { if (a.points.length == 0) { return; } var b = new PathGeometry(); var c = new PathFigure(); c._isClosed = c._isFilled = false; c._startPoint = a.points[0]; var d = a.points.length; for (var e = 1; e < d; e++) { var f = new LineSegment(1); f.c = a.points[e]; c._segments.add(f); } b.c.add(c); this.bx.an = b; this.aq(); }; XamSparklineView.prototype.bf = function (a) { this.ai = a.template; }; XamSparklineView.prototype.be = function (a) { if (!this.u) { this.am(null); return; } var b = truncate(Math.round(a.xOffset - 10)); var c = truncate(Math.round(a.yOffset - 10)); b = truncate(Math.round(b * this.x)); c = truncate(Math.round(c * this.x)); var d = this.p.a(b, c); if (d[3] > 0) { this.am(a); } else { this.am(null); } }; XamSparklineView.prototype.am = function (a) { var x_ = 0, y_ = 0; var v_ = null, t_ = null, i_ = this.ae; { if (a != null) { t_ = this.ai; x_ = a.xOffset + 6; y_ = a.yOffset + 6; var b = a.context; var f_ = b.first, l_ = b.last, o_ = b.low, h_ = b.high; v_ = { First: f_, Last: l_, Low: o_, High: h_ }; } var ren_ = this.ae; if (this.e == null) { this.e = new DataContext(); } var dc_ = this.e; dc_.item = v_; dc_.series = this; var tt_ = this.ai; if (tt_ != null) { if (v_ != null) { tt_.updateToolTip(dc_); tt_.setRawPosition(x_, y_); } else { tt_.hideToolTip(); } } } }; Object.defineProperty(XamSparklineView.prototype, "isDirty", { get: function () { return this.t; }, set: function (a) { this.t = a; }, enumerable: false, configurable: true }); XamSparklineView.prototype.aq = function () { if (!this.isDirty) { this.isDirty = true; this.d.r(this.p, null); this.c.r(this.q, this.r); } }; XamSparklineView.prototype.undirty = function (a) { this.t = false; this.ax(); }; Object.defineProperty(XamSparklineView.prototype, "index", { get: function () { return 10; }, enumerable: false, configurable: true }); XamSparklineView.prototype.ay = function (a, b) { b.t(a); }; XamSparklineView.prototype.ax = function () { var a = this.p; if (a != null && a.d) { if (this.x != 1) { a.aa(); a.ab(this.x, this.x); } a.l(this.bn.left, this.bn.top, this.bn.width, this.bn.height); a.t(this.bw); a.t(this.bu); this.ay(this.bs, a); this.ay(this.bt, a); this.ay(this.bp, a); this.ay(this.br, a); this.ay(this.bo, a); this.ay(this.bq, a); a.t(this.bv); a.t(this.bx); if (this.x != 1) { a.z(); } } var b = new AxisRenderMessage_Spark(); b.c = true; this.i.sendMessage(b); this.postRender(); }; XamSparklineView.prototype.postRender = function () { }; XamSparklineView.prototype.an = function (a) { a.viewport = new RectData(this.bn.left, this.bn.top, this.bn.width, this.bn.height); a.marginViewport = new RectData(this.bm.left, this.bm.top, this.bm.width, this.bm.height); a.sparkPath = new PathVisualData(1, "SparkPath", this.bw); a.negativeSparkPath = new PathVisualData(1, "NegativeSparkPath", this.bu); a.trendLinePath = new PathVisualData(1, "TrendLinePath", this.bx); a.rangePath = new PathVisualData(1, "RangePath", this.bv); a.markersPath = new PathVisualData(1, "MarkersPath", this.bs); a.negativeMarkersPath = new PathVisualData(1, "NegativeMarkersPath", this.bt); a.lowMarkersPath = new PathVisualData(1, "LowMarkersPath", this.br); a.highMarkersPath = new PathVisualData(1, "HighMarkersPath", this.bp); a.firstMarkerPath = new PathVisualData(1, "FirstMarkerPath", this.bo); a.lastMarkerPath = new PathVisualData(1, "LastMarkerPath", this.bq); }; XamSparklineView.prototype.preRender = function () { }; XamSparklineView.prototype.isValid = function () { return true; }; XamSparklineView.prototype.o = function (a) { return FontUtil.getFontForClass(this.ae, a); }; XamSparklineView.prototype.az = function (a, b, c, d, e) { a.setStyleProperty("width", b + "px"); a.setStyleProperty("height", c + "px"); a.setAttribute("width", d.toString()); a.setAttribute("height", e.toString()); }; XamSparklineView.prototype.ap = function (a) { var b = a.bl; var c = a.a5; if (!isNaN_(b) && b != 0) { return; } if (window.devicePixelRatio != undefined && window.devicePixelRatio != c) { a.a5 = window.devicePixelRatio; } }; XamSparklineView.prototype.au = function () { if (this.n != null) { this.n.bh(this.af, ""); } }; XamSparklineView.prototype.as = function () { this.ap(this.l.q); if (this.n != null) { this.n.at(this.af, ""); } }; XamSparklineView.$t = markType(XamSparklineView, 'XamSparklineView', Base.$, [ISchedulableRender_$type]); return XamSparklineView; }(Base)); export { XamSparklineView }; /** * @hidden */ var SparkFramePreparer = /** @class */ /*@__PURE__*/ (function (_super) { __extends(SparkFramePreparer, _super); function SparkFramePreparer() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.b = null; _this.d = 0; _this.c = 0; return _this; } SparkFramePreparer.prototype.e = function (a) { var e_4, _a; var _this = this; this.b.r.al(false); a.g.clear(); a.l.clear(); a.j.clear(); a.k.clear(); a.i.clear(); a.h.clear(); var b = this.b.t; if (b == null) { return; } var c = b.count; var d = this.b.a3.top; var e = this.b.a3.left; var f = this.b.a3.width; var g = this.b.a3.height; var h = this.b.a3.bottom; var i = Math.floor((c + 1) / f); var j = truncate(Math.max(1, i)); var k = 0; var l = truncate(Math.ceil(1 * c / j)); var m = 0; var n = new List$1(Number_$type, 0); var o = this.b.q.ar; var p = this.b.q.aq; var q = this.b.q.bq; var r = o != 0 && q >= 1; var s = null; var t = null; if (p == 1 || p == 0) { this.d = 0; } else { if (l == 0) { this.d = 0; } else {