UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

265 lines (264 loc) 8.49 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 { LegendBase } from "./LegendBase"; import { IChartScaleLegend_$type } from "igniteui-angular-core"; import { TextBlock } from "igniteui-angular-core"; import { LegendBaseView } from "./LegendBaseView"; import { typeCast, markType, runOn, Point_$type } from "igniteui-angular-core"; import { Color } from "igniteui-angular-core"; import { Brush } from "igniteui-angular-core"; import { ColorUtil } from "igniteui-angular-core"; import { Shape } from "igniteui-angular-core"; import { GradientData } from "./GradientData"; import { Size } from "igniteui-angular-core"; import { Polygon } from "igniteui-angular-core"; import { GradientStopData } from "./GradientStopData"; import { IInternalLegendOwner_$type } from "igniteui-angular-core"; import { Rect } from "igniteui-angular-core"; /** * @hidden */ export let ScaleLegend = /*@__PURE__*/ (() => { class ScaleLegend extends LegendBase { constructor() { super(); this.bl = null; this.bn = 0; this.bm = 0; this.bj = null; this.ab = ScaleLegend.$; } aj() { return new ScaleLegendView(this); } bd(a) { super.bd(a); this.bl = a; } get legendScaleElement() { return this.bl.be; } get minText() { return this.bl.ba; } get maxText() { return this.bl.a9; } get bk() { return this.bj; } set bk(a) { this.bj = a; } bq() { this.bl.a6(); } restoreOriginalState() { this.bq(); } bt(a) { if (a == null) { return this.bl.bd(); } return ColorUtil.w(a); } bo(a) { this.bk = a; this.bp(); } initializeLegend(a) { this.bo(a); } get_isScale() { return true; } bp() { if (this.legendScaleElement == null || this.bk == null || !this.bk.legendReady) { return; } if (this.bk == null || !this.bk.isAttachedTo(this)) { return; } let a = false; let b = typeCast(Shape.$, this.legendScaleElement); if (b != null) { let c = this.bl.a0(); if (!this.bk.forScaleColors((d, e) => this.bl.a2(c, this.bt(d), e))) { a = true; } this.bl.a7(b, a, c); } if (this.minText != null) { this.minText.al = this.bk.minScaleText; } if (this.maxText != null) { this.maxText.al = this.bk.maxScaleText; } } } ScaleLegend.$t = markType(ScaleLegend, 'ScaleLegend', LegendBase.$, [IChartScaleLegend_$type]); return ScaleLegend; })(); /** * @hidden */ export let ScaleLegendView = /*@__PURE__*/ (() => { class ScaleLegendView extends LegendBaseView { constructor(a) { super(a); this.at = null; this.be = null; this.ba = null; this.a9 = null; this.as = null; this.au = null; this.bf = new Size(); this.av = false; this.aw = 0; this.bc = null; this.bb = null; this.at = a; this.ba = new TextBlock(); this.a9 = new TextBlock(); this.be = new Polygon(); } a6() { } aa() { } bd() { return Color.u(0, 0, 0, 0); } a0() { return new GradientData(); } a2(a, b, c) { let d = a; d.a.add(((() => { let $ret = new GradientStopData(); $ret.b = ((() => { let $ret = new Brush(); $ret.color = b; return $ret; })()); $ret.a = c; return $ret; })())); } a7(a, b, c) { if (b) { this.bb = this.at.bk.actualMarkerBrush; this.as = null; } else { this.bb = null; this.as = c; this.as.b(); } this.a3(); } aj(a) { super.aj(a); this.au = this.d.b(a); this.bf = this.d.ai(); this.a3(); } a3() { if (!this.av) { this.av = true; if (this.d.h != null) { this.d.h.setTimeout(runOn(this, this.a8), 0); } else { window.setTimeout(runOn(this, this.a8), 0); } } } a8() { if (this.av) { this.av = false; this.a5(); } } a5() { if (this.au == null) { return; } this.a4(); } ay(a) { let b = typeCast(TextBlock.$, a); if (b != null && b.al != null) { return this.au.f(b) + 0; } return 0; } ax(a) { return this.aw + 0; } a4() { if (this.at.bk == null || this.at.bk.container == null || (this.as == null && this.bb == null)) { return; } if (this.au.d) { let a = typeCast(IInternalLegendOwner_$type, this.at.bk.container); this.au.af(a.getFontInfo()); this.aw = a.getFontHeight(); this.bc = a.getFontBrush(); let b = this.ay(this.ba); let c = this.ay(this.a9); let d = Math.max(b, c) + 4; if (d >= this.bf.width) { d = 0; } let e = this.bf.width - d; let f = 2; let g = 2; e = e - 4; let h = this.bf.height - 4; let i = f + e + 4; let j = g; let k = h; let l = { $type: Point_$type, x: f + (3 / 5) * e, y: g }; let m = { $type: Point_$type, x: f + (5 / 5) * e, y: g }; let n = { $type: Point_$type, x: f + (5 / 5) * e, y: h }; let o = { $type: Point_$type, x: f, y: h }; let p = this.be; p.an.clear(); p.an.add(l); p.an.add(m); p.an.add(n); p.an.add(o); this.ba.n = i; this.ba.o = j; this.ba.ao = this.bc; this.a9.n = i; this.a9.o = j + k - (this.ax(this.ba)); this.a9.ao = this.bc; if (!this.au.e) { this.au.l(0, 0, this.bf.width, this.bf.height); } if (this.as == null && this.bb != null) { p._fill = this.bb; this.au.u(p); } else { this.d.ab(this.au, p, this.as, new Rect(0, g, f, e, h)); } if (d > 0) { this.au.x(this.ba); this.au.x(this.a9); } } } am() { super.am(); } } ScaleLegendView.$t = markType(ScaleLegendView, 'ScaleLegendView', LegendBaseView.$); return ScaleLegendView; })();