igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,444 lines (1,443 loc) • 84.3 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { 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
*/
export let HorizontalAxisView = /*@__PURE__*/ (() => {
class HorizontalAxisView extends Base {
constructor(a) {
super();
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.$, (b) => this.ac(typeCast(AxisRenderMessage_Spark.$, b)));
this.p.item(ContainerResizedMessage_Spark.$, (b) => this.y(typeCast(ContainerResizedMessage_Spark.$, b)));
this.p.item(ViewportChangedMessage_Spark.$, (b) => this.ae(typeCast(ViewportChangedMessage_Spark.$, b)));
this.p.item(PixelRatioMessage_Spark.$, (b) => this.ab(typeCast(PixelRatioMessage_Spark.$, b)));
this.j = a;
}
b() {
if (!this.n) {
this.n = true;
this.k.a("ui-sparkline-axis-x", this.a);
}
return this.a;
}
t() {
let a = this.r;
if (a >= 0) {
return a;
}
let b = this.b()[0];
if (b != null) {
a = parseInt(b);
}
this.r = a = (a < 1) ? 1 : a;
return a;
}
get h() {
return this.g;
}
set h(a) {
let b = this.g;
this.g = a;
this.k = a.getService("View");
this.aa(b, this.g);
}
get p() {
return this.o;
}
set p(a) {
this.o = a;
}
get f() {
return this.d;
}
set f(a) {
this.d = a;
}
get e() {
return this.c;
}
set e(a) {
this.c = a;
}
z(a) {
let b;
if (((() => { let c = this.p.tryGetValue(getInstanceType(a), b); b = c.p1; return c.ret; })())) {
b(a);
}
}
aa(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));
}
}
y(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.ae(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();
}
}
ae(a) {
this.v = this.w.width();
this.u = this.s + this.t();
}
ac(a) {
this.ad(a.c);
}
ad(a) {
this.ah = null;
let 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.ae(this.l);
}
if (this.q != 1) {
b.aa();
b.ab(this.q, this.q);
}
let c = this.t(), d = c / 2;
let e = this.j.av == null || this.j.av.count == 0;
if (e) {
this.u = 0;
}
let f = e ? null : this.x(this.j.av.item(0));
let g = f == null ? "" : f.toString();
this.ag = new TextBlock();
this.ag.al = g;
this.ag.n = 2;
this.af = new TextBlock();
let 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;
let i = this.j.fb;
let j = i == null ? null : i._fill;
let k = new Color();
let 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();
}
}
x(dataItem_) {
let 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;
}
let label_ = this.j.br;
return (typeof dataItem_ != 'undefined') ? dataItem_ : '';
;
}
i() {
let a = new SparklineAxisVisualData();
if (this.ah != null) {
a.axisLine = new LineVisualData(1, "HorizontalAxisLine", this.ah);
a.axisLine.appearance.isVisible = this.w.height() > 0;
}
let 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;
}
ab(a) {
this.q = a.b;
}
}
HorizontalAxisView.$t = /*@__PURE__*/ markType(HorizontalAxisView, 'HorizontalAxisView');
return HorizontalAxisView;
})();
/**
* @hidden
*/
export let VerticalAxisView = /*@__PURE__*/ (() => {
class VerticalAxisView extends Base {
constructor(a) {
super();
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.$, (b) => this.ai(typeCast(AxisRenderMessage_Spark.$, b)));
this.q.item(ContainerResizedMessage_Spark.$, (b) => this.ae(typeCast(ContainerResizedMessage_Spark.$, b)));
this.q.item(ViewportChangedMessage_Spark.$, (b) => this.aj(typeCast(ViewportChangedMessage_Spark.$, b)));
this.q.item(PixelRatioMessage_Spark.$, (b) => this.ah(typeCast(PixelRatioMessage_Spark.$, b)));
this.j = a;
}
b() {
if (!this.n) {
this.n = true;
this.k.a("ui-sparkline-axis-y", this.a);
}
return this.a;
}
x() {
let a = this.s;
if (a >= 0) {
return a;
}
let b = this.b()[0];
if (b != null) {
a = parseInt(b);
}
this.s = a = (a < 1) ? 1 : a;
return a;
}
get h() {
return this.g;
}
set h(a) {
let b = this.g;
this.g = a;
this.k = a.getService("View");
this.ag(b, this.g);
}
get q() {
return this.p;
}
set q(a) {
this.p = a;
}
get f() {
return this.d;
}
set f(a) {
this.d = a;
}
get e() {
return this.c;
}
set e(a) {
this.c = a;
}
af(a) {
let b;
if (((() => { let c = this.q.tryGetValue(getInstanceType(a), b); b = c.p1; return c.ret; })())) {
b(a);
}
}
ag(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));
}
}
ae(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.ae(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();
}
}
aj(a) {
this.z = this.v + this.x();
this.y = this.aa.height();
}
ai(a) {
if (this.o(a.c)) {
let b = new ClearMessage_Spark();
b.c = true;
this.f.sendMessage(b);
}
}
o(a) {
this.am = null;
if (this.j == null || this.m == null || !this.m.d || (a && this.ak == null)) {
return false;
}
let b = this.m;
if (a) {
b.l(0, 0, this.z, this.y);
}
let c = false;
if (b != null && this.l != null) {
b.ae(this.l);
}
if (!a) {
this.al = new TextBlock();
this.ak = new TextBlock();
let d = this.ab(this.j.a4);
this.al.al = this.ad = d == null ? "" : d.toString();
let 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) {
let 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);
}
let g = this.j.fj;
let h = 1;
let i = g == null ? null : g._fill;
let 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;
let k = new Color();
let 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);
let 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;
}
ab(dataItem_) {
let 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;
}
let label_ = this.j.bt;
return (typeof dataItem_ != 'undefined') ? dataItem_ : '';
;
}
i() {
let 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;
}
ah(a) {
this.r = a.b;
}
}
VerticalAxisView.$t = /*@__PURE__*/ markType(VerticalAxisView, 'VerticalAxisView');
return VerticalAxisView;
})();
/**
* @hidden
*/
export let XamSparklineView = /*@__PURE__*/ (() => {
class XamSparklineView extends Base {
constructor() {
super();
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;
let a = this.w;
a.item(ClearMessage_Spark.$, (b) => this.aj(typeCast(ClearMessage_Spark.$, b)));
a.item(PolygonMessage_Spark.$, (b) => this.bc(typeCast(PolygonMessage_Spark.$, b)));
a.item(ColumnMessage_Spark.$, (b) => this.a5(typeCast(ColumnMessage_Spark.$, b)));
a.item(WinLossColumnMessage_Spark.$, (b) => this.bj(typeCast(WinLossColumnMessage_Spark.$, b)));
a.item(MarkerMessage_Spark.$, (b) => this.a8(typeCast(MarkerMessage_Spark.$, b)));
a.item(NormalRangeMessage_Spark.$, (b) => this.bd(typeCast(NormalRangeMessage_Spark.$, b)));
a.item(TrendLineMessage_Spark.$, (b) => this.bg(typeCast(TrendLineMessage_Spark.$, b)));
a.item(TooltipMessage_Spark.$, (b) => this.be(typeCast(TooltipMessage_Spark.$, b)));
a.item(ToooltipTemplateMessage_Spark.$, (b) => this.bf(typeCast(ToooltipTemplateMessage_Spark.$, b)));
a.item(ContainerMessage_Spark.$, (b) => this.ak(typeCast(ContainerMessage_Spark.$, b)));
a.item(PixelRatioMessage_Spark.$, (b) => this.aw(typeCast(PixelRatioMessage_Spark.$, b)));
a.item(BrushChangedMessage_Spark.$, (b) => this.a3(typeCast(BrushChangedMessage_Spark.$, b)));
a.item(ContainerResizedMessage_Spark.$, (b) => this.at());
a.item(VisibilityMessage_Spark.$, (b) => this.bi(typeCast(VisibilityMessage_Spark.$, b)));
a.item(NumberChangedMessage_Spark.$, (b) => this.bb(typeCast(NumberChangedMessage_Spark.$, b)));
a.item(ContainerSizeChangedMessage_Spark.$, (b) => this.at());
this.d = new CanvasRenderScheduler();
this.c = new CanvasRenderScheduler();
this.d.o(this);
this.c.o(this);
}
aw(a) {
this.x = a.b;
}
get k() {
return this.j;
}
set k(a) {
let b = this.j;
this.j = a;
this.av(b, this.j);
this.l = null;
}
get h() {
return this.f;
}
set h(a) {
this.f = a;
}
get i() {
return this.g;
}
set i(a) {
this.g = a;
}
get w() {
return this.v;
}
set w(a) {
this.v = a;
}
av(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);
}
}
a2(a) {
this.h = a;
}
ar(a) {
let b;
if (((() => { let c = this.w.tryGetValue(getInstanceType(a), b); b = c.p1; return c.ret; })())) {
b(a);
}
}
get m() {
if (this.l == null) {
this.l = this.k.getService("Controller");
}
return this.l;
}
a1(a, b, c) {
let d = new MouseMoveMessage_Spark();
d.position = a;
this.h.sendMessage(d);
}
a0(a) {
let b = new MouseLeaveMessage_Spark();
this.h.sendMessage(b);
}
a3(a) {
this.a4(a.b, a.c, null, -1, -1);
}
a4(a, b, c, d, e) {
let f = null;
let 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();
}
bi(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();
}
bb(a) {
let 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();
}
ak(a) {
if (a.b == null) {
if (this.n != null) {
this.n.av();
let b = this.n;
b.onMouseLeave = delegateRemove(b.onMouseLeave, runOn(this, this.a0));
let 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;
}
let 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);
let e = this.n;
e.onMouseLeave = delegateCombine(e.onMouseLeave, runOn(this, this.a0));
let f = this.n;
f.onMouseOver = delegateCombine(f.onMouseOver, runOn(this, this.a1));
this.n.ap = (g) => false;
this.ao();
this.at();
}
ao() {
let a = ["sparkpath", "negativesparkpath", "trendline", "markers", "firstmarker", "lastmarker", "highmarker", "lowmarker", "negativemarkers", "range"];
let b = ["#8bdc5c", "#ee5879", "#565656", "#8b5bb1", "#f8a15f", "#ee5879", "#6db1ff", "#f7d262", "#ee5879", "#66666666"];
for (let c = 0; c < 10; c++) {
let d = a[c];
let e = ["background-color", "opacity", "border-top-width"];
this.a("ui-sparkline-" + d, e);
let 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);
}
}
static ad(v_, a) {
let d_ = (v_ == null || v_.length < 1) ? null : parseFloat(v_);
return (d_ == null || d_.toString() == "NaN") ? a : d_;
}
a(a, b) {
this.ae.startCSSQuery();
for (let c = 0; c < b.length; c++) {
b[c] = this.ae.getCssDefaultPropertyValue(a, b[c]);
}
this.ae.endCSSQuery();
return b;
}
at() {
if (this.ae == null || this.s) {
return;
}
this.s = true;
this.ap(this.m.q);
let a = this.ae.rootWrapper.width(), b = this.ae.rootWrapper.height();
let c, d, e;
c = this.af;
d = this.ag;
e = this.ah;
let 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);
let g = f.e, h = f.f, i = f.g - h, j = f.d - g;
let 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();
let 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;
}
al(a) {
if (a) {
this.y = -1;
}
else if (this.y < 0) {
this.bh();
}
}
bh() {
let a = this.bn.left;
let b = this.bn.width;
let c = this.bn.height;
let d = this.ab(true);
let e = new Rect(0, a + d, d, b - d * 2, c - d * 2);
let 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);
}
aj(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();
}
}
ab(a) {
if (a) {
this.y = -1;
}
let b = this.y;
if (b >= 0) {
return b;
}
b = 0;
let 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;
}
ac(a, b, c) {
if (b >= 0) {
return b > a ? b : a;
}
return this.b[c] > a ? this.b[c] : a;
}
a8(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();
}
ba(a, b, c, d) {
let e = ((() => {
let $ret = new List$1(Point_$type, 0);
$ret.add(b);
return $ret;
})());
this.a9(a, e, c, d);
}
a9(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) {
let e = new TranslateTransform();
e.j = this.m.o.d;
a.j = e;
}
else {
a.j = null;
}
}
bl(a, b) {
let c = new GeometryGroup();
c.c = 1;
let d = this.bn.right;
let e = this.bn.bottom;
for (let f of fromEnum(a)) {
if ((!f)) {
continue;
}
if (f.x < 0 || f.y < 0 || f.x > d || f.y > e) {
continue;
}
let g = new EllipseGeometry();
g.c = b;
g.d = b;
g.e = f;
c.d.add(g);
}
return c;
}
bc(a) {
let b = new PathGeometry();
let c = this.m.q.aq == 1;
for (let d of fromEnum(a.points)) {
let e = d.length;
if (e == 0) {
continue;
}
let f = new PathFigure();
f._isClosed = f._isFilled = c;
f._startPoint = d[0];
for (let g = 1; g < e; g++) {
let h = new LineSegment(1);
h.c = d[g];
f._segments.add(h);
}
b.c.add(f);
}
this.bw.an = b;
this.aq();
}
bk(a, b) {
let c = typeCast(WinLossColumnMessage_Spark.$, b);
let d = typeCast(ColumnMessage_Spark.$, b);
let e = new GeometryGroup();
let f = c != null ? c.i : d.i;
let g = c != null ? c.h : d.h;
let h = f * 0.1;
for (let i of fromEnum(a)) {
let j = f * 2 - h * 2;
let k = Math.abs(g - i.y);
let l = i.x + h;
let m = (i.y > g ? g : i.y);
let n = new RectangleGeometry();
n.e = new Rect(0, l, m, j, k);
e.d.add(n);
}
return e;
}
a5(a) {
this.a6(this.bw, a.d, a);
this.a6(this.bu, a.g, a);
this.aq();
}
a7(a, b, c) {
let d = ((() => {
let $ret = new List$1(Point_$type, 0);
$ret.add(b);
return $ret;
})());
this.a6(a, d, c);
}
a6(a, b, c) {
a.an = this.bk(b, c);
}
bj(a) {
this.a6(this.bw, a.d, a);
this.a6(this.bu, a.g, a);
this.aq();
}
bd(a) {
let b = new RectangleGeometry();
b.e = new Rect(0, a.k, a.l, a.j, a.i);
this.bv.an = b;
this.aq();
}
bg(a) {
if (a.points.length == 0) {
return;
}
let b = new PathGeometry();
let c = new PathFigure();
c._isClosed = c._isFilled = false;
c._startPoint = a.points[0];
let d = a.points.length;
for (let e = 1; e < d; e++) {
let f = new LineSegment(1);
f.c = a.points[e];
c._segments.add(f);
}
b.c.add(c);
this.bx.an = b;
this.aq();
}
bf(a) {
this.ai = a.template;
}
be(a) {
if (!this.u) {
this.am(null);
return;
}
let b = truncate(Math.round(a.xOffset - 10));
let c = truncate(Math.round(a.yOffset - 10));
b = truncate(Math.round(b * this.x));
c = truncate(Math.round(c * this.x));
let d = this.p.a(b, c);
if (d[3] > 0) {
this.am(a);
}
else {
this.am(null);
}
}
am(a) {
let x_ = 0, y_ = 0;
let v_ = null, t_ = null, i_ = this.ae;
{
if (a != null) {
t_ = this.ai;
x_ = a.xOffset + 6;
y_ = a.yOffset + 6;
let b = a.context;
let f_ = b.first, l_ = b.last, o_ = b.low, h_ = b.high;
v_ = { First: f_, Last: l_, Low: o_, High: h_ };
}
let ren_ = this.ae;
if (this.e == null) {
this.e = new DataContext();
}
let dc_ = this.e;
dc_.item = v_;
dc_.series = this;
let tt_ = this.ai;
if (tt_ != null) {
if (v_ != null) {
tt_.updateToolTip(dc_);
tt_.setRawPosition(x_, y_);
}
else {
tt_.hideToolTip();
}
}
}
}
get isDirty() {
return this.t;
}
set isDirty(a) {
this.t = a;
}
aq() {
if (!this.isDirty) {
this.isDirty = true;
this.d.r(this.p, null);
this.c.r(this.q, this.r);
}
}
undirty(a) {
this.t = false;
this.ax();
}
get index() {
return 10;
}
ay(a, b) {
b.t(a);
}
ax() {
let 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();
}
}
let b = new AxisRenderMessage_Spark();
b.c = true;
this.i.sendMessage(b);
this.postRender();
}
postRender() {
}
an(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);
}
preRender() {
}
isValid() {
return true;
}
o(a) {
return FontUtil.getFontForClass(this.ae, a);
}
az(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());
}
ap(a) {
let b = a.bl;
let c = a.a5;
if (!isNaN_(b) && b != 0) {
return;
}
if (window.devicePixelRatio != undefined && window.devicePixelRatio != c) {
a.a5 = window.devicePixelRatio;
}
}
au() {
if (this.n != null) {
this.n.bh(this.af, "");
}
}
as() {
this.ap(this.l.q);
if (this.n != null) {
this.n.at(this.af, "");
}
}
}
XamSparklineView.$t = /*@__PURE__*/ markType(XamSparklineView, 'XamSparklineView', Base.$, [ISchedulableRender_$type]);
return XamSparklineView;
})();
/**
* @hidden
*/
export let SparkFramePreparer = /*@__PURE__*/ (() => {
class SparkFramePreparer extends Base {
constructor() {
super(...arguments);
this.b = null;
this.d = 0;
this.c = 0;
}
e(a) {
this.b.r.al(false);
a.g.clear();
a.l.clear();
a.j.clear();
a.k.clear();
a.i.clear();
a.h.clear();
let b = this.b.t;
if (b == null) {
return;
}
let c = b.count;
let d = this.b.a3.top;
let e = this.b.a3.left;
let f = this.b.a3.width;
let g = this.b.a3.height;
let h = this.b.a3.bottom;
let i = Math.floor((c + 1) / f);
let j = truncate(Math.max(1, i));
let k = 0;
let l = truncate(Math.ceil(1 * c / j));
let m = 0;
let n = new List$1(Number_$type, 0);
let o = this.b.q.ar;
let p = this.b.q.aq;
let q = this.b.q.bq;
let r = o != 0 && q >= 1;
let s = null;
let t = null;
if (p == 1 || p == 0) {
this.d = 0;
}
else {
if (l == 0) {
this.d = 0;
}
else {
this.d = f / l / 2;
}
}
if (r) {
let u = (v) => v + 1;
let v = (w) => b.item(w);
let w = (x) => this.b.y(x);
let x = (y) => this.b.z(y);
switch (this.b.q.ar) {
case 9:
s = TrendCalculators.e(b, q);
break;
case 10:
s = TrendCalculators.b(b, q);
break;
case 11:
s = TrendCalculators.c(b, q);
break;
case 12:
s = TrendCalculators.a(b);
break;
case 13:
s = TrendCalculators.g(b, q);
break;
case 1:
t = LeastSquaresFit.k(c, u, v);
break;
case 2:
t = LeastSquaresFit.o(c, u, v);
break;
case 3:
t = LeastSquaresFit.i(c, u, v);
break;
case 4:
t = LeastSquaresFit.p(c, u, v);
break;
case 5:
t = LeastSquaresFit.q(c, u, v);
break;
case 7:
t = LeastSquaresFit.j(c, u, v);
break;
case 6:
t = LeastSquaresFit.l(c, u, v);
break;
case 8:
t = LeastSquaresFit.n(c, u, v);
break;
}
if (s != null) {
for (let y of fromEnum(s)) {
n.add(y);
}
}
if (t != null) {
let z = k * j;
let aa = l * j;
if (p == 1 || p == 0) {
aa = aa - 1;
}
let ab = 0 + this.d;
let ac = f - this.d;
let ad = 0;
if (this.d != 0) {
ad = 0.5;
}
for (let ae = ab; ae <= ac; ae += 2) {
let af = ae / (f - 1);
let ag = z + af * (aa - z);
let ah = NaN;
switch (o) {
case 1:
ah = LeastSquaresFit.ad(t, ag - ad);
break;
case 2:
ah = LeastSquaresFit.ah(t, ag - ad);
break;
case 3:
ah = LeastSquaresFit.ab(t, ag - ad);