igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
439 lines (438 loc) • 15.8 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 { __extends } from "tslib";
import { Series } from "./Series";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { Axis } from "./Axis";
import { DependencyProperty } from "igniteui-react-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { Point_$type, typeCast, Delegate_$type, markType, markDep } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { SeriesView } from "./SeriesView";
import { NotImplementedException } from "igniteui-react-core";
import { AxisRange } from "./AxisRange";
import { NumericAxisBase } from "./NumericAxisBase";
import { AxisAnnotationFrame } from "./AxisAnnotationFrame";
import { ScalerParams } from "./ScalerParams";
import { CategoryXAxis } from "./CategoryXAxis";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { stringFormat } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
/**
* @hidden
*/
var ValueOverlay = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ValueOverlay, _super);
function ValueOverlay() {
var _this = _super.call(this) || this;
_this.xh = 0;
_this.xi = 0;
_this.xe = 0;
_this.w1 = null;
_this.w7 = null;
_this.w6 = null;
_this.ab = ValueOverlay.$;
return _this;
}
ValueOverlay.prototype.bk = function () {
return new ValueOverlay();
};
ValueOverlay.prototype.i5 = function (a, b, c) {
return this.xj;
};
ValueOverlay.prototype.xf = function (a, b) {
var c = Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
var d = Math.acos((a.x - b.x) / c);
if ((a.y - b.y) < 0) {
d = (2 * Math.PI) - d;
}
return d;
};
ValueOverlay.prototype.we = function (a, b, c) {
if (this.w0 == null) {
return { $type: Point_$type, x: NaN, y: NaN };
}
var d = this.xg();
var e = NaN;
var f = NaN;
var g = NaN;
var h = { $type: Point_$type, x: 0.5, y: 0.5 };
var i = NaN;
switch (this.w0.a2) {
case 2:
i = Math.sqrt(Math.pow(a.x - h.x, 2) + Math.pow(a.y - h.y, 2));
g = d;
e = h.x + Math.cos(g) * i;
f = h.y + Math.sin(g) * i;
f = this.cw.b1.top + this.cw.b1.height * (f - this.cw.b2.top) / this.cw.b2.height;
e = this.cw.b1.left + this.cw.b1.width * (e - this.cw.b2.left) / this.cw.b2.width;
break;
case 0:
e = d;
f = a.y;
f = this.cw.b1.top + this.cw.b1.height * (f - this.cw.b2.top) / this.cw.b2.height;
break;
case 1:
f = d;
e = a.x;
e = this.cw.b1.left + this.cw.b1.width * (e - this.cw.b2.left) / this.cw.b2.width;
break;
case 3:
g = this.xf(a, h);
i = d;
e = h.x + Math.cos(g) * i;
f = h.y + Math.sin(g) * i;
f = this.cw.b1.top + this.cw.b1.height * (f - this.cw.b2.top) / this.cw.b2.height;
e = this.cw.b1.left + this.cw.b1.width * (e - this.cw.b2.left) / this.cw.b2.width;
break;
}
return { $type: Point_$type, x: e, y: f };
};
ValueOverlay.prototype.j3 = function (a) {
throw new NotImplementedException(0);
};
ValueOverlay.prototype.kn = function (a) {
return this;
};
ValueOverlay.prototype.gd = function (a) {
return false;
};
ValueOverlay.prototype.ay = function (a) {
var b = typeCast(NumericAxisBase.$, a);
var c = this.xj;
if (isNaN_(c) || isInfinity(c)) {
return null;
}
return new AxisRange(c, c);
};
ValueOverlay.prototype.rt = function (a) {
this.o5(true, this.cw);
if (!this.w5()) {
if (this.w1 != null) {
this.x2(NaN, this.d4());
}
return;
}
if (this.gf(a)) {
if (this.d4()) {
if (this.dd.g) {
this.dd.t();
}
var b = this.xh;
this.xh = this.xi;
this.xi = b;
}
else {
this.xh = this.xe;
}
this.xe = this.xg();
this.r9();
}
else {
this.xe = this.xg();
this.x1(this.xe, this.w3);
}
};
ValueOverlay.prototype.xg = function () {
var a, b;
var c = this.getViewInfo(b, a);
b = c.p0;
a = c.p1;
var d = this.getEffectiveViewport1(this.cw);
var e = new ScalerParams(0, a, b, this.w0.ch, d);
return this.w0.el(this.xj, e);
};
ValueOverlay.prototype.x1 = function (a, b) {
if (this.w0 == null) {
return;
}
var c = typeCast(CategoryAxisBase.$, this.w0);
if (c != null && !c.ce) {
if (this.xj > c.lk - 1) {
return;
}
if (c.categoryMode != 0) {
var d = this.getEffectiveViewport1(b);
var e = 0.5 * c.getCategorySize(b.b2, b.b1, d);
var f = false;
if (c.cp && !c.ch) {
f = true;
}
if (typeCast(CategoryXAxis.$, c) !== null && c.ch) {
f = true;
}
if (f) {
e = -e;
}
a += e;
}
}
var g = typeCast(NumericAxisBase.$, this.w0);
if (g != null) {
if (this.xj < g.l4 || this.xj > g.l3) {
return;
}
if (g.lp && this.xj < 0) {
return;
}
}
var h;
switch (this.w0.a2) {
case 2:
case 3:
h = this.w0.j8(a, b.b2, b.b1, this.getEffectiveViewport1(b), this.wl(b));
break;
default:
h = this.w0.j8(a, b.b2, b.b1, this.getEffectiveViewport1(b), this.wl(b));
break;
}
if (h != null) {
b.b5(h);
}
if (!b.r) {
this.x2(a, this.d4());
}
};
ValueOverlay.prototype.he = function (a, b, c) {
var d = true;
d = _super.prototype.he.call(this, a, b, c);
if (!c.p() || b.isEmpty || a.isEmpty || this.w0 == null || this.w0.bi == null) {
d = false;
}
return d;
};
ValueOverlay.prototype.st = function (a, b) {
this.rs(false);
};
ValueOverlay.prototype.ss = function (a, b) {
this.rs(false);
};
ValueOverlay.prototype.pb = function (a, b, c, d) {
throw new NotImplementedException(0);
};
ValueOverlay.prototype.ra = function (a, b, c, d) {
_super.prototype.ra.call(this, a, b, c, d);
switch (b) {
case ValueOverlay.$$p[11]:
if (c != null) {
c.b0(this);
}
if (d != null) {
d.ct(this);
}
this.rs(false);
this.ql();
break;
case "TransitionProgress":
this.xi = this.xh + this.jq * (this.xe - this.xh);
if (this.d6(this.cw)) {
return;
}
if (this.jq == 1) {
this.x1(this.xe, this.w3);
this.qo();
}
else {
this.x1(this.xi, this.w3);
}
if (this.dc != null) {
this.dc.qp(this);
}
break;
case ValueOverlay.$$p[13]:
var e = typeCast(NumericAxisBase.$, this.w0);
if (e != null) {
e.c1();
}
this.rs(true);
this.qm();
break;
case ValueOverlay.$$p[12]:
case ValueOverlay.$$p[10]:
case ValueOverlay.$$p[1]:
case ValueOverlay.$$p[0]:
case ValueOverlay.$$p[3]:
case ValueOverlay.$$p[4]:
case ValueOverlay.$$p[9]:
case ValueOverlay.$$p[5]:
case ValueOverlay.$$p[6]:
case ValueOverlay.$$p[7]:
case ValueOverlay.$$p[8]:
this.rs(true);
break;
}
};
ValueOverlay.prototype.qb = function () {
_super.prototype.qb.call(this);
if (this.w0 != null) {
this.w0.ib(false);
}
};
ValueOverlay.prototype.o5 = function (a, b) {
_super.prototype.o5.call(this, a, b);
var c = b;
c.b4();
};
ValueOverlay.prototype.w5 = function () {
if (this.w0 == null || this.w0.bi == null || isNaN_(this.xj) || this._visibility != 0) {
return false;
}
var a = typeCast(CategoryAxisBase.$, this.w0);
if (a != null && a.lk == 0) {
return false;
}
return true;
};
ValueOverlay.prototype.preferredCategoryMode = function (a) {
return 0;
};
Object.defineProperty(ValueOverlay.prototype, "categoryAxis", {
get: function () {
return typeCast(CategoryAxisBase.$, this.w0);
},
enumerable: false,
configurable: true
});
ValueOverlay.prototype.ct = function () {
return new ValueOverlayView(this);
};
ValueOverlay.prototype.q1 = function (a) {
_super.prototype.q1.call(this, a);
this.w3 = typeCast(ValueOverlayView.$, a);
};
ValueOverlay.prototype.ru = function (a, b) {
_super.prototype.ru.call(this, a, b);
if (!this.g0) {
this.cw.a7(b);
return;
}
this.cw.a7(b);
if (this.d6(this.cv) || !this.w5()) {
return;
}
var c = this.getEffectiveViewport1(this.cw);
var d = this.w0.el(this.xj, new ScalerParams(0, this.cv.b2, a, this.w0.ch, c));
this.x1(d, typeCast(ValueOverlayView.$, this.cv));
this.g0 = false;
};
ValueOverlay.prototype.getOffsetValue = function () {
return 0;
};
ValueOverlay.prototype.getCategoryWidth = function () {
return 0;
};
Object.defineProperty(ValueOverlay.prototype, "yk", {
get: function () {
return new Thickness(1, this.xa, this.xc, this.xb, this.w9);
},
enumerable: false,
configurable: true
});
ValueOverlay.prototype.ai = function () {
return [this.w0];
};
ValueOverlay.prototype.x2 = function (a, b) {
if (isNaN_(a)) {
if (this.w1 != null) {
AxisAnnotationFrameManager.b(this.w1);
AxisAnnotationFrameManager.d(this, this.w1, true, this.w6, this.w7, b, this.xk, this.xk, this.w2, this.w2);
}
return;
}
var c = false;
if (this.w6 == null) {
c = true;
this.w7 = new List$1(Axis.$, 0);
this.w6 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
this.w1 = new AxisAnnotationFrame();
var d = this.vb;
if (d == null) {
d = this.vh;
}
var e = this.w0.cp;
AxisAnnotationFrameManager.c(this.w1, { $type: Point_$type, x: a, y: a }, this, this.dc, this.getEffectiveViewport(), d, this.yh, this.w8, this.yj, this.yi, this.yk, this.xd, this.yh, this.w8, this.yj, this.yi, this.yk, this.xd, !e && this.w4, e && this.w4);
AxisAnnotationFrameManager.d(this, this.w1, c, this.w6, this.w7, b, this.xk, this.xk, this.w2, this.w2);
};
ValueOverlay.prototype.get_isValueOverlay = function () {
return true;
};
ValueOverlay.prototype.xx = function (a) {
if (this.w0 != null) {
return this.w0.gf(a);
}
return null;
};
Object.defineProperty(ValueOverlay.prototype, "xz", {
get: function () {
var a = this.xx(this.xj);
return a != null ? a : stringFormat("{0:0.##}", this.xj);
},
enumerable: false,
configurable: true
});
ValueOverlay.$t = markType(ValueOverlay, 'ValueOverlay', Series.$, [IHasCategoryModePreference_$type]);
ValueOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, ValueOverlay, 'raisePropertyChanged', ['AxisAnnotationBackgroundCornerRadius:w8:x3', [1, DeviceUtils.g(3)], 'AxisAnnotationBackground:yh:x4', [Brush.$, null], 'AxisAnnotationFormatLabel:w2:x5', [Delegate_$type], 'AxisAnnotationInterpolatedValuePrecision:xk:x6', [1, -1], 'AxisAnnotationOutline:yi:x7', [Brush.$, null], 'AxisAnnotationPaddingBottom:w9:x8', [1, NaN], 'AxisAnnotationPaddingLeft:xa:x9', [1, NaN], 'AxisAnnotationPaddingRight:xb:ya', [1, NaN], 'AxisAnnotationPaddingTop:xc:yb', [1, NaN], 'AxisAnnotationStrokeThickness:xd:yc', [1, NaN], 'AxisAnnotationTextColor:yj:yd', [Brush.$, null], 'Axis:w0:ye', [Axis.$, null], 'IsAxisAnnotationEnabled:w4:yf', [0, false], 'Value:xj:yg', [1, 0]]);
return ValueOverlay;
}(Series));
export { ValueOverlay };
/**
* @hidden
*/
var ValueOverlayView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ValueOverlayView, _super);
function ValueOverlayView(a) {
var _this = _super.call(this, a) || this;
_this.b6 = null;
_this.b6 = new Path();
return _this;
}
ValueOverlayView.prototype.bh = function () {
_super.prototype.bh.call(this);
this.b6._stroke = this.f.vb;
this.b6.ad = this.f.ie;
this.b6.ai = this.f.v4;
this.b6.aj = this.f.v5;
};
ValueOverlayView.prototype.bi = function () {
_super.prototype.bi.call(this);
var a = this.bv();
this.b6._stroke = a;
this.b6.ad = this.f.ie + 3;
this.b6._stroke = a;
this.b6.ad = this.f.ie + 3;
};
ValueOverlayView.prototype.b5 = function (a) {
this.b6.an = a;
this.av();
};
ValueOverlayView.prototype.b4 = function () {
this.b6.an = null;
this.av();
};
ValueOverlayView.prototype.bc = function (a, b) {
_super.prototype.bc.call(this, a, b);
if (a.d) {
a.t(this.b6);
}
};
ValueOverlayView.prototype.aq = function (a) {
_super.prototype.aq.call(this, a);
this.f.bc.exportPathData(a, this.b6, "ValueOverlayPath", []);
};
ValueOverlayView.$t = markType(ValueOverlayView, 'ValueOverlayView', SeriesView.$);
return ValueOverlayView;
}(SeriesView));
export { ValueOverlayView };