UNPKG

igniteui-angular-charts

Version:

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

698 lines (697 loc) 26.3 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, String_$type, fromEnum, typeCast, runOn, markType } from "igniteui-angular-core"; import { IDomainChartToolbarProvider_$type } from "./IDomainChartToolbarProvider"; import { ToolCommandStateChanged } from "igniteui-angular-core"; import { ToolActionGroupHeaderInfo } from "igniteui-angular-core"; import { ToolActionCheckboxListInfo } from "igniteui-angular-core"; import { HashSet$1 } from "igniteui-angular-core"; import { DomainChartCheckboxListItem } from "./DomainChartCheckboxListItem"; import { ToolActionIconMenuInfo } from "igniteui-angular-core"; import { Tuple$2 } from "igniteui-angular-core"; import { NativeUIComponent } from "igniteui-angular-core"; import { ToolContextBindingInfo } from "igniteui-angular-core"; import { XYChart } from "./XYChart"; import { BrushUtilCore } from "igniteui-angular-core"; import { ToolCommandArgument } from "igniteui-angular-core"; import { AxisStrokeSettings } from "./AxisStrokeSettings"; import { DeviceUtils } from "igniteui-angular-core"; import { FastIterationDictionary$2 } from "igniteui-angular-core"; import { AxisDefaults } from "./AxisDefaults"; import { ValueModeCollection } from "./ValueModeCollection"; import { BrushCollection } from "igniteui-angular-core"; import { isNaN_ } from "igniteui-angular-core"; /** * @hidden */ export let DomainChartToolbarProvider = /*@__PURE__*/ (() => { class DomainChartToolbarProvider extends Base { constructor() { super(...arguments); this.c = null; this.e = false; this._container = null; this.g = new HashSet$1(Tuple$2.$.specialize(String_$type, String_$type), 0); this.h = new HashSet$1(Tuple$2.$.specialize(String_$type, String_$type), 0); this._commandChanged = null; this.d = new FastIterationDictionary$2(String_$type, AxisStrokeSettings.$, 0); this.b = null; } get container() { return this._container; } set container(a) { this._container = a; } get commandChanged() { return this._commandChanged; } set commandChanged(a) { this._commandChanged = a; } getDesiredToolbarActions(a, b, c) { let d; if (a.itemsSource != null && NativeUIComponent.v(16, 0)) { let e = new ToolActionGroupHeaderInfo(); e.name = "AxisFieldLabelHeader"; e.title = "Label Fields"; let f = new ToolActionCheckboxListInfo(); f.name = "AxisFieldLabel"; let g = new ToolActionGroupHeaderInfo(); g.name = "AxisFieldValueHeader"; g.title = "Value Fields"; let h = new ToolActionCheckboxListInfo(); h.name = "AxisFieldValue"; let i = a.includedProperties == null ? null : new HashSet$1(String_$type, 1, a.includedProperties); let j = 0; if (i != null && a.excludedProperties != null && a.excludedProperties.length > 0) { let k = new HashSet$1(String_$type, 1, a.excludedProperties); for (let l of fromEnum(k)) { if (i.contains(l)) { i.remove(l); } } let m = i.count; let n = new Array(m); j = 0; for (let o of fromEnum(i)) { n[j] = o; j++; } } a.currentDataAdapter.az(this.g, this.h); j = 0; let p = new Array(this.g.count); for (let q of fromEnum(this.g)) { p[j] = ((() => { let $ret = new DomainChartCheckboxListItem(); $ret.key = q.c; $ret.label = q.d; $ret.isSelected = i == null || i.contains(q.c); return $ret; })()); j++; } c.setContextValue("AxisFieldLabels", 7, p); f.dataMemberPath = "label"; f.selectedMemberPath = "isSelected"; f.primaryKey = ["key"]; f.contextBindings = [((() => { let $ret = new ToolContextBindingInfo(); $ret.bindingMode = 0; $ret.contextKey = "AxisFieldLabels"; $ret.propertyName = "ItemsSource"; return $ret; })())]; let r = new Array(this.h.count); j = 0; for (let s of fromEnum(this.h)) { r[j] = ((() => { let $ret = new DomainChartCheckboxListItem(); $ret.key = s.c; $ret.label = s.d; $ret.isSelected = i == null || i.contains(s.c); return $ret; })()); j++; } c.setContextValue("AxisFieldValues", 7, r); h.dataMemberPath = "label"; h.selectedMemberPath = "isSelected"; h.primaryKey = ["key"]; h.contextBindings = [((() => { let $ret = new ToolContextBindingInfo(); $ret.bindingMode = 0; $ret.contextKey = "AxisFieldValues"; $ret.propertyName = "ItemsSource"; return $ret; })())]; let t = new ToolActionIconMenuInfo(); t.name = "AxisFieldMenu"; t.iconName = "analyze-valuelabels-showlast"; t.iconCollectionName = "ChartToolbarIcons"; t.iconWidth = 24; t.iconHeight = 25; t.actions = [e, f, g, h]; d = new Array(b.length + 1); for (let u = 0; u < b.length; u++) { d[u] = b[u]; } d[b.length] = t; } else { d = b; } for (let v = 0; v < d.length; v++) { this.i(a, d[v]); } return d; } i(a, b) { if (b.actions != null && b.actions.length > 0) { for (let c = 0; c < b.actions.length; c++) { this.i(a, b.actions[c]); } } switch (b.name) { case "ShowCrosshairs": { let d = b; d.isChecked = a.crosshairsDisplayMode != 1; } break; case "ShowGridlines": { let e = b; if (typeCast(XYChart.$, a) !== null) { let f = a; e.isChecked = f.agc != null && !BrushUtilCore.a(f.agc) && f.abq > 0 && f.agj != null && !BrushUtilCore.a(f.agj) && f.ab7 > 0; } } break; case "ShowValueLabels": { let g = b; g.isChecked = a.autoCalloutsVisible; } break; case "ShowLastValueLabel": { let h = b; h.isChecked = a.finalValueAnnotationsVisible; } break; case "MinValue": { if (a.valueLines != null) { let i = b; for (let j = 0; j < a.valueLines.count; j++) { if (a.valueLines._inner[j] == 4) { i.isChecked = true; break; } } } } break; case "MaxValue": { if (a.valueLines != null) { let k = b; for (let l = 0; l < a.valueLines.count; l++) { if (a.valueLines._inner[l] == 5) { k.isChecked = true; break; } } } } break; case "Average": { if (a.valueLines != null) { let m = b; for (let n = 0; n < a.valueLines.count; n++) { if (a.valueLines._inner[n] == 6) { m.isChecked = true; break; } } } } break; case "SeriesAvg": { if (a.valueLines != null) { let o = b; for (let p = 0; p < a.valueLines.count; p++) { if (a.valueLines._inner[p] == 3) { o.isChecked = true; break; } } } } break; case "AxisFieldLabel": { } break; case "AxisFieldValue": { } break; } this.j(a, b); } j(a, b) { } onToolCommandExecuting(a, b) { this.e = true; let c = 0; switch (b.commandId) { case "ZoomReset": this.af(a, b); break; case "ZoomIn": this.ad(a, b); break; case "ZoomOut": this.ae(a, b); break; case "ShowCrosshairs": this.q(a, b); break; case "ShowGridlines": this.s(a, b); break; case "MaxValue": this.w(a, b); break; case "MinValue": this.x(a, b); break; case "Average": this.l(a, b); break; case "Exponential": this.r(a, b); break; case "Linear": this.u(a, b); break; case "Logarithmic": this.v(a, b); break; case "NoTrends": this.y(a, b); break; case "SeriesAvg": this.z(a, b); break; case "ShowValueLabels": this.ab(a, b); break; case "ShowLastValueLabel": this.aa(a, b); break; case "CopyAsImage": this.p(a, b); c = 2; break; case "AxisFieldLabel": this.n(a, b); break; case "AxisFieldValue": this.o(a, b); break; } this.e = false; return c; } onTargetPropertyChanged(a, b, c, d) { if (this.e) { return; } switch (b) { case "CrosshairsDisplayMode": if (a.crosshairsDisplayMode == 1) { this.k("ShowCrosshairs", 2, false); } else { this.k("ShowCrosshairs", 2, true); } break; case "AutoCalloutsVisible": this.k("ShowValueLabels", 2, a.autoCalloutsVisible); break; case "FinalValueAnnotationsVisible": this.k("ShowLastValueLabel", 2, a.finalValueAnnotationsVisible); break; } this.ac(a, b, c, d); } ac(a, b, c, d) { } k(a, b, c) { if (this.commandChanged != null) { this.commandChanged(((() => { let $ret = new ToolCommandStateChanged(); $ret.c = a; $ret.a = b; $ret.b = c; return $ret; })())); } } f(a, b) { if (a.commandId == b) { let e = a.argumentsList; for (let d = 0; d < e.length; d++) { let c = e[d]; if (c.argumentName == "IsChecked") { return c.value; } } } return false; } q(a, b) { if (this.f(b, "ShowCrosshairs")) { a.crosshairsDisplayMode = 0; a.crosshairsAnnotationEnabled = true; } else { a.crosshairsDisplayMode = 1; } } a(a, b, c) { let d = new AxisStrokeSettings(); if (b == "xaxis") { d.b = a.agc == null || BrushUtilCore.a(a.agc) ? c : a.agc; d.a = isNaN_(a.abq) || a.abq == 0 ? DeviceUtils.g(1) : a.abq; this.d.item("xaxis", d); } else { d.b = a.agj == null || BrushUtilCore.a(a.agj) ? c : a.agj; d.a = isNaN_(a.ab7) || a.ab7 == 0 ? DeviceUtils.g(1) : a.ab7; this.d.item("yaxis", d); } return d; } s(a, b) { if (this.f(b, "ShowGridlines")) { if (typeCast(XYChart.$, a) !== null) { let c = a; let d = true; if (this.d.d("xaxis")) { if (this.d.item("xaxis").b != c.agc || c.abq != 0) { d = true; } else { c.agc = this.d.item("xaxis").b; c.abq = this.d.item("xaxis").a; d = false; } } if (d) { let e = this.a(c, "xaxis", AxisDefaults.h); c.agc = e.b; c.abq = e.a; } d = true; if (this.d.d("yaxis")) { if (this.d.item("yaxis").b != c.agj || c.ab7 != 0) { d = true; } else { c.agj = this.d.item("yaxis").b; c.ab7 = this.d.item("yaxis").a; d = false; } } if (d) { let f = this.a(c, "yaxis", AxisDefaults.h); c.agj = f.b; c.ab7 = f.a; } } } else { if (typeCast(XYChart.$, a) !== null) { let g = a; if (!this.d.d("xaxis")) { this.a(g, "xaxis", AxisDefaults.h); } g.abq = 0; if (!this.d.d("yaxis")) { this.a(g, "yaxis", AxisDefaults.h); } g.ab7 = 0; } } } r(a, b) { if (this.f(b, "Exponential")) { a.trendLineType = 7; } else { a.trendLineType = 0; } } u(a, b) { if (this.f(b, "Linear")) { a.trendLineType = 1; } else { a.trendLineType = 0; } } v(a, b) { if (this.f(b, "Logarithmic")) { a.trendLineType = 6; } else { a.trendLineType = 0; } } y(a, b) { if (this.f(b, "NoTrends")) { a.trendLineType = 0; } } w(a, b) { if (this.f(b, "MaxValue")) { if (a.valueLines == null) { a.valueLines = new ValueModeCollection(); } if (a.valueLinesBrushes == null) { a.valueLinesBrushes = new BrushCollection(); } a.valueLines.add(5); } else { for (let c = 0; c < a.valueLines.count; c++) { if (a.valueLines._inner[c] == 5) { a.valueLines.removeAt(c); c--; } } } } x(a, b) { if (this.f(b, "MinValue")) { if (a.valueLines == null) { a.valueLines = new ValueModeCollection(); } if (a.valueLinesBrushes == null) { a.valueLinesBrushes = new BrushCollection(); } a.valueLines.add(4); } else { for (let c = 0; c < a.valueLines.count; c++) { if (a.valueLines._inner[c] == 4) { a.valueLines.removeAt(c); c--; } } } } l(a, b) { if (this.f(b, "Average")) { if (a.valueLines == null) { a.valueLines = new ValueModeCollection(); } if (a.valueLinesBrushes == null) { a.valueLinesBrushes = new BrushCollection(); } a.valueLines.add(6); } else { for (let c = 0; c < a.valueLines.count; c++) { if (a.valueLines._inner[c] == 6) { a.valueLines.removeAt(c); c--; } } } } z(a, b) { if (this.f(b, "SeriesAvg")) { if (a.valueLines == null) { a.valueLines = new ValueModeCollection(); } if (a.valueLinesBrushes == null) { a.valueLinesBrushes = new BrushCollection(); } a.valueLines.add(3); } else { for (let c = 0; c < a.valueLines.count; c++) { if (a.valueLines._inner[c] == 3) { a.valueLines.removeAt(c); c--; } } } } ab(a, b) { if (this.f(b, "ShowValueLabels")) { a.autoCalloutsVisible = true; } else { a.autoCalloutsVisible = false; } } aa(a, b) { if (this.f(b, "ShowLastValueLabel")) { a.finalValueAnnotationsVisible = true; a.shouldAvoidAxisAnnotationCollisions = true; } else { a.finalValueAnnotationsVisible = false; } } p(a, b) { this.c = b; a.captureTargetImageToClipboard(runOn(this, this.t)); } n(a, b) { this.m(a, b, "AxisFieldLabel"); } o(a, b) { this.m(a, b, "AxisFieldValue"); } m(a, b, c) { if (b.argumentsList.length != 3) { return; } let d = b.argumentsList[2].value; let e = (d[0]); let f = false; if (a.includedProperties != null) { let i = a.includedProperties; for (let h = 0; h < i.length; h++) { let g = i[h]; if (g == e) { f = true; break; } } } let j = false; if (a.excludedProperties != null) { let m = a.excludedProperties; for (let l = 0; l < m.length; l++) { let k = m[l]; if (k == e) { j = true; break; } } } if (this.f(b, c)) { if (a.includedProperties == null) { a.includedProperties = new Array(0); } if (!f) { let n = new Array(a.includedProperties.length + 1); for (let o = 0; o < a.includedProperties.length; ++o) { n[o] = a.includedProperties[o]; } n[a.includedProperties.length] = e; a.includedProperties = n; } if (j) { if (a.excludedProperties.length == 1) { a.excludedProperties = new Array(0); } else { let p = new Array(a.excludedProperties.length - 1); let q = -1; let r = 0; while (r < p.length) { q++; if (a.excludedProperties[q] == e) { continue; } p[r] = a.excludedProperties[q]; r++; } a.excludedProperties = p; } } } else if ((a.includedProperties == null || a.includedProperties.length == 0) && (this.g.count + this.h.count > 1)) { let s = this.g.count + this.h.count - 1; let t = new Array(s); let u = 0; for (let v of fromEnum(this.g)) { if (v.c == e) { continue; } t[u] = v.c; u++; } for (let w of fromEnum(this.h)) { if (w.c == e) { continue; } t[u] = w.c; u++; } a.includedProperties = t; } else if (f) { if (a.includedProperties.length == 1) { a.includedProperties = new Array(0); } else { let x = new Array(a.includedProperties.length - 1); let y = -1; let z = 0; while (z < x.length) { y++; if (a.includedProperties[y] == e) { continue; } x[z] = a.includedProperties[y]; z++; } a.includedProperties = x; } } } t(a, b) { let c = b; if (this.c.argumentsList == null || this.c.argumentsList.length < 1) { this.c.argumentsList = new Array(1); this.c.argumentsList[0] = ((() => { let $ret = new ToolCommandArgument(); $ret.argumentName = "image"; return $ret; })()); } this.c.argumentsList[0].value = c.base64Data; if (this.b != null) { this.b.sendCommandCompleted(this.c); } } ad(a, b) { a.zoomIn(0.05); } ae(a, b) { a.zoomOut(0.05); } af(a, b) { a.resetZoom(); } } DomainChartToolbarProvider.$t = markType(DomainChartToolbarProvider, 'DomainChartToolbarProvider', Base.$, [IDomainChartToolbarProvider_$type]); return DomainChartToolbarProvider; })();