igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
299 lines (298 loc) • 10.7 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, typeCast, markType, getInstanceType } from "igniteui-react-core";
import { ISeriesVisualDataManager_$type } from "./ISeriesVisualDataManager";
import { StackedSeriesVisualData } from "./StackedSeriesVisualData";
import { SeriesVisualData } from "./SeriesVisualData";
import { MarkerVisualData } from "./MarkerVisualData";
import { RectData } from "igniteui-react-core";
import { PrimitiveAppearanceData } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
import { Color } from "igniteui-react-core";
import { ColorData } from "igniteui-react-core";
import { AppearanceHelper } from "igniteui-react-core";
import { PathVisualData } from "igniteui-react-core";
import { PolygonVisualData } from "igniteui-react-core";
import { PolyLineVisualData } from "igniteui-react-core";
import { RectangleVisualData } from "igniteui-react-core";
import { PointerTooltipVisualData } from "./PointerTooltipVisualData";
import { CalloutVisualData } from "./CalloutVisualData";
import { LineVisualData } from "igniteui-react-core";
/**
* @hidden
*/
export let SeriesVisualDataManager = /*@__PURE__*/ (() => {
class SeriesVisualDataManager extends Base {
addSubSeriesVisualData(a, b) {
let c = a;
let d = b;
c.fragmentSeries.add(d);
}
addSubSeriesLayerVisualData(a, b) {
let c = a;
let d = b;
c.layers.add(d);
}
copyVisualData(a, b) {
let c = a;
let d = b;
for (let e of fromEnum(d.shapes)) {
c.shapes.add(e);
}
for (let f of fromEnum(d.markerShapes)) {
c.markerShapes.add(f);
}
c.pixels = d.pixels;
c.pixelWidth = d.pixelWidth;
}
createFragmentVisualData(a, b, c, d) {
let e = new SeriesVisualData();
e.viewport = RectData.b(b);
e.type = c;
e.name = d;
return e;
}
exportMarkerVisualData(a, b) {
let c = b;
a.xh.cw((d) => {
let e = this.getMarkerVisualData(a, d, a.yc);
c.markerShapes.add(typeCast(MarkerVisualData.$, e));
});
}
getMarkerVisualData(a, b, c) {
let d = new MarkerVisualData();
let e = new PrimitiveAppearanceData();
d.x = b.n;
d.y = b.o;
d.bounds = new RectData(b.n - (b.m / 2), b.o - (b.l / 2), b.m, b.l);
e.fill = ColorData.a_1(Color.u(0, 0, 0, 0));
e.stroke = ColorData.a_1(Color.u(0, 0, 0, 0));
d.index = -1;
d.contentTemplate = b.ah;
if (b.content != null && typeCast(DataContext.$, b.content) !== null && b._visibility == 0) {
let f = b.content;
e.fill = AppearanceHelper.b(f.actualItemBrush);
e.fillExtended = AppearanceHelper.a(f.actualItemBrush);
e.stroke = AppearanceHelper.b(f.outline);
e.strokeExtended = AppearanceHelper.a(f.outline);
e.strokeThickness = a.ip();
if (f.item != null) {
d.index = a.dp.indexOf(f.item);
}
}
e.isVisible = b._visibility == 0;
d.isVisible = b._visibility == 0;
d.markerAppearance = e;
d.markerType = this.a(a, c);
return d;
}
a(a, b) {
if (b == a.dc.te) {
return "Circle";
}
else if (b == a.dc.tf) {
return "Diamond";
}
else if (b == a.dc.tg) {
return "Hexagon";
}
else if (b == a.dc.th) {
return "Hexagram";
}
else if (b == a.dc.ti) {
return "Pentagon";
}
else if (b == a.dc.tj) {
return "Pentagram";
}
else if (b == a.dc.tk) {
return "Pyramid";
}
else if (b == a.dc.tl) {
return "Square";
}
else if (b == a.dc.tm) {
return "Tetragram";
}
else if (b == a.dc.tn) {
return "Triangle";
}
else {
return "None";
}
}
exportMarkerVisualDataFromMarker(a, b, c) {
let d = b;
let e = new MarkerVisualData();
let f = new PrimitiveAppearanceData();
e.x = c.n;
e.y = c.o;
e.bounds = new RectData(c.n - (c.m / 2), c.o - (c.l / 2), c.m, c.l);
e.index = -1;
e.contentTemplate = c.ah;
if (typeCast(DataContext.$, c.content) !== null) {
let g = c.content;
f.fill = AppearanceHelper.b(g.actualItemBrush);
f.stroke = AppearanceHelper.b(g.outline);
}
e.isVisible = c._visibility == 0;
e.markerAppearance = f;
if (c.ah == a.dc.te) {
e.markerType = "Circle";
}
else if (c.ah == a.dc.tf) {
e.markerType = "Diamond";
}
else if (c.ah == a.dc.tg) {
e.markerType = "Hexagon";
}
else if (c.ah == a.dc.th) {
e.markerType = "Hexagram";
}
else if (c.ah == a.dc.ti) {
e.markerType = "Pentagon";
}
else if (c.ah == a.dc.tj) {
e.markerType = "Pentagram";
}
else if (c.ah == a.dc.tk) {
e.markerType = "Pyramid";
}
else if (c.ah == a.dc.tl) {
e.markerType = "Square";
}
else if (c.ah == a.dc.tm) {
e.markerType = "Tetragram";
}
else if (c.ah == a.dc.tn) {
e.markerType = "Triangle";
}
else {
e.markerType = "None";
}
d.markerShapes.add(e);
}
exportPathData(a, b, c, d) {
let e = a;
let f = new PathVisualData(1, c, b);
if (d != null) {
for (let g = 0; g < d.length; g++) {
f.tags.add(d[g]);
}
}
e.shapes.add(f);
}
exportPolygonData(a, b, c, d) {
let e = a;
let f = new PolygonVisualData(1, c, b);
if (d != null) {
for (let g = 0; g < d.length; g++) {
f.tags.add(d[g]);
}
}
e.shapes.add(f);
}
exportPolylineData(a, b, c, d) {
let e = a;
let f = new PolyLineVisualData(1, c, b);
if (d != null) {
for (let g = 0; g < d.length; g++) {
f.tags.add(d[g]);
}
}
e.shapes.add(f);
}
exportRectangleData(a, b, c, d) {
let e = a;
let f = new RectangleVisualData(1, c, b);
if (d != null) {
for (let g = 0; g < d.length; g++) {
f.tags.add(d[g]);
}
}
e.shapes.add(f);
}
exportStackedVisualData(a, b) {
let c = new StackedSeriesVisualData();
c.viewport = RectData.b(b);
c.type = getInstanceType(a).typeName;
c.name = a.name;
return c;
}
exportTrendlineData(a, b, c) {
let d = b;
let e = new PolyLineVisualData(1, "trendLine", c);
e.tags.add("Trend");
d.shapes.add(e);
}
exportVisualData(a, b) {
let c = new SeriesVisualData();
c.viewport = RectData.b(b);
c.type = this.b(getInstanceType(a).typeName);
c.name = a.name;
c.opacity = a._opacity;
return c;
}
exportSeriesPixelsData(a, b, c, d) {
let e = a;
e.pixels = b;
e.pixelWidth = c;
e.pixelHeight = d;
}
b(a) {
return a;
}
addPointerTooltipData(a, b, c, d, e) {
if (b == null) {
return;
}
let f = a;
let g = b;
g.offsetX = c;
g.offsetY = d;
g.categoryNames = e;
f.pointerTooltips.add(g);
}
addPointerTooltipWithDataLegend(a, b, c, d, e) {
if (b == null) {
return;
}
let f = a;
let g = b;
g.offsetX = c;
g.offsetY = d;
g.content = e;
f.pointerTooltips.add(g);
}
exportPointerTooltipData(a, b, c, d) {
let e = new PointerTooltipVisualData();
e.pointerFillShape = new PolygonVisualData(1, "fillShape", a);
e.pointerOutlineShape = new PolyLineVisualData(1, "outlineShape", b);
e.boxShape = new RectangleVisualData(1, "boxShape", c);
e.viewport = RectData.b(d);
return e;
}
exportCalloutData(a, b, c, d, e, f, g, h, i, j, k) {
let l = new CalloutVisualData();
l.left = a;
l.top = b;
l.marginLeft = c;
l.marginTop = d;
l.background = new RectangleVisualData(1, "calloutBackground", f);
l.text = AppearanceHelper.c(g, h);
l.line = new LineVisualData(1, "calloutLeaderLine", i);
e.calloutShapes.add(l);
}
exportLayerVisualData(a, b) {
for (let c = 0; c < a.actualLayers.count; c++) {
b.layers.add1(a.actualLayers._inner[c].target.kq());
}
}
}
SeriesVisualDataManager.$t = /*@__PURE__*/ markType(SeriesVisualDataManager, 'SeriesVisualDataManager', Base.$, [ISeriesVisualDataManager_$type]);
return SeriesVisualDataManager;
})();