igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
235 lines (234 loc) • 9.64 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, fromEnum, Number_$type, String_$type, Point_$type, EnumUtil, markType } from "igniteui-angular-core";
import { IDataChartVisualDataManager_$type } from "./IDataChartVisualDataManager";
import { ChartVisualData } from "./ChartVisualData";
import { List$1 } from "igniteui-angular-core";
import { ChartDefaultTooltipSeriesData } from "./ChartDefaultTooltipSeriesData";
import { ChartDefaultTooltipData } from "./ChartDefaultTooltipData";
import { AppearanceHelper } from "igniteui-angular-core";
import { RectData } from "igniteui-angular-core";
import { VisualExportHelper } from "./VisualExportHelper";
import { ChartTitleVisualData } from "./ChartTitleVisualData";
import { HorizontalAlignment_$type } from "igniteui-angular-core";
import { FontUtil } from "igniteui-angular-core";
import { stringEndsWith } from "igniteui-angular-core";
/**
* @hidden
*/
export let DataChartVisualDataManager = /*@__PURE__*/ (() => {
class DataChartVisualDataManager extends Base {
exportVisualData(a) {
let b = new ChartVisualData();
for (let c = 0; c < a.zq.count; c++) {
let d = a.zq._inner[c].hr();
b.axes.add1(d);
}
for (let e = 0; e < a.b9.count; e++) {
let f = a.b9._inner[e].kv();
b.series.add1(f);
}
b.name = a.name;
this.d(a, b);
this.e(a, b);
this.c(a, b);
return b;
}
c(a, b) {
let c = null;
if (a.dw.am) {
c = new ChartDefaultTooltipData();
c.seriesData = new List$1(ChartDefaultTooltipSeriesData.$, 0);
let d = a.dw.ay;
let e;
e = d;
if (d != null) {
for (let f of fromEnum(d)) {
c.offsetX = f.ba.a$aw.x;
c.offsetY = f.ba.a$aw.y;
let g = this.a(a, f, f.ba);
c.seriesData.add(g);
}
}
}
else {
c = new ChartDefaultTooltipData();
c.seriesData = new List$1(ChartDefaultTooltipSeriesData.$, 0);
for (let h of fromEnum(a.b9)) {
if (h.ba.a$e(h)) {
c.offsetX = h.ba.a$aw.x;
c.offsetY = h.ba.a$aw.y;
let i = this.a(a, h, h.ba);
c.seriesData.add(i);
}
if (h.ei) {
h.qe((j) => {
if (j.ba.a$e(j)) {
c.offsetX = j.ba.a$aw.x;
c.offsetY = j.ba.a$aw.y;
let k = this.a(a, j, j.ba);
c.seriesData.add(k);
}
return true;
});
}
}
}
b.defaultTooltipData = c;
}
a(a, b, c) {
let d = c.a$aw;
let e = b.w1(d);
let f = b.getDataLegendSeriesContextAt(e.x, e.y);
let g = b.av();
let h = b.getDataLegendBadgeContextAtPosition(e.x, e.y);
let i = new ChartDefaultTooltipSeriesData();
i.seriesValues = new List$1(Number_$type, 0);
i.valueNames = new List$1(String_$type, 0);
i.seriesTitle = "Series Title:";
let j = h;
if (j != null) {
if (j.itemBrush != null) {
i.badgeBrush = AppearanceHelper.a(j.itemBrush);
}
else if (j.actualItemBrush != null) {
i.badgeBrush = AppearanceHelper.a(j.actualItemBrush);
}
else {
i.badgeBrush = AppearanceHelper.a(b.vu);
}
if (j.outline != null) {
i.badgeOutline = AppearanceHelper.a(j.outline);
}
else if (j.actualItemBrush != null) {
i.badgeOutline = AppearanceHelper.a(j.actualItemBrush);
}
else {
i.badgeOutline = AppearanceHelper.a(b.vv);
}
i.badgeLineBrush = i.badgeBrush;
}
i.seriesTitleBrush = AppearanceHelper.a(b.safeActualBrush);
switch (g) {
case 0:
i.badgeShape = "Circle";
break;
case 1:
i.badgeShape = "Line";
break;
case 2:
i.badgeShape = "Line";
break;
case 3:
i.badgeShape = "Square";
break;
case 4:
i.badgeShape = "Square";
break;
case 5:
i.badgeShape = "Square";
break;
case 6:
i.badgeShape = "Square";
break;
case 7:
i.badgeShape = "Square";
break;
case 8:
i.badgeShape = "Circle";
break;
case 9:
i.badgeShape = "Hidden";
break;
}
let k = b.getDataLegendAxisLabelFromCursorPosition(e.x, e.y);
if (k != null) {
{
i.axisLabel = k.toString();
}
}
if (b.title != null) {
i.seriesTitle = b.title.toString();
if (!stringEndsWith(i.seriesTitle, ":")) {
i.seriesTitle += ":";
}
}
for (let l of fromEnum(f.e)) {
i.valueNames.add(l.q);
i.seriesValues.add(l.l);
}
return i;
}
e(a, b) {
let c = a.dw;
b.width = c.bb;
b.height = c.ba;
b.contentArea = RectData.b(c.ff());
b.centralArea = new RectData(c.a7, 0, c.bb - (c.a7 + c.a8), c.ba - (c.a9 + c.a6));
b.plotArea = RectData.b(a.y9);
}
f(a, b) {
let c = VisualExportHelper.a(a);
return c;
}
d(a, b) {
let c = a.dw;
let d = null;
b.title = null;
b.subtitle = null;
let e = c.fp();
let f = 0;
let g = 0;
if (c.ez != null) {
d = c.v();
let h = this.b(c, c.ez, d);
let i = { $type: Point_$type, x: 0, y: 0 };
g = c.ez.l + e.bottom + e.top;
let j = new ChartTitleVisualData();
let k = c.ff();
j.viewport = new RectData(k.left, k.top, k.width, g);
j.textPlotArea = RectData.b(this.f(c.ez, a));
j.textPlotArea = new RectData(c.ez.n, c.ez.o, c.ez.m, c.ez.l);
f = j.height;
j.appearance = AppearanceHelper.c(c.ez, h);
let l = c.fp();
j.appearance.marginTop = l.top;
j.appearance.marginLeft = l.left;
j.appearance.marginRight = l.right;
j.appearance.marginBottom = l.bottom;
let m = c.e1();
j.appearance.horizontalAlignment = EnumUtil.getName(HorizontalAlignment_$type, m);
b.title = j;
}
if (c.ey != null) {
d = c.u();
let n = this.b(c, c.ey, d);
let o = { $type: Point_$type, x: 0, y: f };
let p = c.fo();
let q = c.ey.l + p.bottom + p.top;
let r = new ChartTitleVisualData();
let s = c.ff();
r.viewport = new RectData(s.left, s.top + g, s.width, q);
r.textPlotArea = RectData.b(this.f(c.ey, a));
r.appearance = AppearanceHelper.c(c.ey, n);
let t = c.fo();
r.appearance.marginTop = t.top;
r.appearance.marginLeft = t.left;
r.appearance.marginRight = t.right;
r.appearance.marginBottom = t.bottom;
let u = c.e0();
r.appearance.horizontalAlignment = EnumUtil.getName(HorizontalAlignment_$type, u);
b.subtitle = r;
}
}
b(a, b, c) {
return FontUtil.getFontInfo(a.j.ae, b, c);
}
}
DataChartVisualDataManager.$t = markType(DataChartVisualDataManager, 'DataChartVisualDataManager', Base.$, [IDataChartVisualDataManager_$type]);
return DataChartVisualDataManager;
})();