UNPKG

igniteui-react-charts

Version:

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

1,045 lines (1,044 loc) 32.6 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 { XYChart } from "./XYChart"; import { typeCast, runOn, delegateCombine, enumGetBox, markType, TypeRegistrar, getInstanceType } from "igniteui-react-core"; import { CategoryChartType_$type } from "./CategoryChartType"; import { CategorySeriesMarkerCollisionAvoidance_$type } from "./CategorySeriesMarkerCollisionAvoidance"; import { CategoryTransitionInMode_$type } from "./CategoryTransitionInMode"; import { TransitionInSpeedType_$type } from "./TransitionInSpeedType"; import { AutoMarginsAndAngleUpdateMode_$type } from "./AutoMarginsAndAngleUpdateMode"; import { AxisRangeBufferMode_$type } from "./AxisRangeBufferMode"; import { CategoryXAxis } from "./CategoryXAxis"; import { List$1 } from "igniteui-react-core"; import { DataSeriesType_$type } from "igniteui-react-core"; import { NumericYAxis } from "./NumericYAxis"; import { IDataSeriesAdapterRule_$type } from "igniteui-react-core"; import { SimpleCategorySeriesRule } from "igniteui-react-core"; import { SubCollectionsRule } from "igniteui-react-core"; import { DVContainer } from "igniteui-react-core"; import { Brush } from "igniteui-react-core"; import { AxisDefaults } from "./AxisDefaults"; import { Defaults } from "./Defaults"; import { Series } from "./Series"; import { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries"; import { ArrayExtension } from "igniteui-react-core"; import { AxisLabelSettings } from "./AxisLabelSettings"; import { DeviceUtils } from "igniteui-react-core"; import { CategoryChartMockDataGenerator } from "./CategoryChartMockDataGenerator"; import { stringIsNullOrEmpty } from "igniteui-react-core"; /** * @hidden */ export let CategoryChart = /*@__PURE__*/ (() => { class CategoryChart extends XYChart { vd() { super.vd(); if (this.dataChart == null) { return; } let a = this.dataChart.c9.j.e(); this.ahd = a.d; this.ahe = a.e; if (this.agn == null) { this.agn = a.k; } if (this.agu == null) { this.agu = a.k; } this.acm = 0; this.agv = AxisDefaults.h; this.agy = null; this.agr = AxisDefaults.g; this.ago = null; this.ab5 = AxisDefaults.f; this.ags = AxisDefaults.j; this.ab6 = AxisDefaults.e; this.crosshairsAnnotationEnabled = true; this.gq = true; this.crosshairsDisplayMode = 0; this.jq = Defaults.j; this.yo = Defaults.ae; this.yj = Defaults.af; this.yk = Defaults.ag; this.aih = true; } vf(a, b) { super.vf(a, b); a.ke = this.ajz; a.kf = this.aj0; a.df = this.ah1; a.dg = this.ah2; } v7(a, b, c) { super.v7(a, b, c); switch (a) { case "TransitionInDuration": this.u2((d) => d.ke = this.ajz); break; case "TransitionOutDuration": this.u2((d) => d.kf = this.aj0); break; case "TransitionInEasingFunction": this.u2((d) => d.df = this.ah1); break; case "TransitionOutEasingFunction": this.u2((d) => d.dg = this.ah2); break; } } get ajz() { return this.ajw; } set ajz(a) { let b = this.ajz; if (a != b) { this.ajw = a; this.v3("TransitionInDuration", b, this.ajz); } } get aj0() { return this.ajx; } set aj0(a) { let b = this.aj0; if (a != b) { this.ajx = a; this.v3("TransitionOutDuration", b, this.aj0); } } get ah1() { return this.ahz; } set ah1(a) { let b = this.ah1; if (a != b) { this.ahz = a; this.v3("TransitionInEasingFunction", b, this.ah1); } } get ah2() { return this.ah0; } set ah2(a) { let b = this.ah2; if (a != b) { this.ah0 = a; this.v3("TransitionOutEasingFunction", b, this.ah2); } } aj6() { let cvd_ = this.lz(); cvd_.scaleByViewport(); return (cvd_.serialize()); } u8(a, b) { super.u8(a, b); a.ej = this.gj; a.xp = this.aii; a.xs = this.aij; a.yf = this.ai7; a.yg = this.ai8; a.wu = this.ahg; } ve(a, b) { super.ve(a, b); let c = typeCast(HorizontalAnchoredCategorySeries.$, a); if (c == null) { return; } c.aay = this.ahm; c.zn = this.aih; c.y7 = this.aho; c.c6 = this.ahy; c.trendLineBrush = ArrayExtension.getModulus$1(Brush.$, this.af, b); c.trendLineType = this.ec; c.trendLineThickness = this.km; c.xc = this.c2(a, b); if (a.fm) { a.r5(ArrayExtension.getModulus$1(Brush.$, this.ahd, b), ArrayExtension.getModulus$1(Brush.$, this.ahe, b)); } } ahp() { return new CategoryXAxis(); } aht() { return new NumericYAxis(); } uo() { this.xAxis = this.ahp(); this.xAxis.name = "xAxis"; let a = this.xAxis; a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.ala)); this.yAxis = this.aht(); this.yAxis.name = "yAxis"; let b = this.yAxis; b.propertyChanged = delegateCombine(b.propertyChanged, runOn(this, this.alb)); if (this.xAxis.az == null) { this.xAxis.az = new AxisLabelSettings(); } if (this.yAxis.az == null) { this.yAxis.az = new AxisLabelSettings(); } } afn(a) { super.afn(a); a.lf = this.ail; a.lj = this.ain; a.b1 = this.aim; } afl(a) { super.afl(a); a.b1 = this.aik; a.zoomMaximumCategoryRange = this.ajl; a.zoomToCategoryRange = this.ajn; a.zoomToCategoryStart = this.ajo; a.zoomMaximumItemSpan = this.ajm; a.zoomToItemSpan = this.ajp; } get_cb() { return 0; } get cb() { return this.get_cb(); } get ahk() { return this.ahj; } set ahk(a) { if (a != this.ahj) { let b = this.ahk; this.ahj = a; this.v3("ChartType", enumGetBox(CategoryChartType_$type, b), enumGetBox(CategoryChartType_$type, this.ahk)); } } get ahm() { return this.ahl; } set ahm(a) { let b = this.ahm; if (a != b) { this.ahl = a; this.v3("MarkerCollisionAvoidance", enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, b), enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, this.ahm)); } } get aig() { return this.ah5; } set aig(a) { let b = this.aig; if (a != b) { this.ah5 = a; this.v3("IsSplineShapePartOfRange", b, this.aig); } } get aih() { return this.ah6; } set aih(a) { let b = this.aih; if (a != b) { this.ah6 = a; this.v3("IsTransitionInEnabled", b, this.aih); } } get aho() { return this.ahn; } set aho(a) { let b = this.aho; if (a != b) { this.ahn = a; this.v3("TransitionInMode", enumGetBox(CategoryTransitionInMode_$type, b), enumGetBox(CategoryTransitionInMode_$type, this.aho)); } } get ahy() { return this.ahx; } set ahy(a) { let b = this.ahy; if (a != b) { this.ahx = a; this.v3("TransitionInSpeedType", enumGetBox(TransitionInSpeedType_$type, b), enumGetBox(TransitionInSpeedType_$type, this.ahy)); } } get ajg() { return this.ait; } set ajg(a) { let b = this.ajg; if (a != b) { this.ait = a; this.v3("XAxisInterval", b, this.ajg); } } get ajj() { return this.aiw; } set ajj(a) { let b = this.ajj; if (a != b) { this.aiw = a; this.v3("XAxisMinorInterval", b, this.ajj); } } get ajf() { return this.ais; } set ajf(a) { let b = this.ajf; if (a != b) { this.ais = a; this.v3("XAxisGap", b, this.ajf); } } get aji() { return this.aiv; } set aji(a) { let b = this.aji; if (a != b) { this.aiv = a; this.v3("XAxisMinimumGapSize", b, this.aji); } } get ajh() { return this.aiu; } set ajh(a) { let b = this.ajh; if (a != b) { this.aiu = a; this.v3("XAxisMaximumGap", b, this.ajh); } } get ajk() { return this.aix; } set ajk(a) { let b = this.ajk; if (a != b) { this.aix = a; this.v3("XAxisOverlap", b, this.ajk); } } get ajs() { return this.ai3; } set ajs(a) { let b = this.ajs; if (a != b) { this.ai3 = a; this.v3("YAxisInterval", b, this.ajs); } } get ahg() { return this.ahf; } set ahg(a) { let b = this.ahg; if (a != b) { this.ahf = a; this.v3("AutoMarginAndAngleUpdateMode", enumGetBox(AutoMarginsAndAngleUpdateMode_$type, b), enumGetBox(AutoMarginsAndAngleUpdateMode_$type, this.ahg)); } } alc() { if (this.dataChart != null) { this.dataChart.z0(); } } get aii() { return this.ah7; } set aii(a) { let b = this.aii; if (a != b) { this.ah7 = a; this.v3("ShouldAutoExpandMarginForInitialLabels", b, this.aii); } } get aij() { return this.ah8; } set aij(a) { let b = this.aij; if (a != b) { this.ah8 = a; this.v3(CategoryChart.akf, b, this.aij); } } get ai7() { return this.aiq; } set ai7(a) { let b = this.ai7; if (a != b) { this.aiq = a; this.v3("AutoExpandMarginExtraPadding", b, this.ai7); } } get ai8() { return this.air; } set ai8(a) { let b = this.ai8; if (a != b) { this.air = a; this.v3("AutoExpandMarginMaximumValue", b, this.ai8); } } get ain() { return this.aic; } set ain(a) { let b = this.ain; if (a != b) { this.aic = a; this.v3("YAxisFavorLabellingScaleEnd", b, this.ain); } } get aik() { return this.ah9; } set aik(a) { let b = this.aik; if (a != b) { this.ah9 = a; this.v3(CategoryChart.akm, b, this.aik); } } get aim() { return this.aib; } set aim(a) { let b = this.aim; if (a != b) { this.aib = a; this.v3(CategoryChart.ak0, b, this.aim); } } get ahi() { return this.ahh; } set ahi(a) { let b = this.ahi; if (a != b) { this.ahh = a; this.v3("YAxisAutoRangeBufferMode", enumGetBox(AxisRangeBufferMode_$type, b), enumGetBox(AxisRangeBufferMode_$type, this.ahi)); } } get aio() { return this.aid; } set aio(a) { let b = this.aio; if (a != b) { this.aid = a; this.v3("YAxisIsLogarithmic", b, this.aio); } } get aj1() { return this.ajy; } set aj1(a) { let b = this.aj1; if (a != b) { this.ajy = a; this.v3("YAxisLogarithmBase", b, this.aj1); } } get aju() { return this.ai5; } set aju(a) { let b = this.aju; if (a != b) { this.ai5 = a; this.v3("YAxisMinimumValue", b, this.aju); } } get ajt() { return this.ai4; } set ajt(a) { let b = this.ajt; if (a != b) { this.ai4 = a; this.v3("YAxisMaximumValue", b, this.ajt); } } get ajv() { return this.ai6; } set ajv(a) { let b = this.ajv; if (a != b) { this.ai6 = a; this.v3("YAxisMinorInterval", b, this.ajv); } } get aje() { return this.xAxis.m1; } get ajd() { return this.xAxis.m0; } aja() { return this.aje; } ajc() { return this.ajr; } ai9() { return this.ajd; } ajb() { return this.ajq; } get ajr() { return this.yAxis.l4; } get ajq() { return this.yAxis.l3; } get ahd() { return this.ahb; } set ahd(a) { let b = this.ahd; if (a != b) { this.ahb = a; this.v3("NegativeBrushes", b, this.ahd); } } get ahe() { return this.ahc; } set ahe(a) { let b = this.ahe; if (a != b) { this.ahc = a; this.v3("NegativeOutlines", b, this.ahe); } } get ail() { return this.aia; } set ail(a) { let b = this.ail; if (a != b) { this.aia = a; this.v3("YAxisAbbreviateLargeNumbers", b, this.ail); } } get ajl() { return this.aiy; } set ajl(a) { let b = this.ajl; if (a != b) { this.aiy = a; this.v3("XAxisZoomMaximumCategoryRange", b, this.ajl); } } get ajm() { return this.aiz; } set ajm(a) { let b = this.ajm; if (a != b) { this.aiz = a; this.v3("XAxisZoomMaximumItemSpan", b, this.ajm); } } get ajn() { return this.ai0; } set ajn(a) { let b = this.ajn; if (a != b) { this.ai0 = a; this.v3("XAxisZoomToCategoryRange", b, this.ajn); } } get ajo() { return this.ai1; } set ajo(a) { let b = this.ajo; if (a != b) { this.ai1 = a; this.v3("XAxisZoomToCategoryStart", b, this.ajo); } } get ajp() { return this.ai2; } set ajp(a) { let b = this.ajp; if (a != b) { this.ai2 = a; this.v3("XAxisZoomToItemSpan", b, this.ajp); } } get aie() { return this.ah3; } set aie(a) { let b = this.aie; if (a != b) { this.ah3 = a; this.v3("IsCategoryHighlightingEnabled", b, this.aie); } } get aif() { return this.ah4; } set aif(a) { let b = this.aif; if (a != b) { this.ah4 = a; this.v3("IsItemHighlightingEnabled", b, this.aif); } } constructor() { super(); this.ajw = 1000; this.ajx = 1000; this.ahz = null; this.ah0 = null; this.ahj = 9; this.ahl = 1; this.ah5 = false; this.ah6 = true; this.ahn = 0; this.ahx = 0; this.ait = 0; this.aiw = 0; this.ais = 0; this.aiv = 0; this.aiu = 1; this.aix = 0; this.ai3 = NaN; this.ahf = 1; this.ah7 = true; this.ah8 = true; this.aiq = DeviceUtils.g(2); this.air = DeviceUtils.g(60); this.aic = true; this.ah9 = true; this.aib = false; this.ahh = 0; this.aid = false; this.ajy = 10; this.ai5 = NaN; this.ai4 = NaN; this.ai6 = 0; this.ahb = null; this.ahc = null; this.aia = true; this.aiy = 3; this.aiz = NaN; this.ai0 = NaN; this.ai1 = NaN; this.ai2 = NaN; this.ah3 = false; this.ah4 = false; this.aip = null; DVContainer.instance.registerIfLoaded("CategoryChartToolbarFactoryManager"); this.ut(); } get_h2() { let a = new List$1(DataSeriesType_$type, 0); if (TypeRegistrar.isRegistered("AreaSeries")) { a.add(2); } if (TypeRegistrar.isRegistered("ColumnSeries")) { a.add(1); } if (TypeRegistrar.isRegistered("LineSeries")) { a.add(0); } if (TypeRegistrar.isRegistered("PointSeries")) { a.add(10); } if (TypeRegistrar.isRegistered("SplineSeries")) { a.add(6); } if (TypeRegistrar.isRegistered("SplineAreaSeries")) { a.add(7); } if (TypeRegistrar.isRegistered("StepAreaSeries")) { a.add(5); } if (TypeRegistrar.isRegistered("StepLineSeries")) { a.add(4); } if (TypeRegistrar.isRegistered("WaterfallSeries")) { a.add(8); } return a; } get h2() { return this.get_h2(); } h8() { if (this.aip == null) { this.aip = CategoryChartMockDataGenerator.a(); } return this.aip; } c1(a) { if (a != null) { let b = super.c1(a); if (b == 2) { if (a.fl && this.g1) { return 13; } } } return super.c1(a); } c3(a) { if (a != null) { let b = super.c1(a); if (b == 2) { if (a.fl && this.g1) { return 13; } } } return super.c3(a); } get_hk() { return true; } ala(a, b) { switch (b.propertyName) { case "ActualMinimum": this.wl("XAxisActualMinimum"); break; case "ActualMaximum": this.wl("XAxisActualMaximum"); break; } } alb(a, b) { switch (b.propertyName) { case "ActualMinimumValue": this.wl("YAxisActualMinimum"); break; case "ActualMaximumValue": this.wl("YAxisActualMaximum"); break; } } w0() { super.w0(); this.xAxis.f2 = this.acw == null ? XYChart.ac8(this.xAxis, this.bf.dataSeries) : this.acw; this.xAxis.itemsSource = this.dataChart != null && this.dataChart.series.count > 0 ? this.dataChart.series._inner[0].itemsSource : null; if (this.aii) { this.vs((a) => a.z0()); } } get xAxis() { return this._xAxis; } set xAxis(a) { this._xAxis = a; } get yAxis() { return this._yAxis; } set yAxis(a) { this._yAxis = a; } ahs(a, b) { switch (a) { case 2: return this.df(1); case 3: return this.df(10); case 0: return this.df(0); case 1: return this.df(2); case 6: return this.df(6); case 7: return this.df(7); case 4: return this.df(4); case 5: return this.df(5); case 8: return this.df(8); case 9: return this.ahr(b); default: return this.df(1); } } ahr(a) { return this.df(a); } be(a) { switch (this.ahk) { case 1: return 2; case 0: return 0; case 3: return 10; case 6: return 6; case 7: return 7; case 5: return 5; case 4: return 4; case 8: return 8; case 9: return a.suggestedSeries; default: case 2: return 1; } } dc(a, b) { let c = this.ahs(this.ahk, a.suggestedSeries); c.abo = a.findMatchingHint(0).path; c.xAxis = this.xAxis; c.yAxis = this.yAxis; return c; } wy(a) { if (a.suggestedSecondaryAxis == 2) { this.yAxis.lo = true; this.yAxis.mm = 10; } } w1() { this.yAxis.lo = this.aio; this.yAxis.mm = this.aj1; } get_h1() { return ((() => { let $ret = new List$1(IDataSeriesAdapterRule_$type, 0); $ret.add(new SimpleCategorySeriesRule()); $ret.add(new SubCollectionsRule()); return $ret; })()); } get h1() { return this.get_h1(); } ui(a, b) { let c = typeCast(HorizontalAnchoredCategorySeries.$, a); if (c != null) { c.aay = this.ahm; c.xc = this.c2(a, b); } } ak8(a) { this.ak9((b, c) => a(b)); } ak9(a) { if (this.dataChart == null) { return; } for (let b = 0; b < this.dataChart.series.count; b++) { let c = typeCast(HorizontalAnchoredCategorySeries.$, this.dataChart.series._inner[b]); if (c == null) { continue; } a(c, b); } } aae() { return this.xAxis; } aaf() { return this.yAxis; } ahv() { return this.df(30); } ahw() { return this.df(31); } hy(a, b) { let c = super.hy(a, b); if (c != null) { let d = new List$1(Series.$, 0); if (this.ah3) { d.add(this.ahv()); } if (this.ah4) { d.add(this.ahw()); } for (let e = 0; e < d.count; e++) { let f = d._inner[e]; f.name = a + getInstanceType(f).typeName; c.add(f); } } return c; } ba() { if (this.a9 == 0) { return 1; } else { return this.a9; } } w5(a, b, c) { super.w5(a, b, c); if (this.bf.dataSeries.count > 0) { if (stringIsNullOrEmpty(this.nt)) { this.ce.setXMemberPath(a, c.getMemberPathFor(16)); } if (stringIsNullOrEmpty(this.nv)) { this.ce.setYMemberPath(a, c.getMemberPathFor(0)); } if (stringIsNullOrEmpty(this.ng)) { this.ce.setLabelMemberPath(a, c.getMemberPathFor(0)); } if (stringIsNullOrEmpty(this.nc)) { this.ce.setContentMemberPath(a, c.getMemberPathFor(0)); } } } g4() { if (this.crosshairsDisplayMode == 4 || this.crosshairsDisplayMode == 3) { return true; } else if (this.crosshairsDisplayMode == 0) { if (this.ahk == 2 || this.ahk == 8) { return false; } else if (this.ahk == 9 && this.bf != null && this.bf.dataSeries != null && this.bf.dataSeries.count > 0) { let a = this.bf.dataSeries._inner[0].suggestedSeries; if (a == 1 || a == 8) { return false; } } return true; } return false; } get_hb() { return DVContainer.instance.checkLoaded("CategoryChartToolbarFactoryManager"); } v3(a, b, c) { super.v3(a, b, c); switch (a) { case "ChartType": this.uz(); break; case "MarkerCollisionAvoidance": this.ak8((d) => d.aay = this.ahm); break; case "IsTransitionInEnabled": this.ak8((d) => d.zn = this.aih); break; case "IsSplineShapePartOfRange": this.ak8((d) => { if (d.f0) { d.r6(this.aig); } }); break; case "TransitionInMode": this.ak8((d) => d.y7 = this.aho); break; case "TransitionInSpeedType": this.ak8((d) => d.c6 = this.ahy); break; case "XAxisInterval": this.xAxis.mw = this.ajg; break; case "XAxisMinorInterval": this.xAxis.mx = this.ajj; break; case "XAxisGap": this.xAxis.k5 = this.ajf; break; case "XAxisOverlap": this.xAxis.le = this.ajk; break; case "XAxisMinimumGapSize": this.xAxis.ld = this.aji; break; case "XAxisMaximumGap": this.xAxis.lc = this.ajh; break; case "XAxisZoomMaximumCategoryRange": this.xAxis.zoomMaximumCategoryRange = this.ajl; break; case "XAxisZoomMaximumItemSpan": this.xAxis.zoomMaximumItemSpan = this.ajm; break; case "XAxisZoomToCategoryRange": this.xAxis.zoomToCategoryRange = this.ajn; break; case "XAxisZoomToCategoryStart": this.xAxis.zoomToCategoryStart = this.ajo; break; case "XAxisZoomToItemSpan": this.xAxis.zoomToItemSpan = this.ajp; break; case "YAxisInterval": this.yAxis.l8 = this.ajs; break; case "YAxisFavorLabellingScaleEnd": this.yAxis.lj = this.ain; break; case "YAxisAutoRangeBufferMode": this.yAxis.ky = this.ahi; break; case "YAxisIsLogarithmic": this.yAxis.lo = this.aio; break; case "YAxisLogarithmBase": this.yAxis.mm = this.aj1; break; case "YAxisMinimumValue": this.yAxis.mc = this.aju; break; case "YAxisMaximumValue": this.yAxis.mb = this.ajt; break; case "YAxisMinorInterval": this.yAxis.md = this.ajv; break; case "NegativeBrushes": case "NegativeOutlines": this.ak9((d, e) => { if (d.fm) { d.r5(ArrayExtension.getModulus$1(Brush.$, this.ahd, e), ArrayExtension.getModulus$1(Brush.$, this.ahe, e)); } }); break; case "YAxisAbbreviateLargeNumbers": this.afu((d) => d.lf = this.ail); break; case "IsCategoryHighlightingEnabled": case "IsItemHighlightingEnabled": this.uz(); break; case "AutoMarginAndAngleUpdateMode": this.vs((d) => d.wu = this.ahg); break; case "ShouldAutoExpandMarginForInitialLabels": this.vs((d) => d.xp = this.aii); break; case CategoryChart.akf: this.vs((d) => d.xs = this.aij); break; case "AutoExpandMarginExtraPadding": this.vs((d) => d.yf = this.ai7); break; case "AutoExpandMarginMaximumValue": this.vs((d) => d.yg = this.ai8); break; case CategoryChart.akm: this.afq((d) => d.b1 = this.aik, a); break; case CategoryChart.ak0: this.afu((d) => d.b1 = this.aim); break; } } } CategoryChart.$t = /*@__PURE__*/ markType(CategoryChart, 'CategoryChart', XYChart.$); CategoryChart.akf = "ShouldConsiderAutoRotationForInitialLabels"; CategoryChart.akm = "XAxisEnhancedIntervalPreferMoreCategoryLabels"; CategoryChart.ak0 = "YAxisEnhancedIntervalPreferMoreCategoryLabels"; return CategoryChart; })();