UNPKG

igniteui-angular-charts

Version:

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

2,955 lines 108 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, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, Array_$type, enumGetBox, EnumUtil, typeGetValue, Number_$type, String_$type, fromEnum, typeCast, Date_$type, markDep, runOn, TypeRegistrar } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { DataAbbreviationMode_$type } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { FontInfo } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { stringIsNullOrEmpty, stringEmpty, stringContains } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { LegendItemBadgeShape_$type } from "igniteui-angular-core";
import { Control } from "igniteui-angular-core";
import { IDataLegend_$type } from "igniteui-angular-core";
import { IOnDemandRender_$type } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { DataLegendValueMode_$type } from "igniteui-angular-core";
import { FontUtil } from "igniteui-angular-core";
import { DataLegendHeaderDateMode_$type } from "igniteui-angular-core";
import { DataLegendHeaderTimeMode_$type } from "igniteui-angular-core";
import { DataLegendSummaryType_$type } from "igniteui-angular-core";
import { DataLegendUnitsMode_$type } from "igniteui-angular-core";
import { DataLegendLabelMode_$type } from "igniteui-angular-core";
import { DataLegendLayoutMode_$type } from "igniteui-angular-core";
import { BindingFormatter } from "igniteui-angular-core";
import { DataLegendVisualData } from "./DataLegendVisualData";
import { Extensions } from "igniteui-angular-core";
import { TextBlock } from "igniteui-angular-core";
import { DataLegendVisualDataRow } from "./DataLegendVisualDataRow";
import { DataLegendVisualDataColumn } from "./DataLegendVisualDataColumn";
import { ILegendContext_$type } from "igniteui-angular-core";
import { AppearanceHelper } from "igniteui-angular-core";
import { RectData } from "igniteui-angular-core";
import { PrimitiveAppearanceData } from "igniteui-angular-core";
import { FrameworkElement } from "igniteui-angular-core";
import { DataLegendSummaryEventArgs } from "./DataLegendSummaryEventArgs";
import { DataLegendSummaryCalculationTotal } from "./DataLegendSummaryCalculationTotal";
import { DataLegendSummaryCalculationAverage } from "./DataLegendSummaryCalculationAverage";
import { DataLegendSummaryCalculationMin } from "./DataLegendSummaryCalculationMin";
import { DataLegendSummaryCalculationMax } from "./DataLegendSummaryCalculationMax";
import { DataLegendSummaryCalculationEmpty } from "./DataLegendSummaryCalculationEmpty";
import { DataLegendStylingRowEventArgs } from "./DataLegendStylingRowEventArgs";
import { DataLegendStylingColumnEventArgs } from "./DataLegendStylingColumnEventArgs";
import { Dictionary$2 } from "igniteui-angular-core";
import { IDataLegendSeries_$type } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { DataLegendSeriesGroupInfo } from "./DataLegendSeriesGroupInfo";
import { RenderingContext } from "igniteui-angular-core";
import { DataLegendRenderContext } from "./DataLegendRenderContext";
import { Pool$1 } from "igniteui-angular-core";
import { ContentControl } from "igniteui-angular-core";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendColumn } from "./DataLegendColumn";
import { DataLegendSummaryColumn } from "igniteui-angular-core";
import { DataAbbreviator } from "./DataAbbreviator";
import { NumberFormatSpecifier } from "igniteui-angular-core";
import { DateTimeFormatSpecifier } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, isInfinity, truncate } from "igniteui-angular-core";
import { EventProxy } from "igniteui-angular-core";
import { Tuple$2 } from "igniteui-angular-core";
import { CanvasScalingHelpers } from "igniteui-angular-core";
import { CanvasViewRenderer } from "igniteui-angular-core";
import { DataTemplatePassInfo } from "igniteui-angular-core";
import { Rectangle } from "igniteui-angular-core";
import { DataTemplateMeasureInfo } from "igniteui-angular-core";
import { DataTemplateRenderInfo } from "igniteui-angular-core";
import { FontDefaults } from "igniteui-angular-core";
/**
 * @hidden
 */
export let DataLegendContent = /*@__PURE__*/ (() => {
    class DataLegendContent extends Base {
        constructor() {
            super(...arguments);
            this.a = new List$1(DataLegendRowInfo.$, 0);
            this.d = 0;
            this.c = 0;
        }
        get b() {
            return this.a;
        }
        f() {
            this.b.clear();
        }
        e(a) {
            this.b.add(a);
        }
    }
    DataLegendContent.$t = markType(DataLegendContent, 'DataLegendContent');
    return DataLegendContent;
})();
/**
 * @hidden
 */
export let DataLegendRowBase = /*@__PURE__*/ (() => {
    class DataLegendRowBase extends Base {
        constructor(a, b, c, d, e) {
            super();
            this.g = 0;
            this.c = false;
            this.e = false;
            this.a = false;
            this.b = false;
            this.d = false;
            this.f = false;
            this.g = e;
            this.e = b;
            this.b = c;
            this.a = d;
            this.d = !c && !b && !d;
            this.c = true;
            this.f = false;
        }
    }
    DataLegendRowBase.$t = markType(DataLegendRowBase, 'DataLegendRowBase');
    return DataLegendRowBase;
})();
/**
 * @hidden
 */
export let DataLegendRowCell = /*@__PURE__*/ (() => {
    class DataLegendRowCell extends DataLegendRowBase {
        constructor(a, b, c, d, e) {
            super(a, b, c, d, e);
            this.u = 0;
            this.h = 0;
            this.t = 0;
            this.y = null;
            this.x = null;
            this.v = null;
            this.z = null;
            this.w = null;
            this.ab = null;
            this.ac = null;
            this.ad = null;
            this.i = null;
            this.k = null;
            this.j = null;
            this.an = null;
            this.ap = null;
            this.ao = null;
            this.ai = new Size();
            this.am = new Size();
            this.ak = new Size();
            this.o = false;
            this.l = false;
            this.ae = null;
            this.ag = null;
            this.af = null;
            this.ah = new Size();
            this.al = new Size();
            this.aj = new Size();
            this.t = NaN;
            this.an = new Thickness(0, 0);
            this.ap = new Thickness(0, 0);
            this.ao = new Thickness(0, 0);
            this.ai = new Size(1, 0, 0);
            this.am = new Size(1, 0, 0);
            this.ak = new Size(1, 0, 0);
            this.o = true;
            this.l = true;
            if (this.d) {
                this.ab = a.bw();
                this.ad = a.by();
                this.ac = a.bx();
                this.i = a.l();
                this.k = a.p();
                this.j = a.o();
            }
            else if (this.e) {
                let f = a.bv();
                let g = a.m();
                this.ab = f;
                this.ad = f;
                this.ac = f;
                this.i = g;
                this.k = g;
                this.j = g;
            }
            else if (this.a) {
                let h = a.bs();
                let i = a.j();
                this.ab = h;
                this.ad = h;
                this.ac = h;
                this.i = i;
                this.k = i;
                this.j = i;
            }
            else {
                let j = a.bt();
                let k = a.k();
                this.ab = j;
                this.ad = j;
                this.ac = j;
                this.i = k;
                this.k = k;
                this.j = k;
            }
            this.ae = Rect.empty;
            this.ag = Rect.empty;
            this.af = Rect.empty;
        }
        m() {
            return this.ai.width > 0 && this.ai.height > 0;
        }
        p() {
            return this.ak.width > 0 && this.ak.height > 0;
        }
        r() {
            return this.am.width > 0 && this.am.height > 0;
        }
        n() {
            return this.v != null;
        }
        q() {
            return this.w != null;
        }
        s() {
            return !stringIsNullOrEmpty(this.z) && this.am.width > 0 && this.am.height > 0;
        }
        aa() {
            this.ah = new Size(1, 0, 0);
            this.al = new Size(1, 0, 0);
            this.aj = new Size(1, 0, 0);
        }
    }
    DataLegendRowCell.$t = markType(DataLegendRowCell, 'DataLegendRowCell', DataLegendRowBase.$);
    return DataLegendRowCell;
})();
/**
 * @hidden
 */
export let DataLegendRowInfo = /*@__PURE__*/ (() => {
    class DataLegendRowInfo extends DataLegendRowBase {
        constructor(a, b, c, d, e) {
            super(a, b, c, d, e);
            this.m = null;
            this.l = false;
            this.q = null;
            this.h = null;
            this.i = null;
            this.r = null;
            this.u = null;
            this.k = null;
            this.y = new Size();
            this.ab = null;
            this.p = null;
            this.t = null;
            this.x = new Size();
            this.n = null;
            this.j = 0;
            this.o = null;
            this.aa = null;
            this.z = null;
            this.v = null;
            this.w = null;
            this.h = new Array(0);
            this.m = new List$1(DataLegendRowCell.$, 0);
            this.l = this.d;
            this.aa = new Thickness(0, 0);
            this.z = new Thickness(0, 0);
            this.ab = new Thickness(0, 0);
            this.x = new Size(1, 0, 0);
            this.y = new Size(1, 0, 0);
            if (this.d) {
                this.u = a.bw();
                this.k = a.n();
            }
            else if (this.e) {
                let f = a.bv();
                let g = a.m();
                this.u = f;
                this.k = g;
            }
            else if (this.a) {
                let h = a.bs();
                let i = a.j();
                this.u = h;
                this.k = i;
            }
            else {
                let j = a.bt();
                let k = a.k();
                this.u = j;
                this.k = k;
            }
            this.w = Rect.empty;
            this.v = Rect.empty;
            this.j = 7;
            this.o = "None";
        }
        s(a) {
            if (this.m == null) {
                return;
            }
            for (let b = 0; b < this.m.count; b++) {
                a(this.m._inner[b]);
            }
        }
    }
    DataLegendRowInfo.$t = markType(DataLegendRowInfo, 'DataLegendRowInfo', DataLegendRowBase.$);
    return DataLegendRowInfo;
})();
/**
 * @hidden
 */
export let XamDataLegend = /*@__PURE__*/ (() => {
    class XamDataLegend extends Control {
        constructor() {
            super();
            this.b0 = false;
            this.cn = NaN;
            this.co = NaN;
            this.cp = 1;
            this.jt = new Thickness(0, 0);
            this.i9 = BrushUtil.j(0, 255, 255, 255);
            this.i8 = BrushUtil.j(0, 255, 255, 255);
            this.b1 = false;
            this.bm = null;
            this.be = null;
            this.bd = null;
            this.bh = null;
            this.bj = null;
            this.bg = null;
            this.bi = null;
            this.a9 = null;
            this.bl = null;
            this.bk = null;
            this.b7 = false;
            this.bf = null;
            this.cq = NaN;
            this.calculateColumnSummary = null;
            this.styleHeaderRow = null;
            this.styleGroupRow = null;
            this.styleSeriesRow = null;
            this.styleSummaryRow = null;
            this.styleSeriesColumn = null;
            this.styleSummaryColumn = null;
            this.propertyChanged = null;
            this.ce = null;
            this.cd = null;
            this.ch = null;
            this.cg = null;
            this.a7 = null;
            this.jm = null;
            this._externalObject = null;
            this.by = false;
            this.bz = false;
            this.cm = null;
            this.cf = new Dictionary$2(String_$type, DataLegendSeriesGroupInfo.$, 0);
            this.cj = new List$1(String_$type, 0);
            this.ao = new DataLegendContent();
            this.cy = 0;
            this.ak = null;
            this.al = null;
            this.c4 = "";
            this.ai = null;
            this.aj = null;
            this.jm = Rect.empty;
            this.b1 = true;
            this.ab = XamDataLegend.$;
            this.gt();
            this.gu();
            this.gv();
            this.a7 = this.a6();
        }
        get cr() {
            return this.cn;
        }
        set cr(a) {
            let b = this.cn;
            this.cn = a;
            if (b != this.cn) {
                this.gj("ActualCursorPositionX", b, this.cn);
            }
        }
        get cs() {
            return this.co;
        }
        set cs(a) {
            let b = this.co;
            this.co = a;
            if (b != this.co) {
                this.gj("ActualCursorPositionY", b, this.co);
            }
        }
        get ct() {
            return this.cp;
        }
        set ct(a) {
            let b = this.cp;
            this.cp = a;
            this.gj("ActualPixelScalingRatio", b, this.cp);
        }
        gv() {
            if (isNaN_(this.cw)) {
                this.jr = this.jt;
            }
            else {
                if (this.cw > 0) {
                    this.jr = new Thickness(0, this.cw);
                }
                else {
                    this.jr = this.jt;
                }
            }
        }
        gu() {
            if (this.i7 == null) {
                this.i5 = this.i9;
            }
            else {
                this.i5 = this.i7;
            }
        }
        gt() {
            if (this.i6 == null) {
                this.i4 = this.i8;
            }
            else {
                this.i4 = this.i6;
            }
        }
        get bx() {
            return this.bm;
        }
        set bx(a) {
            let b = this.bm;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.p();
            }
            this.bm = a;
            if (b != this.bm) {
                this.gj("ValueTextStyle", b, this.bm);
            }
        }
        get bp() {
            return this.be;
        }
        set bp(a) {
            let b = this.be;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.k();
            }
            this.be = a;
            if (b != this.be) {
                this.gj("HeaderTextStyle", b, this.be);
            }
        }
        get bo() {
            return this.bd;
        }
        set bo(a) {
            let b = this.bd;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.j();
            }
            this.bd = a;
            if (b != this.bd) {
                this.gj("GroupTextStyle", b, this.bd);
            }
        }
        get bs() {
            return this.bh;
        }
        set bs(a) {
            let b = this.bh;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.m();
            }
            this.bh = a;
            if (b != this.bh) {
                this.gj("SummaryTitleTextStyle", b, this.bh);
            }
        }
        get bu() {
            return this.bj;
        }
        set bu(a) {
            let b = this.bj;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.p();
            }
            this.bj = a;
            if (b != this.bj) {
                this.gj("SummaryValueTextStyle", b, this.bj);
            }
        }
        get br() {
            return this.bg;
        }
        set br(a) {
            let b = this.bg;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.l();
            }
            this.bg = a;
            if (b != this.bg) {
                this.gj("SummaryLabelTextStyle", b, this.bg);
            }
        }
        get bt() {
            return this.bi;
        }
        set bt(a) {
            let b = this.bi;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.o();
            }
            this.bi = a;
            if (b != this.bi) {
                this.gj("SummaryUnitsTextStyle", b, this.bi);
            }
        }
        get bw() {
            return this.bl;
        }
        set bw(a) {
            let b = this.bl;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.o();
            }
            this.bl = a;
            if (b != this.bl) {
                this.gj("UnitsTextStyle", b, this.bl);
            }
        }
        get bv() {
            return this.bk;
        }
        set bv(a) {
            let b = this.bk;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.n();
            }
            this.bk = a;
            if (b != this.bk) {
                this.gj("TitleTextStyle", b, this.bk);
            }
        }
        get bq() {
            return this.bf;
        }
        set bq(a) {
            let b = this.bf;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.l();
            }
            this.bf = a;
            if (b != this.bf) {
                this.gj("LabelTextStyle", b, this.bf);
            }
        }
        get pixelScalingRatio() {
            return this.cq;
        }
        set pixelScalingRatio(a) {
            let b = this.cq;
            this.cq = a;
            this.gj("PixelScalingRatio", b, this.cq);
        }
        exportSerializedVisualData() {
            let a = this.exportVisualData();
            return a.serialize();
        }
        cv(a, b) {
            let c = Math.max(b.left, a);
            let d = Math.max(b.right, a);
            let e = Math.max(b.right, a);
            return Math.min(b.top, a);
        }
        cu(a, b) {
            return Math.min(b.left, a);
        }
        jl(a, b) {
            let c = Rect.l_op_Equality(a, null) || a.isEmpty || !Extensions.b(a);
            let d = Rect.l_op_Equality(b, null) || b.isEmpty || !Extensions.b(b);
            if (c) {
                return b;
            }
            if (d) {
                return a;
            }
            if (c && c) {
                return Rect.empty;
            }
            let e = Math.min(a.top, b.top);
            let f = Math.min(a.left, b.left);
            let g = Math.max(a.right, b.right);
            let h = Math.max(a.bottom, b.bottom);
            return new Rect(0, f, e, g - f, h - e);
        }
        exportVisualData() {
            let a = new DataLegendVisualData();
            a.width = this.ao.d;
            a.height = this.ao.c;
            a.background = AppearanceHelper.b(this.i4);
            a.borderBrush = AppearanceHelper.b(this.i5);
            if (this.jr != null) {
                a.borderThicknessTop = this.jr.top;
                a.borderThicknessLeft = this.jr.left;
                a.borderThicknessRight = this.jr.right;
                a.borderThicknessBottom = this.jr.bottom;
            }
            if (this.a7 == null) {
                return a;
            }
            let b = -1;
            let c = -1;
            let d = -1;
            let e = -1;
            let f = this.a7.af;
            let g = this.a7.ad;
            let h = this.a7.ah;
            let i = this.a7.ag;
            if (Rect.l_op_Equality(this.jm, null) || this.jm.isEmpty) {
                a.viewport = null;
            }
            else {
                a.viewport = new RectData(0, 0, this.jm.width, this.jm.height);
            }
            for (let j = 0; j < this.ao.b.count; j++) {
                let k = this.ao.b._inner[j];
                let l = new DataLegendVisualDataRow();
                l.seriesIndex = k.g;
                l.rowMarginTop = k.aa.top;
                l.rowMarginBottom = k.aa.bottom;
                l.rowMarginRight = k.aa.right;
                l.rowMarginLeft = k.aa.left;
                let m = Rect.empty;
                if (k.c) {
                    if (Extensions.b(k.w) && f.count > (b + 1)) {
                        b++;
                        let n = f._inner[b];
                        let o = this.bn(n, k.k);
                        let p = new DataLegendVisualDataColumn();
                        p.bounds = RectData.b(k.w);
                        p.text = n.al;
                        p.textColor = AppearanceHelper.b(k.u);
                        p.marginTop = k.ab.top;
                        p.marginLeft = k.ab.left;
                        p.marginRight = k.ab.right;
                        p.marginBottom = k.ab.bottom;
                        this.gw(p, o);
                        l.columns.add(p);
                        m = this.jl(m, k.w);
                    }
                    for (let q of fromEnum(k.m)) {
                        if (Extensions.b(q.ae) && g.count > (c + 1)) {
                            c++;
                            let r = g._inner[c];
                            let s = this.bn(r, q.i);
                            let t = new DataLegendVisualDataColumn();
                            t.bounds = RectData.b(q.ae);
                            t.text = r.al;
                            t.textColor = AppearanceHelper.b(q.ab);
                            t.marginTop = q.an.top;
                            t.marginLeft = q.an.left;
                            t.marginRight = q.an.right;
                            t.marginBottom = q.an.bottom;
                            this.gw(t, s);
                            l.columns.add(t);
                            m = this.jl(m, q.ae);
                        }
                        if (Extensions.b(q.ag) && h.count > (d + 1)) {
                            d++;
                            let u = h._inner[d];
                            let v = this.bn(u, q.k);
                            let w = new DataLegendVisualDataColumn();
                            w.bounds = RectData.b(q.ag);
                            w.text = u.al;
                            w.textColor = AppearanceHelper.b(q.ad);
                            w.marginTop = q.ap.top;
                            w.marginLeft = q.ap.left;
                            w.marginRight = q.ap.right;
                            w.marginBottom = q.ap.bottom;
                            this.gw(w, v);
                            l.columns.add(w);
                            m = this.jl(m, q.ag);
                        }
                        if (Extensions.b(q.af) && i.count > (e + 1)) {
                            e++;
                            let x = i._inner[e];
                            let y = this.bn(x, q.j);
                            let z = new DataLegendVisualDataColumn();
                            z.bounds = RectData.b(q.af);
                            z.text = q.o ? q.w : null;
                            z.textColor = AppearanceHelper.b(q.ac);
                            z.marginTop = q.ao.top;
                            z.marginLeft = q.ao.left;
                            z.marginRight = q.ao.right;
                            z.marginBottom = q.ao.bottom;
                            this.gw(z, y);
                            l.columns.add(z);
                            m = this.jl(m, q.af);
                        }
                    }
                    if (k.l) {
                        m = this.jl(m, k.v);
                        l.badgeBounds = RectData.b(k.v);
                        l.badgeMarginTop = k.z.top;
                        l.badgeMarginBottom = k.z.bottom;
                        l.badgeMarginRight = k.z.right;
                        l.badgeMarginLeft = k.z.left;
                        l.badgeAppearance = new PrimitiveAppearanceData();
                        let aa = typeCast(ILegendContext_$type, k.n);
                        let ab = typeCast(ILegendContext_$type, k.i);
                        l.badgeAppearance.fill = AppearanceHelper.b(aa.actualItemBrush);
                        l.badgeAppearance.stroke = AppearanceHelper.b(aa.outline);
                        l.badgeShape = k.o;
                    }
                    l.rowBounds = RectData.b(m);
                }
                a.rows.add(l);
            }
            return a;
        }
        gw(a, b) {
            if (b != null) {
                if (b.q != null) {
                    a.fontFamily = b.q;
                }
                if (!isNaN_(b.f)) {
                    a.fontSize = b.f;
                }
                a.fontWeight = stringIsNullOrEmpty(b.v) ? "Normal" : b.v;
                a.fontStyle = stringIsNullOrEmpty(b.t) ? "Normal" : b.t;
                if (b.r != null) {
                    a.fontStretch = b.t;
                }
            }
        }
        bn(a, b) {
            let c = a.dataContext;
            if (c != null) {
                b = a.dataContext;
            }
            if (b == null || stringIsNullOrEmpty(b.fontString)) {
                return b;
            }
            else {
                return FontUtil.toFontInfo(this.a7.al, b.fontString);
            }
        }
        a2(a) {
            if (this.calculateColumnSummary != null) {
                let b = new DataLegendSummaryEventArgs(a.a, a.d);
                b.summaryValue = a.c;
                this.calculateColumnSummary(this, b);
                a.c = b.summaryValue;
                a.f = b.summaryUnits;
                a.e = b.summaryLabel;
            }
            return a;
        }
        a8() {
            switch (this.a3) {
                case 0:
                case 1: return new DataLegendSummaryCalculationTotal();
                case 2: return new DataLegendSummaryCalculationAverage();
                case 3: return new DataLegendSummaryCalculationMin();
                case 4: return new DataLegendSummaryCalculationMax();
                case 5: return new DataLegendSummaryCalculationEmpty();
                default: return new DataLegendSummaryCalculationEmpty();
            }
        }
        g1(a) {
            if (this.styleSummaryRow != null) {
                let b = this.a0(a);
                this.styleSummaryRow(this, b);
                this.gx(a, b);
            }
            if (a.c && a.m != null && this.styleSummaryColumn != null) {
                for (let c = 0; c < a.m.count; c++) {
                    let d = this.az(a.m._inner[c]);
                    d.d = a.g;
                    d.g = a.q;
                    d.c = c;
                    d.e = a.p;
                    this.styleSummaryColumn(this, d);
                    this.g2(a.m._inner[c], d);
                }
            }
        }
        g0(a) {
            if (this.styleSeriesRow != null) {
                let b = this.a0(a);
                this.styleSeriesRow(this, b);
                this.gx(a, b);
            }
            if (a.c && a.m != null && this.styleSeriesColumn != null) {
                for (let c = 0; c < a.m.count; c++) {
                    let d = this.az(a.m._inner[c]);
                    d.d = a.g;
                    d.g = a.q;
                    d.c = c;
                    d.e = a.p;
                    this.styleSeriesColumn(this, d);
                    this.g2(a.m._inner[c], d);
                }
            }
        }
        gz(a) {
            if (this.styleHeaderRow != null) {
                let b = this.a0(a);
                this.styleHeaderRow(this, b);
                this.gx(a, b);
            }
        }
        gy(a) {
            if (this.styleGroupRow != null) {
                let b = this.a0(a);
                this.styleGroupRow(this, b);
                this.gx(a, b);
            }
        }
        a0(a) {
            let b = new DataLegendStylingRowEventArgs();
            b.g = a.r;
            b.h = a.u;
            b.e = a.p;
            b.a = a.j;
            b.b = a.l;
            b.c = a.c;
            b.d = a.g;
            b.f = a.q;
            return b;
        }
        gx(a, b) {
            a.r = b.g;
            a.u = b.h;
            a.j = b.a;
            a.l = b.b;
            a.c = b.c;
        }
        az(a) {
            let b = new DataLegendStylingColumnEventArgs();
            b.f = a.v;
            b.l = a.ab;
            b.h = a.w;
            b.m = a.ac;
            b.k = a.z;
            b.n = a.ad;
            b.b = a.t;
            b.j = a.y;
            b.i = a.x;
            b.a = a.h;
            return b;
        }
        g2(a, b) {
            a.ab = b.l;
            a.v = b.f;
            a.l = !stringIsNullOrEmpty(a.v);
            a.w = b.h;
            a.ac = b.m;
            a.o = !stringIsNullOrEmpty(a.w);
            a.z = b.k;
            a.ad = b.n;
        }
        gm(a, b, c) {
            switch (a) {
                case XamDataLegend.$$p[5]:
                    this.gt();
                    break;
                case XamDataLegend.$$p[6]:
                    this.gv();
                    this.gu();
                    break;
                case XamDataLegend.$$p[7]:
                    this.gv();
                    break;
                case XamDataLegend.$$p[31]:
                    this.b1 = c;
                    break;
                case XamDataLegend.$$p[25]:
                case XamDataLegend.$$p[9]:
                    this.g6();
                    break;
                case XamDataLegend.$$p[24]:
                case XamDataLegend.$$p[8]:
                    this.g5();
                    break;
                case XamDataLegend.$$p[44]:
                    let d = c;
                    let e = b;
                    this.gk(e, d);
                    break;
                case XamDataLegend.$$p[42]:
                    if (this.b6(this.targetCursorPositionX)) {
                        this.cr = this.targetCursorPositionX;
                    }
                    break;
                case XamDataLegend.$$p[43]:
                    if (this.b6(this.targetCursorPositionY)) {
                        this.cs = this.targetCursorPositionY;
                    }
                    break;
                case XamDataLegend.$$p[58]:
                case XamDataLegend.$$p[57]:
                    if (!stringIsNullOrEmpty(this.fo)) {
                        this.ak = ((() => {
                            let $ret = new BindingFormatter();
                            $ret.j = this.fo;
                            $ret.d = this.ah;
                            return $ret;
                        })());
                    }
                    else {
                        this.ak = null;
                    }
                    break;
                case XamDataLegend.$$p[17]:
                case XamDataLegend.$$p[16]:
                    if (!stringIsNullOrEmpty(this.dv)) {
                        this.ai = ((() => {
                            let $ret = new BindingFormatter();
                            $ret.j = this.dv;
                            $ret.d = this.ag;
                            return $ret;
                        })());
                    }
                    else {
                        this.ai = null;
                    }
                    break;
                case "PixelScalingRatio":
                    if (isNaN_(this.ct)) {
                        this.a7.ay();
                    }
                    else {
                        this.ct = this.pixelScalingRatio;
                    }
                    break;
                case "ActualPixelScalingRatio":
                    this.a7.a9(c);
                    break;
            }
            this.go();
        }
        gj(a, b, c) {
            this.gm(a, b, c);
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
        }
        gk(a, b) {
            this.a9 = b;
            if (a != null) {
                a.detachDataLegend(this);
            }
            if (b != null) {
                b.attachDataLegend(this);
                if (isNaN_(this.targetCursorPositionX)) {
                    this.cr = -1;
                }
                if (isNaN_(this.targetCursorPositionY)) {
                    this.cs = -1;
                }
            }
        }
        g6() {
            this.ch = this.ci(this.includedSeries);
            this.cg = this.ci(this.excludedSeries);
        }
        g5() {
            this.ce = this.ci(this.includedColumns);
            this.cd = this.ci(this.excludedColumns);
            if (this.ce != null) {
                let a = new List$1(String_$type, 1, this.ce.keys);
                for (let b of fromEnum(a)) {
                    let c = b + ":";
                    let d = this.ce.item(b);
                    if (!this.ce.containsKey(c)) {
                        this.ce.addItem(c, d);
                    }
                }
                this.f0(this.ce);
            }
            if (this.cd != null) {
                let e = new List$1(String_$type, 1, this.cd.keys);
                for (let f of fromEnum(e)) {
                    let g = f + ":";
                    let h = this.cd.item(f);
                    if (!this.cd.containsKey(g)) {
                        this.cd.addItem(g, h);
                    }
                }
                this.f0(this.cd);
            }
        }
        f0(a) {
            let b = new List$1(String_$type, 1, a.keys);
            for (let c of fromEnum(b)) {
                let d = a.item(c);
                let e = c.toLowerCase();
                if (!a.containsKey(e)) {
                    a.addItem(e, d);
                }
                let f = c.toUpperCase();
                if (!a.containsKey(f)) {
                    a.addItem(f, d);
                }
                if (c.length > 0) {
                    let g = f.substr(0, 1) + e.substr(1);
                    if (!a.containsKey(g)) {
                        a.addItem(g, d);
                    }
                }
            }
        }
        ci(a) {
            if (a == null) {
                return null;
            }
            let b = new Dictionary$2(String_$type, Number_$type, 0);
            for (let c = 0; c < a.length; c++) {
                let d = a[c];
                if (!stringIsNullOrEmpty(d) && !b.containsKey(d.trim())) {
                    b.addItem(d.trim(), b.count);
                }
            }
            return b;
        }
        b6(a) {
            return a >= 0 && a <= 1;
        }
        notifyCursorPositionChanged(a) {
            let b = !isNaN_(this.targetCursorPositionX) || !isNaN_(this.targetCursorPositionY);
            let c = !isNaN_(a.x) && this.b6(a.x);
            let d = !isNaN_(a.y) && this.b6(a.y);
            if (!b && c && d) {
                this.cr = a.x;
                this.cs = a.y;
            }
        }
        notifySizeChanged() {
            this.a7.a7();
        }
        notifyVisualPropertiesChanged(a) {
        }
        notifySeriesCollectionChanged() {
            this.go();
        }
        notifySeriesDataChanged() {
            if (this.b1) {
                this.go();
            }
        }
        updatePropertyByName(a, b) {
            switch (a) {
                case XamDataLegend.$$p[26]:
                    this.isEmbeddedInDataTooltip = b;
                    break;
                case XamDataLegend.$$p[25]:
                    this.includedSeries = b;
                    break;
                case XamDataLegend.$$p[9]:
                    this.excludedSeries = b;
                    break;
                case XamDataLegend.$$p[24]:
                    this.includedColumns = b;
                    break;
                case XamDataLegend.$$p[8]:
                    this.excludedColumns = b;
                    break;
                case XamDataLegend.$$p[51]:
                    this.an = EnumUtil.getEnumValue(DataAbbreviationMode_$type, b);
                    break;
                case XamDataLegend.$$p[54]:
                    this.c0 = typeGetValue(b);
                    break;
                case XamDataLegend.$$p[55]:
                    this.c1 = typeGetValue(b);
                    break;
                case XamDataLegend.$$p[56]:
                    this.a5 = EnumUtil.getEnumValue(DataLegendValueMode_$type, b);
                    break;
                case XamDataLegend.$$p[52]:
                    this.fg = b;
                    break;
                case XamDataLegend.$$p[59]:
                    this.ca = b;
                    break;
                case XamDataLegend.$$p[58]:
                    this.fo = b;
                    break;
                case XamDataLegend.$$p[57]:
                    this.ah = b;
                    break;
                case XamDataLegend.$$p[60]:
                    this.j4 = b;
                    break;
                case XamDataLegend.$$p[61]:
                    this.cb = b;
                    break;
                case XamDataLegend.$$p[65]:
                    this.fx = b;
                    break;
                case XamDataLegend.$$p[64]:
                    this.cc = b;
                    break;
                case XamDataLegend.$$p[63]:
                    this.j5 = b;
                    break;
                case XamDataLegend.$$p[62]:
                    this.jk = b;
                    break;
                case "ValueTextStyle":
                    this.bx = b;
                    break;
                case XamDataLegend.$$p[17]:
                    this.dv = b;
                    break;
                case XamDataLegend.$$p[16]:
                    this.ag = b;
                    break;
                case XamDataLegend.$$p[14]:
                    this.dr = b;
                    break;
                case XamDataLegend.$$p[15]:
                    this.ap = EnumUtil.getEnumValue(DataLegendHeaderDateMode_$type, b);
                    break;
                case XamDataLegend.$$p[18]:
                    this.aq = EnumUtil.getEnumValue(DataLegendHeaderTimeMode_$type, b);
                    break;
                case XamDataLegend.$$p[23]:
                    this.d0 = b;
                    break;
                case XamDataLegend.$$p[21]:
                    this.jb = b;
                    break;
                case XamDataLegend.$$p[22]:
                    this.jx = b;
                    break;
                case XamDataLegend.$$p[19]:
                    this.jw = b;
                    break;
                case XamDataLegend.$$p[20]:
                    this.b5 = b;
                    break;
                case "HeaderTextStyle":
                    this.bp = b;
                    break;
                case XamDataLegend.$$p[12]:
                    this.ja = b;
                    break;
                case XamDataLegend.$$p[13]:
                    this.jv = b;
                    break;
                case XamDataLegend.$$p[10]:
                    this.ju = b;
                    break;
                case XamDataLegend.$$p[11]:
                    this.b3 = b;
                    break;
                case "GroupTextStyle":
                    this.bo = b;
                    break;
                case XamDataLegend.$$p[35]:
                    this.jf = b;
                    break;
                case "SummaryTitleTextStyle":
                    this.bs = b;
                    break;
                case XamDataLegend.$$p[38]:
                    this.a3 = EnumUtil.getEnumValue(DataLegendSummaryType_$type, b);
                    break;
                case XamDataLegend.$$p[37]:
                    this.er = b;
                    break;
                case XamDataLegend.$$p[36]:
                    this.j0 = b;
                    break;
                case XamDataLegend.$$p[34]:
                    this.jz = b;
                    break;
                case XamDataLegend.$$p[41]:
                    this.jh = b;
                    break;
                case "SummaryValueTextStyle":
                    this.bu = b;
                    break;
                case XamDataLegend.$$p[33]:
                    this.em = b;
                    break;
                case XamDataLegend.$$p[32]:
                    this.je = b;
                    break;
                case "SummaryLabelTextStyle":
                    this.br = b;
                    break;
                case XamDataLegend.$$p[40]:
                    this.ex = b;
                    break;
                case XamDataLegend.$$p[39]:
                    this.jg = b;
                    break;
                case "SummaryUnitsTextStyle":
                    this.bt = b;
                    break;
                case XamDataLegend.$$p[3]:
                    this.js = b;
                    break;
                case XamDataLegend.$$p[4]:
                    this.ba = EnumUtil.getEnumValue(LegendItemBadgeShape_$type, b);
                    break;
                case XamDataLegend.$$p[47]:
                    this.a4 = EnumUtil.getEnumValue(DataLegendUnitsMode_$type, b);
                    break;
                case XamDataLegend.$$p[50]:
                    this.fa = b;
                    break;
                case XamDataLegend.$$p[48]:
                    this.jj = b;
                    break;
                case XamDataLegend.$$p[49]:
                    this.j2 = b;
                    break;
                case "UnitsTextStyle":
                    this.bw = b;
                    break;
                case XamDataLegend.$$p[46]:
                    this.j1 = b;
                    break;
                case XamDataLegend.$$p[45]:
                    this.ji = b;
                    break;
                case "TitleTextStyle":
                    this.bv = b;
                    break;
                case XamDataLegend.$$p[27]:
                    this.ar = EnumUtil.getEnumValue(DataLegendLabelMode_$type, b);
                    break;
                case XamDataLegend.$$p[28]:
                    this.jc = b;
                    break;
                case XamDataLegend.$$p[29]:
                    this.b7 = true;
                    this.jy = b;
                    break;
                case XamDataLegend.$$p[30]:
                    this.as = EnumUtil.getEnumValue(DataLegendLayoutMode_$type, b);
                    break;
                case "LabelTextStyle":
                    this.bq = b;
                    break;
            }
        }
        a6() {
            return new DataLegendView(this);
        }
        destroy() {
            this.provideContainer(null);
        }
        get externalObject() {
            return this._externalObject;
        }
        set externalObject(a) {
            this._externalObject = a;
        }
        flush() {
            this.a7.av();
        }
        onAttachedToUI() {
            this.a7.a5();
        }
        onDetachedFromUI() {
            this.a7.a8();
        }
        ensureIndirectContainer(a, b) {
            if (this.a7.al == null) {
                this.a7.a6(a, true);
            }
        }
        provideContainer(a) {
            this.a7.a6(a, false);
        }
        go() {
            if (this.by) {
                return;
            }
            if (this.a7 != null) {
                this.by = this.a7.aa();
            }
        }
        get shouldOnDemandRender() {
            return this.bz;
        }
        set shouldOnDemandRender(a) {
            this.bz = a;
        }
        doRender(a, b) {
            if (this.jm.isEmpty) {
                let c = this.getDesiredSize();
                this.jm = new Rect(0, 0, 0, c.width, c.height);
            }
            this.gp(true);
            this.a7.bb(a, b);
        }
        ensureUpdated() {
            let a = this.getDesiredSize();
        }
        f9() {
            if (!this.by) {
                if (this.ao == null) {
                    this.go();
                }
                else {
                    return;
                }
            }
            this.g4();
        }
        getDesiredSize() {
            this.f9();
            if (this.ao == null) {
                return new Size(1, 0, 0);
            }
            return new Size(1, this.ao.d, this.ao.c);
        }
        g4() {
            this.f6();
            if (this.a9 == null || this.a9.isDetached || !this.b4()) {
                return;
            }
            let a = this.a9;
            let b = a.getDataLegendSeries();
            this.ga(b);
            this.fz(b, "");
            this.cm = new List$1(String_$type, 0);
            for (let c of fromEnum(this.cj)) {
                let d = this.cf.item(c);
                this.gd(d);
                for (let e of fromEnum(d.b)) {
                    if (!this.cm.contains(e.h) && !stringContains(e.h, "Highlight") && !stringContains(e.h, "Overlay") && !stringContains(e.h, "Value Layer")) {
                        this.cm.add(e.h);
                    }
                }
            }
            for (let f of fromEnum(this.cj)) {
                let g = this.cf.item(f);
                if (g.c.count > 0) {
                    this.gc(g);
                }
            }
            this.b0 = this.b8();
            this.f5(this.ao);
        }
        ga(a) {
            let b = new Dictionary$2(Number_$type, List$1.$.specialize(IDataLegendSeries_$type), 0);
            for (let c = 0; c < a.length; c++) {
                if (!this.isEmbeddedInDataTooltip) {
                    if (a[c].legendItemVisibility != 0) {
                        continue;
                    }
                }
                let d = a[c].title == null ? null : a[c].title.toString();
                let e = this.ch == null || this.ch.containsKey(a[c].dataLegendKey) || this.ch.containsKey(a[c].parentKey) || this.ch.containsKey(a[c].parentTitle) || this.ch.containsKey(a[c].index.toString()) || this.ch.containsKey(a[c].group) || this.ch.containsKey(d);
                let f = this.cg != null && (this.cg.containsKey(a[c].dataLegendKey) || this.cg.containsKey(a[c].parentKey) || this.cg.containsKey(a[c].parentTitle) || this.cg.containsKey(a[c].index.toString()) || this.cg.containsKey(a[c].group) || this.cg.containsKey(d));
                if (e && !f) {
                    let g = this.cz(a[c]);
                    if (!b.containsKey(g)) {
                        b.addItem(g, new List$1(IDataLegendSeries_$type, 0));
                    }
                    b.item(g).add(a[c]);
                }
            }
            let h = new List$1(Number_$type, 1, b.keys);
            h.y();
            let i = new List$1(IDataLegendSeries_$type, 0);
            for (let j of fromEnum(h)) {
                for (let k of fromEnum(b.item(j))) {
                    i.add(k);
                }
            }
            this.cf = new Dictionary$2(String_$type, DataLegendSeriesGroupInfo.$, 0);
            this.cj = new List$1(String_$type, 0);
            for (let l of fromEnum(i)) {
                let m = l.group;
                if (!this.cf.containsKey(m)) {
                    this.cj.add(m);
                    this.cf.addItem(m, ((() => {
                        let $ret = new DataLegendSeriesGroupInfo();
                        $ret.f = m;
                        return $ret;
                    })()));
                }
                this.cf.item(m).c.add(l);
            }
        }
        cz(a) {
            if (this.ch == null) {
                return a.index;
            }
            let b = a.dataLegendKey;
            if (this.ch.containsKey(b)) {
                return this.ch.item(b);
            }
            let c = a.index.toString();
            if (this.ch.containsKey(c)) {
                return this.ch.item(c);
            }
            let d = a.title == null ? null : a.title.toString();
            if (this.ch.containsKey(d)) {
                return this.ch.item(d);
            }
            return a.index;
        }
        f8() {
            this.by = false;
            if (!this.a7.z) {
                return;
            }
            let a = new Size(1, 0, 0);
            if (this.ao != null) {
                a = new Size(1, this.ao.d, this.ao.c);
            }
            this.g4();
            let b = new Size(1, 0, 0);
            if (this.ao != null) {
                b = new Size(1, this.ao.d, this.ao.c);
            }
            if (!a.equals(b)) {
                this.a7.aq(b.width, b.height);
            }
            this.gp(this.bz);
        }
        ge(message_) {
        }
        gp(a) {
            let b = new DataLegendRenderContext();
            for (let c = 0; c < this.ao.b.count; c++) {
                let d = this.ao.b._inner[c];
                this.gr(d, b);
            }
            this.a7.r.count = b.b;
            this.a7.s.count = b.c;
            this.a7.u.count = b.e;
            this.a7.t.count = b.d;
            this.a7.q.count = b.a;
            if (!a) {
                this.a7.au(this.ao);
            }
        }
        gr(a, b) {
            this.a7.bd();
            if (a.x.width > 0 && a.x.height > 0 && !a.b && !a.e && !a.a && a.l) {
                let c = this.a7.r.item(b.b);
                b.b += 1;
                this.gq(c, a, b);
            }
            let d = !stringIsNullOrEmpty(a.r);
            if (!a.w.isEmpty && a.w.width > 0 && d && a.w.height > 0) {
                let e = this.a7.s.item(b.c);
                b.c += 1;
                this.gs(e, a.r, a.u, a.k, a.w);
            }
            for (let f of fromEnum(a.m)) {
                if (!f.ag.isEmpty && f.s()) {
                    let g = this.a7.u.item(b.e);
                    b.e += 1;
                    this.gs(g, f.z, f.ad, f.k, f.ag);
                }
                if (!f.af.isEmpty && f.q() && f.o) {
                    let h = this.a7.t.item(b.d);
                    b.d += 1;
                    this.gs(h, f.w, f.ac, f.j, f.af);
                }
                if (!f.ae.isEmpty && f.n() && f.l) {
                    let i = this.a7.q.item(b.a);
                    b.a += 1;
                    this.gs(i, f.v, f.ab, f.i, f.ae);
                }
            }
            this.a7.ar();
        }
        gs(a, b, c, d, e) {
            a.al = b;
            this.a7.bc(a, e.left, e.top);
            this.a7.as(a, d);
            this.a7.at(a, d);
            a.ao = c;
        }
        gq(a, b, c) {
            a.ah = b.t;
            a.content = b.n;
            a.width = b.x.width;
            a.height = b.x.height;
            if (!b.v.isEmpty && !isInfinity(b.v.top) && !isInfinity(b.v.left)) {
                this.a7.bc(a, b.v.left, b.v.top);
            }
        }
        b2(a, b) {
            if (b == null) {
                return false;
            }
            return a.containsKey(b);
        }
        gd(a) {
            a.a.clear();
            a.b.clear();
            a.d = 0;
            for (let b = 0; b < a.c.count; b++) {
                let c = a.c._inner[b];
                let d = b;
                let e = c.getDataLegendResolvedWorldPositionX(this.cr);
                let f = c.getDataLegendResolvedWorldPositionY(this.cs);
                let g = typeCast(DataLegendSeriesContext.$, c.getDataLegendSeriesContextAt(e, f));
                if (g != null) {
                    let h = new List$1(DataLegendSeriesValueInfo.$, 0);
                    for (let i = 0; i < g.e.count; i++) {
                        let j = g.e._inner[i];
                        let k = this.ce == null || this.b2(this.ce, j.r) || this.b2(this.ce, j.q) || this.b2(this.ce, j.s) || this.b2(this.ce, "ALL");
                        let l = this.cd != null && (this.b2(this.cd, j.r) || this.b2(this.cd, j.q) || this.b2(this.cd, j.s) || this.b2(this.cd, "ALL"));
                        let m = this.ce == null && this.cd == null && j.k;
                        if (k && (!l && !m)) {
                            j.o = h.count;
                            h.add(j);
                            if (!a.a.containsKey(j.o)) {
                                a.a.addItem(j.o, new DataLegendColumn());
                            }
                            a.a.item(j.o).i = j.o;
                            a.a.item(j.o).d.q(d, j.t);
                            a.a.item(j.o).b.q(d, j.s);
                            a.a.item(j.o).e.q(d, j.l);
                            a.a.item(j.o).c.q(d, j);
                            a.a.item(j.o).h.add(d);
                        }
                    }
                    g.e = h;
                    a.b.add(g);
                    a.d = Math.max(a.d, g.e.count);
                }
            }
            for (let n of fromEnum(a.a.values)) {
                n.f.clear();
                n.a.clear();
                let o = n.e.p(n.h);
                let p = this.ck(o);
                for (let q = 0; q < p.count; q++) {
                    let r = p._inner[q];
                    let s = n.h._inner[q];
                    n.a.q(s, r);
                    let t = n.c.item(s);
                    let u = this.ek(r, t);
                    n.f.q(s, u);
                    let v = !stringIsNullOrEmpty(r.l);
                    if (v) {
                        n.g = true;
                    }
                }
            }
        }
        gc(a) {
            if (this.cf.count >= 1 && this.b3) {
                this.f1(a.f);
            }
            for (let b = 0; b < a.c.count; b++) {
                this.g3(a.c._inner[b], this.ba);
                this.f2(a, b);
            }
            if (this.as == 0) {
                this.f3(a);
            }
        }
        b8() {
            let a = false;
            for (let b = 0; b < this.ao.b.count; b++) {
                let c = this.ao.b._inner[b];
                if (c.d && c.l && c.j != 7) {
                    a = true;
                    break;
                }
            }
            return a;
        }
        f5(a) {
            for (let b = 0; b < a.b.count; b++) {
                let c = a.b._inner[b];
                this.gf(c);
            }
            let d = 0;
            let e = new Size(1, 0, 0);
            let f = new Size(1, 0, 0);
            let g = new Dictionary$2(Number_$type, Size.$, 0);
            let h = new Dictionary$2(Number_$type, Size.$, 0);
            let i = new Dictionary$2(Number_$type, Size.$, 0);
            for (let j of fromEnum(a.b)) {
                for (let k = 0; k < j.m.count; k++) {
                    let l = j.m._inner[k];
                    if (!g.containsKey(k)) {
                        g.addItem(k, new Size(1, 0, 0));
                    }
                    g.item(k, this.jq(g.item(k), l.am, l.ap));
                    if (!h.containsKey(k)) {
                        h.addItem(k, new Size(1, 0, 0));
                    }
                    h.item(k, this.jq(h.item(k), l.ak, l.ao));
                    if (!i.containsKey(k)) {
                        i.addItem(k, new Size(1, 0, 0));
                    }
                    i.item(k, this.jq(i.item(k), l.ai, l.an));
                }
            }
            for (let m = 0; m < a.b.count; m++) {
                let n = a.b._inner[m];
                f = this.jp(f, n.x, n.z);
                e = this.jq(e, n.y, n.ab);
                for (let o = 0; o < n.m.count; o++) {
                    n.m._inner[o].al = g.item(o);
                    n.m._inner[o].aj = h.item(o);
                    n.m._inner[o].ah = i.item(o);
                }
                if (n.e) {
                    let p = n.y.width + n.ab.left + n.ab.right;
                    d = Math.max(d, p + n.aa.left);
                }
                else if (n.d) {
                    let q = n.y.width + n.ab.left + n.ab.right;
                    let r = n.x.width + n.z.left + n.z.right;
                    d = Math.max(d, q + n.aa.left + r);
                }
            }
            let s = 0;
            let t = 0;
            for (let u = 0; u < a.b.count; u++) {
                let v = a.b._inner[u];
                let w = this.jn(t, v, d, e, f);
                t = w.height;
                s = Math.max(s, w.width);
            }
            a.d = s + this.jr.left + this.jr.right;
            a.c = t + this.jr.top + this.jr.bottom;
        }
        jp(a, b, c) {
            return new Size(1, Math.max(a.width, b.width + c.left + c.right), Math.max(a.height, b.height + c.top + c.bottom));
        }
        jq(a, b, c) {
            return new Size(1, Math.max(a.width, b.width + c.left + c.right), Math.max(a.height, b.height + c.top + c.bottom));
        }
        jn(a, b, c, d, e) {
            let f = 0;
            let g = 0;
            g = Math.max(b.x.height, g);
            g = Math.max(b.y.height, g);
            for (let h of fromEnum(b.m)) {
                g = Math.max(h.am.height, g);
                if (h.o) {
                    g = Math.max(h.ak.height, g);
                }
                if (h.l) {
                    g = Math.max(h.ai.height, g);
                }
            }
            f += b.aa.left;
            a += b.aa.top;
            if (!b.b && !b.e && !b.a && !b.f && this.b0) {
                f += b.z.left;
                let i = 0;
                if (g > b.x.height) {
                    i = (g - b.x.height) / 2;
                }
                b.v = new Rect(0, f, a + i, b.x.width, b.x.height);
                f += (b.v.width) + b.z.right;
            }
            else {
                b.v = new Rect(0, 0, 0, 0, 0);
            }
            if (!stringIsNullOrEmpty(b.r)) {
                f += b.ab.left;
                let j = 0;
                if (g > b.y.height) {
                    j = (g - b.y.height) / 2;
                }
                b.w = new Rect(0, f, a + j, b.y.width + b.ab.right, b.y.height);
                f = Math.max(c, b.w.right);
            }
            for (let k of fromEnum(b.m)) {
                if ((k.n() && k.l) && k.ah.width > 0) {
                    let l = 0;
                    if (g > k.ai.height) {
                        l = (g - k.ai.height) / 2;
                    }
                    k.ae = new Rect(0, f + k.an.left, a + l, k.ai.width, k.ai.height);
                    f += k.ah.width;
                }
                if (k.s()) {
                    f += k.ap.left;
                    f += (k.al.width - (k.am.width + k.ap.right));
                    let m = 0;
                    if (g > k.am.height) {
                        m = (g - k.am.height) / 2;
                    }
                    k.ag = new Rect(0, f, a + m, k.am.width, k.am.height);
                    f += k.ag.width;
                    f += k.ap.right;
                }
                if ((k.q() && k.o) && k.aj.width > 0) {
                    let n = 0;
                    if (g > k.ak.height) {
                        n = (g - k.ak.height) / 2;
                    }
                    k.af = new Rect(0, f + k.ao.left, a + n, k.ak.width, k.ak.height);
                    f += k.aj.width;
                }
            }
            f += b.aa.right;
            a += g;
            a += b.aa.bottom;
            return new Size(1, f, a);
        }
        gf(a) {
            a.y = a.r == null ? new Size(1, 0, 0) : this.a7.bz(a.r, a.k);
            for (let b of fromEnum(a.m)) {
                b.am = b.z == null ? new Size(1, 0, 0) : this.a7.bz(b.z, b.k);
                b.ak = b.w == null ? new Size(1, 0, 0) : this.a7.bz(b.w, b.j);
                b.ai = b.v == null ? new Size(1, 0, 0) : this.a7.bz(b.v, b.i);
            }
        }
        ej(a, b, c, d, e) {
            if (this.a4 == 2) {
                return null;
            }
            let f = "";
            if (stringIsNullOrEmpty(this.fa)) {
                f = c;
            }
            else {
                f = this.fa;
            }
            if (e) {
                if (stringIsNullOrEmpty(f)) {
                    f = d;
                }
                else {
                    f = d + f;
                }
            }
            let g = a.a.item(b).d;
            let h = a.a.item(b).g;
            if (h && stringIsNullOrEmpty(f)) {
                f = " ";
            }
            else if (g.count > 0 && stringIsNullOrEmpty(f)) {
                f = " ";
            }
            else if (!e) {
                return null;
            }
            return f;
        }
        eh(a, b, c, d) {
            if (this.ar == 2) {
                return null;
            }
            let e = a.d > 1;
            let f = this.ar == 1;
            let g = a.a.item(b).b.count > 0;
            if (g && (e || f)) {
                if (stringIsNullOrEmpty(c)) {
                    return " ";
                }
                else if (d) {
                    return c;
                }
            }
            return null;
        }
        f3(a) {
            if (this.a3 == 5) {
                return;
            }
            if (a.f == "Value Layer") {
                return;
            }
            if (a.c == null || a.c.count <= 1) {
                return;
            }
            let b = new Dictionary$2(Number_$type, DataLegendSummaryColumn.$, 0);
            let c = 0;
            let d = false;
            let e = new List$1(String_$type, 0);
            for (let f of fromEnum(a.b)) {
                c = Math.max(c, f.e.count);
                if (!e.contains(f.h)) {
                    e.add(f.h);
                }
                if (this.a3 == 0) {
                    if (e.count > 1) {
                        return;
                    }
                }
                if (stringContains(f.h, "Geographic") || stringContains(f.h, "Scatter") || stringContains(f.h, "Shape") || stringContains(f.h, "Polar") || stringContains(f.h, "Financial") || stringContains(f.h, "Indicator")) {
                    d = true;
                }
                for (let g = 0; g < f.e.count; g++) {
                    let h = f.e._inner[g];
                    if (!b.containsKey(g)) {
                        b.addItem(g, new DataLegendSummaryColumn());
                    }
                    let i = b.item(g);
                    i.n = h.n;
                    i.m = h.m;
                    i.e = h.e;
                    i.h = h.h;
                    i.f = h.f;
                    i.f = h.g;
                    i.d = h.d;
                    i.z = h.z;
                    i.ak(h.l);
                    i.ai(h.s);
                    i.aj(h.t);
                    if (stringIsNullOrEmpty(i.v)) {
                        i.v = h.v;
                    }
                    if (stringIsNullOrEmpty(i.w)) {
                        i.w = h.w;
                    }
                    if (stringIsNullOrEmpty(i.x)) {
                        i.x = h.x;
                    }
                    if (stringIsNullOrEmpty(i.y)) {
                        i.y = h.y;
                    }
                    if (stringIsNullOrEmpty(i.r)) {
                        i.r = h.r;
                    }
                    if (stringIsNullOrEmpty(i.q)) {
                        i.q = h.q;
                    }
                }
            }
            if (this.a3 == 0) {
                if (d) {
                    return;
                }
                let j = this.cm.count > 1;
                if (j) {
                    return;
                }
                for (let k = 0; k < a.c.count; k++) {
                    let l = a.c._inner[k];
                    if (!l.isSummarizationSupported) {
                        return;
                    }
                }
            }
            let m = this.a8();
            let n = new DataLegendRowInfo(this.a7, true, false, false, -1);
            n.r = this.er != null ? this.er : m.title;
            n.u = this.jf || this.ji || n.u;
            n.k = this.bs || this.bv || n.k;
            n.p = a.f;
            for (let o = 0; o < c; o++) {
                let p = b.item(o);
                let q = m.calculate(p.ac, p.r);
                q = this.a2(q);
                let r = this.an;
                let s = r == 0 || r == 2 || r == 8;
                let t = -1;
                for (let u of fromEnum(a.a.item(o).a.values)) {
                    if (u.b()) {
                        t = Math.max(t, u.h);
                        if (s) {
                            r = u.a;
                        }
                    }
                }
                let v = this.c1 >= 0 ? this.c1 : t;
                let w = this.c0 >= 0 ? this.c0 : t;
                let x = this.am(q.c, r, v, w);
                x.i = v;
                x.h = w;
                let y = this.ek(x, p);
                let z = new DataLegendRowCell(this.a7, true, false, false, -1);
                z.u = n.m.count;
                z.v = this.eh(a, z.u, " ", p.b);
                if (!stringIsNullOrEmpty(this.em)) {
                    z.v = this.em;
                }
                if (q.e != null) {
                    z.v = q.e;
                }
                z.l = !stringIsNullOrEmpty(z.v);
                z.ab = this.je || this.jc || z.ab;
                z.i = this.br || this.bq || z.i;
                z.z = y;
                z.k = this.bu || this.bx || z.k;
                z.ad = this.jd(this.jh, this.jk || z.ad, null);
                z.t = q.c;
                z.h = x.a;
                z.y = p.r;
                z.x = p.q;
                let aa = p.ab.length == 1 ? p.ab[0] : " ";
                z.w = this.ej(a, z.u, aa, x.l, p.d);
                if (!stringIsNullOrEmpty(this.ex)) {
                    z.w = this.ex;
                }
                if (q.f != null) {
                    z.w = q.f;
                }
                z.o = !stringIsNullOrEmpty(z.w);
                z.ac = this.jg || this.jj || z.ac;
                z.j = this.bt || this.bw || z.j;
                n.m.add(z);
            }
            this.g1(n);
            if (n.c) {
                this.f4(n);
                this.gl(n);
                this.ao.e(n);
            }
        }
        am(a, b, c, d) {
            if (b == 8 || b == 0) {
                b = this.an;
            }
            if (d < 0) {
                d = this.c0;
            }
            if (c < 0) {
                c = this.c1;
            }
            return DataAbbreviator.a(a, b, c, d);
        }
        cx(a, b, c, d) {
            return this.am(a, b, c, d).d;
        }
        dk(a, b, c, d) {
            return this.am(a, b, c, d).l;
        }
        dj(a, b, c, d) {
            let e = this.am(a, b, c, d);
            return e.m + e.l;
        }
        ck(a) {
            let b = this.c1;
            let c = this.c0;
            let d = this.an;
            let e = DataAbbreviator.h(a, d, b, c);
            return e;
        }
        cl(a, b) {
            let c = new List$1(Number_$type, 0);
            if (b < 0) {
                return c;
            }
            for (let d = 0; d < a.b.count; d++) {
                let e = a.b._inner[d];
                if (e.e.count > b) {
                    let f = e.e._inner[b].l;
                    if (!isNaN_(f)) {
                        c.add(f);
                    }
                }
            }
            return c;
        }
        f4(a) {
        }
        jd(a, b, c) {
            if (a != null) {
                return a;
            }
            if (this.cc && c != null) {
                return c;
            }
            return b;
        }
        ei(a, b) {
            return stringIsNullOrEmpty(a) ? b : a;
        }
        ek(a, b) {
            let c = a.d;
            if (b == null || isNaN_(c) || isInfinity(c)) {
                return this.fx;
            }
            let d;
            let e = b.d ? a.d : a.g;
            if (this.ak != null) {
                d = this.ak.i(e);
            }
            else {
                let f = this.a5;
                if (f == 0) {
                    f = 1;
                }
                let g = new NumberFormatSpecifier();
                g.useGrouping = this.ca;
                g.locale = this.ei(this.fg, null);
                g.currencyCode = this.fi;
                if (b.d) {
                    g.minimumFractionDigits = a.i;
                    g.maximumFractionDigits = a.h;
                    if (b.n >= 0 && b.n > a.i) {
                        g.minimumFractionDigits = b.n;
                    }
                    else if (this.c1 >= 0) {
                        g.minimumFractionDigits = this.c1;
                    }
                    if (b.m >= 0 && b.m > a.h) {
                        g.maximumFractionDigits = b.m;
                    }
                    else if (this.c0 >= 0) {
                        g.maximumFractionDigits = this.c0;
                    }
                }
                else {
                    g.minimumFractionDigits = b.n;
                    g.maximumFractionDigits = b.m;
                }
                if (g.minimumFractionDigits > g.maximumFractionDigits) {
                    g.maximumFractionDigits = g.minimumFractionDigits;
                }
                if (f == 2 && b.e) {
                    g.style = "currency";
                }
                if (this.al == null) {
                    this.al = new BindingFormatter();
                }
                this.al.j = "{0}";
                this.al.d = [g];
                d = this.al.i(e);
                if (e > 0) {
                    d = b.x + d;
                }
                else if (e < 0) {
                    d = b.v + d;
                }
                if (e >= 0) {
                    d += b.y;
                }
                else {
                    d += b.w;
                }
            }
            return d;
        }
        f2(a, b) {
            if (this.cb == false) {
                return;
            }
            let c = a.b._inner[b];
            let d = a.c._inner[b];
            let e = d.getDataLegendSeriesTitle();
            let f = c.a();
            let g = new DataLegendRowInfo(this.a7, false, false, false, b);
            g.h = f;
            g.q = e;
            g.p = a.f;
            g.r = e;
            g.u = this.ji || g.u;
            g.k = this.bv || g.k;
            g.j = this.bb(d);
            g.o = d.getDataLegendBadgeShapeAndMarker();
            if (this.as == 0) {
                for (let h = 0; h < c.e.count; h++) {
                    let i = c.e._inner[h];
                    let j = a.a.item(h).a.item(b);
                    let k = a.a.item(h).f.item(b);
                    let l = new DataLegendRowCell(this.a7, false, false, false, b);
                    l.u = g.m.count;
                    l.k = this.bx || l.k;
                    l.z = k;
                    l.ad = this.jd(this.jk, l.ad, i.z);
                    l.y = i.r;
                    l.x = i.q;
                    l.t = i.l;
                    l.h = j.a;
                    l.w = this.ej(a, l.u, i.t, j.l, i.d);
                    l.o = !stringIsNullOrEmpty(l.w);
                    l.ac = this.jj || l.ac;
                    l.j = this.bw || l.j;
                    l.v = this.eh(a, l.u, i.s, i.b);
                    l.l = !stringIsNullOrEmpty(l.v);
                    l.ab = this.jc || l.ab;
                    l.i = this.bq || l.i;
                    g.m.add(l);
                }
                this.f4(g);
                this.gl(g);
                this.g0(g);
                if (g.c) {
                    if (g.l) {
                        this.g3(d, g.j);
                        let m = this.g7(d);
                        let n = this.c3(d);
                        g.t = m;
                        g.n = n;
                    }
                    this.ao.e(g);
                }
            }
            else if (this.as == 1) {
                this.f4(g);
                this.gl(g);
                this.g0(g);
                if (g.c) {
                    if (g.l) {
                        this.g3(d, g.j);
                        let o = this.g7(d);
                        let p = this.c3(d);
                        g.t = o;
                        g.n = p;
                    }
                    this.ao.e(g);
                }
                for (let q = 0; q < c.e.count; q++) {
                    let r = c.e._inner[q];
                    let s = a.a.item(q).a.item(b);
                    let t = a.a.item(q).f.item(b);
                    let u = new DataLegendRowCell(this.a7, false, false, false, b);
                    u.u = g.m.count;
                    u.k = this.bx || u.k;
                    u.z = t;
                    u.ad = this.jd(this.jk, u.ad, r.z);
                    u.y = r.r;
                    u.x = r.q;
                    u.t = r.l;
                    u.h = s.a;
                    u.w = this.ej(a, u.u, r.t, s.l, r.d);
                    u.o = !stringIsNullOrEmpty(u.w);
                    u.ac = this.jj || u.ac;
                    u.j = this.bw || u.j;
                    u.v = this.eh(a, u.u, r.s, r.b);
                    u.l = !stringIsNullOrEmpty(u.v);
                    u.ab = this.jc || u.ab;
                    u.i = this.bq || u.i;
                    let v = new DataLegendRowInfo(this.a7, false, false, false, b);
                    v.h = f;
                    v.p = a.f;
                    v.f = true;
                    v.l = false;
                    v.j = 7;
                    v.m.add(u);
                    this.f4(v);
                    this.gl(v);
                    this.g0(v);
                    if (v.c) {
                        this.ao.e(v);
                    }
                }
            }
        }
        c3(a) {
            if (a.isColoredItemwise) {
                let b = a.getDataLegendBadgeContextAtPosition(this.cr, this.cs);
                if (b == null) {
                    return a.getDataLegendBadgeContext();
                }
            }
            return a.getDataLegendBadgeContext();
        }
        bb(a) {
            if (this.ba != 0) {
                return this.ba;
            }
            return a.legendItemBadgeShape;
        }
        g3(a, b) {
            if (b == 0) {
                return;
            }
            if (a.legendItemBadgeShape != b) {
                a.legendItemBadgeShape = b;
            }
        }
        b4() {
            return !isNaN_(this.cr) && !isNaN_(this.cs);
        }
        g7(a) {
            return a.getDataLegendBadge();
        }
        fz(a, b) {
            if (this.b5 == false) {
                return;
            }
            let c = this.eg(a);
            if (c == null) {
                c = this.c4;
            }
            else {
                this.c4 = c;
            }
            if (stringIsNullOrEmpty(c)) {
                return;
            }
            let d = new DataLegendRowInfo(this.a7, false, true, false, -1);
            d.r = c;
            d.u = this.jb || d.u;
            d.k = this.bp || d.k;
            d.p = b;
            this.f4(d);
            this.gl(d);
            this.gz(d);
            if (d.c) {
                this.ao.e(d);
            }
        }
        f1(a) {
            if (stringIsNullOrEmpty(a)) {
                return;
            }
            let b = new DataLegendRowInfo(this.a7, false, false, true, -1);
            b.r = a;
            b.u = this.ja || b.u;
            b.k = this.bo || b.k;
            b.p = a;
            this.f4(b);
            this.gl(b);
            this.gy(b);
            if (b.c) {
                this.ao.e(b);
            }
        }
        j3(a) {
            let b = new Thickness(0, 0);
            if (a.top >= 0) {
                b.top = a.top;
            }
            if (a.bottom >= 0) {
                b.bottom = a.bottom;
            }
            if (a.left >= 0) {
                b.left = a.left;
            }
            if (a.right >= 0) {
                b.right = a.right;
            }
            return b;
        }
        gl(a) {
            if (a.d) {
                a.ab = this.j3(this.j1);
                a.aa = this.j3(this.j4);
            }
            else if (a.b) {
                a.ab = this.j3(this.jx);
                a.aa = this.j3(this.jw);
            }
            else if (a.a) {
                a.ab = this.j3(this.jv);
                a.aa = this.j3(this.ju);
            }
            else {
                a.ab = this.j3(this.j0);
                a.aa = this.j3(this.jz);
            }
            for (let b of fromEnum(a.m)) {
                b.ap = this.j3(this.j5);
                b.ao = this.j3(this.j2);
                if (this.as == 1 && !this.b7) {
                    b.an = this.j3(new Thickness(1, 0, 0, 20, 0));
                }
                else {
                    b.an = this.j3(this.jy);
                }
            }
            if (a.d) {
                a.z = this.j3(this.js);
                a.x = new Size(1, 20, 15);
            }
        }
        eg(a) {
            if (this.d0 != null) {
                return this.d0;
            }
            let b = true;
            let c = null;
            for (let d = 0; d < a.length; d++) {
                let e = a[d];
                let f = this.ee(e);
                if (f == null) {
                    continue;
                }
                if (c == null) {
                    c = f;
                }
                else {
                    if (!Base.equalsStatic(c, f)) {
                        b = false;
                        break;
                    }
                }
            }
            if (b || !stringIsNullOrEmpty(c)) {
                return c;
            }
            return null;
        }
        ee(a) {
            if (this.b4()) {
                let b = a.getDataLegendAxisLabelFromCursorPosition(this.cr, this.cs);
                if (typeCast(Date_$type, b) !== null) {
                    let c = b;
                    b = this.ef(c);
                }
                return b == null ? "" : b.toString();
            }
            else {
                return null;
            }
        }
        ef(a) {
            if (this.ai != null) {
                let b = this.ai.i(a);
                return b;
            }
            else {
                let c = new DateTimeFormatSpecifier();
                c.dateStyle = "short";
                c.timeStyle = "full";
                let d = this.ap;
                if (d == 0) {
                    d = 1;
                }
                if (d == 3) {
                    c.dateStyle = "medium";
                }
                if (d == 1) {
                    c.dateStyle = "short";
                }
                if (d == 4) {
                    c.dateStyle = "full";
                }
                if (d == 2) {
                    c.dateStyle = "long";
                }
                if (d == 5) {
                    c.dateStyle = null;
                }
                let e = this.aq;
                if (e == 0) {
                    e = 1;
                }
                if (e == 3) {
                    c.timeStyle = "medium";
                }
                if (e == 1) {
                    c.timeStyle = "short";
                }
                if (e == 4) {
                    c.timeStyle = "full";
                }
                if (e == 2) {
                    c.timeStyle = "long";
                }
                if (e == 5) {
                    c.timeStyle = null;
                }
                c.locale = this.ei(this.dr, "en-US");
                if (this.aj == null) {
                    this.aj = new BindingFormatter();
                }
                this.aj.j = "{0}";
                this.aj.d = [c];
                let f = this.aj.i(a);
                return f;
            }
        }
        f6() {
            if (this.ao != null) {
                this.ao.f();
            }
        }
    }
    XamDataLegend.$t = markType(XamDataLegend, 'XamDataLegend', Control.$, [INotifyPropertyChanged_$type, IDataLegend_$type, IOnDemandRender_$type]);
    XamDataLegend.$$p = markDep(DependencyProperty, PropertyMetadata, XamDataLegend, 'gj', ['ActualBackground:i4:g8', [Brush.$, null], 'ActualBorderBrush:i5:g9', [Brush.$, null], 'ActualBorderThickness:jr:ha', [Thickness.$, new Thickness(0, 0)], 'BadgeMargin:js:hb', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'BadgeShape:ba:hc', [LegendItemBadgeShape_$type, enumGetBox(LegendItemBadgeShape_$type, 0)], 'ContentBackground:i6:hd', [Brush.$, null], 'ContentBorderBrush:i7:he', [Brush.$, null], 'ContentBorderThickness:cw:hf', [1, NaN], 'ExcludedColumns::hg', [Array_$type, null], 'ExcludedSeries::hh', [Array_$type, null], 'GroupRowMargin:ju:hi', [Thickness.$, new Thickness(0, 5)], 'GroupRowVisible:b3:hj', [0, false], 'GroupTextColor:ja:hk', [Brush.$, null], 'GroupTextMargin:jv:hl', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'HeaderFormatCulture:dr:hm', [2, stringEmpty()], 'HeaderFormatDate:ap:hn', [DataLegendHeaderDateMode_$type, enumGetBox(DataLegendHeaderDateMode_$type, 0)], 'HeaderFormatSpecifiers:ag:ho', [Array_$type, null], 'HeaderFormatString:dv:hp', [2, null], 'HeaderFormatTime:aq:hq', [DataLegendHeaderTimeMode_$type, enumGetBox(DataLegendHeaderTimeMode_$type, 0)], 'HeaderRowMargin:jw:hr', [Thickness.$, new Thickness(0, 5)], 'HeaderRowVisible:b5:hs', [0, true], 'HeaderTextColor:jb:ht', [Brush.$, null], 'HeaderTextMargin:jx:hu', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'HeaderText:d0:hv', [2, null], 'IncludedColumns::hw', [Array_$type, null], 'IncludedSeries::hx', [Array_$type, null], 'IsEmbeddedInDataTooltip::hy', [0, false], 'LabelDisplayMode:ar:hz', [DataLegendLabelMode_$type, enumGetBox(DataLegendLabelMode_$type, 0)], 'LabelTextColor:jc:h0', [Brush.$, null], 'LabelTextMargin:jy:h1', [Thickness.$, new Thickness(1, 12, 0, 0, 0)], 'LayoutMode:as:h2', [DataLegendLayoutMode_$type, enumGetBox(DataLegendLayoutMode_$type, 0)], 'ShouldUpdateWhenSeriesDataChanges:b9:h3', [0, true], 'SummaryLabelTextColor:je:h4', [Brush.$, null], 'SummaryLabelText:em:h5', [2, null], 'SummaryRowMargin:jz:h6', [Thickness.$, new Thickness(0, 5)], 'SummaryTitleTextColor:jf:h7', [Brush.$, null], 'SummaryTitleTextMargin:j0:h8', [Thickness.$, new Thickness(1, 2, 0, 4, 0)], 'SummaryTitleText:er:h9', [2, null], 'SummaryType:a3:ia', [DataLegendSummaryType_$type, enumGetBox(DataLegendSummaryType_$type, 0)], 'SummaryUnitsTextColor:jg:ib', [Brush.$, null], 'SummaryUnitsText:ex:ic', [2, null], 'SummaryValueTextColor:jh:id', [Brush.$, null], 'TargetCursorPositionX::ie', [1, NaN], 'TargetCursorPositionY::ig', [1, NaN], 'Target::ih', [4, null], 'TitleTextColor:ji:ii', [Brush.$, null], 'TitleTextMargin:j1:ij', [Thickness.$, new Thickness(1, 0, 0, 4, 0)], 'UnitsDisplayMode:a4:ik', [DataLegendUnitsMode_$type, enumGetBox(DataLegendUnitsMode_$type, 0)], 'UnitsTextColor:jj:il', [Brush.$, null], 'UnitsTextMargin:j2:im', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'UnitsText:fa:io', [2, null], 'ValueFormatAbbreviation:an:ip', [DataAbbreviationMode_$type, enumGetBox(DataAbbreviationMode_$type, 0)], 'ValueFormatCulture:fg:iq', [2, stringEmpty()], 'ValueFormatCurrencyCode:fi:ir', [2, null], 'ValueFormatMaxFractions:c0:is', [1, -1], 'ValueFormatMinFractions:c1:it', [1, -1], 'ValueFormatMode:a5:iu', [DataLegendValueMode_$type, enumGetBox(DataLegendValueMode_$type, 0)], 'ValueFormatSpecifiers:ah:iv', [Array_$type, null], 'ValueFormatString:fo:iw', [2, null], 'ValueFormatUseGrouping:ca:ix', [0, true], 'ValueRowMargin:j4:iy', [Thickness.$, new Thickness(0, 5)], 'ValueRowVisible:cb:iz', [0, true], 'ValueTextColor:jk:i0', [Brush.$, null], 'ValueTextMargin:j5:i1', [Thickness.$, new Thickness(1, 2, 0, 2, 0)], 'ValueTextUseSeriesColors:cc:i2', [0, false], 'ValueTextWhenMissingData:fx:i3', [2, "N/A"]]);
    return XamDataLegend;
})();
/**
 * @hidden
 */
export let DataLegendView = /*@__PURE__*/ (() => {
    class DataLegendView extends Base {
        constructor(a) {
            super();
            this.ad = null;
            this.af = null;
            this.ah = null;
            this.ag = null;
            this.ae = null;
            this.q = null;
            this.s = null;
            this.u = null;
            this.t = null;
            this.r = null;
            this.a = null;
            this.am = null;
            this.al = null;
            this.v = null;
            this.b = null;
            this.ai = 1;
            this.y = false;
            this.ao = -1;
            this.an = -1;
            this.ab = new Dictionary$2(FontInfo.$, Tuple$2.$.specialize(Number_$type, FontInfo.$), 0);
            this.x = false;
            this.ac = new List$1(FrameworkElement.$, 0);
            this.aj = 0;
            this.g = null;
            this.i = null;
            this.h = null;
            this.e = null;
            this.f = null;
            this.d = null;
            this.c = null;
            this.w = null;
            this.a = a;
            this.s = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.bp);
                $ret.activate = runOn(this, this.be);
                $ret.disactivate = runOn(this, this.bg);
                $ret.destroy = runOn(this, this.bf);
                return $ret;
            })());
            this.u = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.br);
                $ret.activate = runOn(this, this.bk);
                $ret.disactivate = runOn(this, this.bm);
                $ret.destroy = runOn(this, this.bl);
                return $ret;
            })());
            this.t = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.bq);
                $ret.activate = runOn(this, this.bh);
                $ret.disactivate = runOn(this, this.bj);
                $ret.destroy = runOn(this, this.bi);
                return $ret;
            })());
            this.r = ((() => {
                let $ret = new Pool$1(ContentControl.$);
                $ret.create = runOn(this, this.bn);
                $ret.activate = runOn(this, this.a2);
                $ret.disactivate = runOn(this, this.a4);
                $ret.destroy = runOn(this, this.a3);
                return $ret;
            })());
            this.q = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.bo);
                $ret.activate = runOn(this, this.az);
                $ret.disactivate = runOn(this, this.a1);
                $ret.destroy = runOn(this, this.a0);
                return $ret;
            })());
            this.ad = new List$1(TextBlock.$, 0);
            this.af = new List$1(TextBlock.$, 0);
            this.ah = new List$1(TextBlock.$, 0);
            this.ag = new List$1(TextBlock.$, 0);
            this.ae = new List$1(ContentControl.$, 0);
        }
        av() {
            this.a.f8();
        }
        bp() {
            let a = new TextBlock();
            this.af.add(a);
            return a;
        }
        be(a) {
            a._visibility = 0;
        }
        bg(a) {
            a._visibility = 1;
        }
        bf(a) {
            this.af.remove(a);
        }
        br() {
            let a = new TextBlock();
            this.ah.add(a);
            return a;
        }
        bk(a) {
            a._visibility = 0;
        }
        bm(a) {
            a._visibility = 1;
        }
        bl(a) {
            this.ah.remove(a);
        }
        bq() {
            let a = new TextBlock();
            this.ag.add(a);
            return a;
        }
        bh(a) {
            a._visibility = 0;
        }
        bj(a) {
            a._visibility = 1;
        }
        bi(a) {
            this.ag.remove(a);
        }
        bo() {
            let a = new TextBlock();
            this.ad.add(a);
            return a;
        }
        az(a) {
            a._visibility = 0;
        }
        a1(a) {
            a._visibility = 1;
        }
        a0(a) {
            this.ad.remove(a);
        }
        bn() {
            let a = new ContentControl();
            this.ae.add(a);
            return a;
        }
        a2(a) {
            a._visibility = 0;
        }
        a4(a) {
            a._visibility = 1;
        }
        a3(a) {
        }
        ay() {
            let a = CanvasScalingHelpers.b(this.al);
            if (this.b != null) {
                CanvasScalingHelpers.h(this.b, a);
            }
            this.a.ct = CanvasScalingHelpers.a(this.a.pixelScalingRatio, this.a.ct, a);
        }
        a7() {
            this.ay();
            let a = Math.round(this.al.rootWrapper.width());
            let b = Math.round(this.al.rootWrapper.height());
            this.a.jm = new Rect(0, 0, 0, a, b);
            if (this.b != null) {
                this.b.bm = this.a.jm;
            }
            this.a.go();
        }
        ap() {
            if (this.b != null) {
                this.b.ap = null;
                this.b.aw();
                this.b = null;
            }
        }
        get z() {
            return this.al != null;
        }
        a6(a, b) {
            if (a == null) {
                this.am = null;
                this.al = null;
                this.v = null;
                this.ap();
                return;
            }
            this.ai = (isNaN_(this.a.pixelScalingRatio) ? this.a.ct : this.a.pixelScalingRatio);
            let c = a;
            this.al = c;
            let d = this.ai;
            let e = Math.round(c.rootWrapper.width());
            let f = Math.round(c.rootWrapper.height());
            let g = e * d;
            let h = f * d;
            this.al.rootWrapper.setStyleProperty("position", "relative");
            let i = this.al.createElement("canvas");
            i.setStyleProperty("position", "absolute");
            this.al.append(i);
            this.ao = truncate(Math.round(g));
            this.an = truncate(Math.round(h));
            i.setAttribute("width", g.toString());
            i.setAttribute("height", h.toString());
            i.setStyleProperty("width", e.toString() + "px");
            i.setStyleProperty("height", f.toString() + "px");
            this.a.jm = new Rect(0, 0, 0, e, f);
            this.am = i;
            let j = this.al.get2DCanvasContext(this.am);
            this.v = new RenderingContext(new CanvasViewRenderer(), j);
            this.ap();
            if (TypeRegistrar.isRegistered("CanvasGestureDOMEventProxy")) {
                this.b = typeCast(EventProxy.$, TypeRegistrar.create("CanvasGestureDOMEventProxy", this.al.rootWrapper, this.al, false));
            }
            if (this.b != null) {
            }
        }
        ax(a, b) {
            this.a7();
        }
        aw(a) {
        }
        ba() {
            let a = this.a.jm.width;
            let b = this.a.jm.height;
            let c = Math.round(a * this.ai);
            let d = Math.round(b * this.ai);
            if (this.ao != c || this.an != d) {
                this.am.setAttribute("width", c.toString());
                this.am.setAttribute("height", d.toString());
                this.am.setStyleProperty("width", a.toString() + "px");
                this.am.setStyleProperty("height", b.toString() + "px");
                this.ao = truncate(Math.round(c));
                this.an = truncate(Math.round(d));
            }
            this.bb(this.v, this.ai);
        }
        bb(a, b) {
            if (this.v == null) {
                this.y = true;
                this.v = a;
            }
            if (a.d && b != 1) {
                a.aa();
                a.ab(b, b);
            }
            if (a == this.v) {
                if (!a.e) {
                    a.l(this.a.jm.left, this.a.jm.top, this.a.jm.width, this.a.jm.height);
                }
            }
            if (this.a.i6 != null || this.a.i7 != null) {
                let c = new Rectangle();
                c.o = this.a.jm.top;
                c.n = this.a.jm.left;
                c.height = this.a.jm.height;
                c.width = this.a.jm.width;
                c.height = this.a.jm.height;
                if (this.a.i6 != null) {
                    c._fill = this.a.i6;
                }
                if (this.a.i7 != null && this.a.cw > 0) {
                    c._stroke = this.a.i7;
                    c.ad = this.a.cw;
                }
                a.w(c);
            }
            let d = new DataTemplatePassInfo();
            d.passID = "LegendItem";
            for (let e = 0; e < this.ae.count; e++) {
                let f = this.ae._inner[e];
                if (f == null) {
                    continue;
                }
                let g = f.ah;
                if (g == null) {
                    continue;
                }
                let h = new DataTemplateMeasureInfo();
                h.passInfo = d;
                h.context = this.v.h();
                h.width = f.width;
                h.height = f.height;
                h.data = f.content;
                h.renderContext = a;
                g.measure(h);
                let i = new DataTemplateRenderInfo();
                i.availableWidth = f.width;
                i.availableHeight = f.height;
                i.passInfo = d;
                i.context = a.h();
                i.renderContext = a;
                i.data = f.content;
                i.xPosition = f.n;
                i.yPosition = f.o;
                a.aa();
                a.ai(f.n, f.o);
                g.render(i);
                a.z();
            }
            for (let j = 0; j < this.af.count; j++) {
                let k = this.af._inner[j];
                a.af(k.dataContext);
                a.x(k);
            }
            for (let l = 0; l < this.ad.count; l++) {
                let m = this.ad._inner[l];
                a.af(m.dataContext);
                a.x(m);
            }
            for (let n = 0; n < this.ah.count; n++) {
                let o = this.ah._inner[n];
                a.af(o.dataContext);
                a.x(o);
            }
            for (let p = 0; p < this.ag.count; p++) {
                let q = this.ag._inner[p];
                a.af(q.dataContext);
                a.x(q);
            }
            if (a.d && b != 1) {
                a.z();
            }
        }
        aa() {
            if (this.al != null) {
                this.al.setTimeout(runOn(this.a, this.a.f8), 0);
                return true;
            }
            return false;
        }
        bz(a, b) {
            this.v.af(b);
            let c = new TextBlock();
            c.al = a;
            let d = this.v.aj(c, this.ak(b), true);
            return new Size(1, d.c, d.b);
        }
        ak(a) {
            if (this.ab.containsKey(a)) {
                let b = this.ab.item(a);
                if (b.d.j == a.j) {
                    return b.c;
                }
            }
            let c = FontUtil.getCurrentFontHeight(this.al, a);
            let d = new Tuple$2(Number_$type, FontInfo.$, c, a);
            this.ab.item(a, d);
            return c;
        }
        bc(a, b, c) {
            if (this.x) {
                this.ac.add(a);
            }
            a.n = b;
            a.o = c;
        }
        au(a) {
            this.ba();
        }
        as(a, b) {
            a.dataContext = b;
        }
        by() {
            return FontDefaults.dataLegendFontBrush;
        }
        bw() {
            return FontDefaults.dataLegendFontBrush;
        }
        bx() {
            return FontDefaults.dataLegendFontBrush;
        }
        bu() {
            return FontDefaults.dataLegendFontBrush;
        }
        bv() {
            return FontDefaults.dataLegendFontBrush;
        }
        bt() {
            return FontDefaults.dataLegendFontBrush;
        }
        bs() {
            return FontDefaults.dataLegendFontBrush;
        }
        n() {
            if (this.g == null) {
                this.g = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.g;
        }
        p() {
            if (this.i == null) {
                this.i = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.i;
        }
        o() {
            if (this.h == null) {
                this.h = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.h;
        }
        l() {
            if (this.e == null) {
                this.e = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.e;
        }
        m() {
            if (this.f == null) {
                this.f = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.f;
        }
        k() {
            if (this.d == null) {
                this.d = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendHeaderFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.d;
        }
        j() {
            if (this.c == null) {
                this.c = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.c;
        }
        aq(a, b) {
            let model_ = this.a;
            let ext_ = model_.externalObject;
            if (ext_ != null) {
                let width_ = a;
                let height_ = b;
                this.al.rootWrapper.setStyleProperty("min-height", b + "px");
                this.al.rootWrapper.setStyleProperty("min-width", a + "px");
                this.a.notifySizeChanged();
            }
        }
        a9(a) {
            this.ai = a;
        }
        a5() {
            if (this.b != null) {
                let a = this.al.rootWrapper;
                this.b.au(a, "");
            }
        }
        a8() {
            if (this.b != null) {
                if (this.al == null) {
                    return;
                }
                let a = this.al.rootWrapper;
                this.b.bi(a, "");
            }
        }
        at(a, b) {
            a.ag = true;
            let c = this.v.aj(a, this.ak(b), true);
        }
        bd() {
            this.ac.clear();
            this.x = true;
            this.aj = 0;
        }
        ar() {
            for (let a = 0; a < this.ac.count; a++) {
                this.aj = Math.max(this.aj, this.ac._inner[a].ah);
            }
            if (this.aj > 0) {
                for (let b = 0; b < this.ac.count; b++) {
                    this.ac._inner[b].ah = this.aj;
                }
            }
            this.x = false;
            this.aj = 0;
        }
    }
    DataLegendView.$t = markType(DataLegendView, 'DataLegendView');
    return DataLegendView;
})();