UNPKG

igniteui-react-charts

Version:

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

181 lines (180 loc) 7.94 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 { Base, EnumUtil, fromEnum, markType, getInstanceType } from "igniteui-react-core"; import { IAxisVisualDataManager_$type } from "./IAxisVisualDataManager"; import { TextBlock } from "igniteui-react-core"; import { VisualExportHelper } from "./VisualExportHelper"; import { ChartTitleVisualData } from "./ChartTitleVisualData"; import { HorizontalAlignment_$type } from "igniteui-react-core"; import { VerticalAlignment_$type } from "igniteui-react-core"; import { AxisTitlePosition_$type } from "./AxisTitlePosition"; import { RectData } from "igniteui-react-core"; import { AppearanceHelper } from "igniteui-react-core"; import { AxisVisualData } from "./AxisVisualData"; import { PathVisualData } from "igniteui-react-core"; import { List$1 } from "igniteui-react-core"; import { RectangleVisualData } from "igniteui-react-core"; import { AxisLabelVisualData } from "./AxisLabelVisualData"; import { PointData } from "igniteui-react-core"; import { Size } from "igniteui-react-core"; import { SizeData } from "igniteui-react-core"; import { FontUtil } from "igniteui-react-core"; /** * @hidden */ export let AxisVisualDataManager = /*@__PURE__*/ (() => { class AxisVisualDataManager extends Base { c(a) { return a; } d(a, b) { let c = VisualExportHelper.a(b); return c; } a(a, b, c, d) { let e = new ChartTitleVisualData(); let f = a.bp; let g = f.bl(); e.viewport = RectData.b(g); let h = this.d(a, d); e.textPlotArea = RectData.b(h); let i = d._visibility == 0 && d.x != null; let j = a.a1.ag.e(); let k = f.bs(d); let l = this.b(a, d, j); let m = AppearanceHelper.c(d, l); m.marginLeft = k.left; m.marginRight = k.right; m.marginTop = k.top; m.marginBottom = k.bottom; m.fontStretch = "Normal"; m.textWrapping = "Wrap"; m.visibility = i; if (a.b4 != null) { m.horizontalAlignment = EnumUtil.getName(HorizontalAlignment_$type, a.b4.horizontalAlignment); m.verticalAlignment = EnumUtil.getName(VerticalAlignment_$type, a.b4.verticalAlignment); m.textPosition = EnumUtil.getName(AxisTitlePosition_$type, a.b4.position); } else { m.horizontalAlignment = EnumUtil.getName(HorizontalAlignment_$type, (0)); m.verticalAlignment = EnumUtil.getName(VerticalAlignment_$type, (1)); m.textPosition = EnumUtil.getName(AxisTitlePosition_$type, (0)); } e.appearance = m; return e; } exportVisualData(a) { let b = new AxisVisualData(); b.viewport = RectData.b(a.o8); b.labelsViewport = RectData.b(a.bp.bl()); b.type = this.c(getInstanceType(a).typeName); b.name = a.name; let c = new PathVisualData(1, "axisLine", a.bp.bm); b.axisLine = c; b.tickMarks = new PathVisualData(1, "tickMarks", a.a1.ag.aw); if (!a.a1.ab.contains(a.a1.ag.aw)) { b.tickMarks.data.clear(); } b.minorLines = new PathVisualData(1, "minorLines", a.bp.bo); b.majorLines = new PathVisualData(1, "majorLines", a.bp.bn); b.strips = new PathVisualData(1, "strips", a.bp.bp); if (a.j5 != null) { let d = this.a(a, a.b7, b.type, a.mi); b.title = d; } else { b.title = null; } let e = a.b7.getFontInfo(); if (a.a4 != null && a.a4.textStyle != null) { e = a.a4.h(a.b7.dw.j.ae); } let f, g, h, i; let j = a.a1.ag.aw.an.d; if (1 < j.count) { for (let k = 1; k < j.count; k++) { let l = j._inner[k]; let m = j._inner[k - 1]; f = l.d.x - l.c.x; g = l.d.y - l.c.y; h = m.d.x - m.c.x; i = m.d.y - m.c.y; if (1 == k) { b.tickMarksLength = Math.sqrt(Math.pow(f, 2) + Math.pow(g, 2)); } } } let n = a.a1.bh; let o = a.a1.ag.h(); if (n.count > 0) { for (let p = 0; p < n.count; p++) { let q = a.a1.bh._inner[p]; let r = a.a1.bg._inner[p]; let s = ((() => { let $ret = new AxisLabelVisualData(); $ret.labelPosition = q.h; $ret.labelValue = r; $ret.panelPosition = PointData.b(a.bp.bi()); return $ret; })()); let t = new List$1(TextBlock.$, 0); for (let u of fromEnum(o)) { t.add(u); } if (p < t.count) { let v = this.b(a, t._inner[p], e); s.appearance = AppearanceHelper.c(t._inner[p], v); s.position = PointData.b(a.bp.bh(t._inner[p])); s.chartPosition = PointData.b(a.bp.bg(t._inner[p])); s.size = SizeData.b(new Size(1, t._inner[p].m, t._inner[p].l)); let w = a.bp.a(t._inner[p]); s.anchors = new Array(w.length); if (w.length > 0) { for (let x = 0; x < w.length; x++) { s.anchors[x] = PointData.b(w[x]); } } } b.labels.add(s); } } let y = null; if (a.cf.a.count > 0) { for (let z = 0; z < a.cf.a.count; z++) { if (y == null) { y = new List$1(RectangleVisualData.$, 0); } let aa = new RectangleVisualData(1, "annotationBacking_" + z, a.cf.item(z)); aa.appearance.canvasLeft = a.cf.item(z).n; aa.appearance.canvasTop = a.cf.item(z).o; y.add(aa); } } b.annotationBackings = y; let ab = null; if (a.cg.a.count > 0) { ab = new List$1(RectangleVisualData.$, 0); for (let ac = 0; ac < a.cg.a.count; ac++) { let ad = a.cg.item(ac); let ae; let af = a.cg.item(ac).ag.g; ae = new RectangleVisualData(1, "annotationBadge_" + ac, af); ae.appearance.canvasLeft = af.n; ae.appearance.canvasTop = af.o; ab.add(ae); } } b.annotationBadges = ab; return b; } b(a, b, c) { return FontUtil.getFontInfo(a.b7.dw.j.ae, b, c); } } AxisVisualDataManager.$t = /*@__PURE__*/ markType(AxisVisualDataManager, 'AxisVisualDataManager', Base.$, [IAxisVisualDataManager_$type]); return AxisVisualDataManager; })();