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.8 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 { vs() { super.vs(); if (this.dataChart == null) { return; } let a = this.dataChart.dc.j.e(); this.ah5 = a.d; this.ah6 = a.e; if (this.ahf == null) { this.ahf = a.k; } if (this.ahm == null) { this.ahm = a.k; } this.ada = 0; this.ahn = AxisDefaults.axis_MajorBrush; this.ahq = null; this.ahj = AxisDefaults.axis_LineBrush; this.ahg = null; this.acr = AxisDefaults.categoryAxis_TickLength; this.ahk = AxisDefaults.axis_TickBrush; this.acs = AxisDefaults.axis_TickStroke; this.crosshairsAnnotationEnabled = true; this.gu = true; this.crosshairsDisplayMode = 0; this.ju = Defaults.crosshairLineThickness; this.y4 = Defaults.crosshairLineBrush; this.yz = Defaults.crosshairXAxisAnnotationBackground; this.y0 = Defaults.crosshairXAxisAnnotationTextColor; this.ai9 = true; } vu(a, b) { super.vu(a, b); a.kf = this.akr; a.kg = this.aks; a.df = this.ait; a.dg = this.aiu; } wn(a, b, c) { super.wn(a, b, c); switch (a) { case "TransitionInDuration": this.vh((d) => d.kf = this.akr); break; case "TransitionOutDuration": this.vh((d) => d.kg = this.aks); break; case "TransitionInEasingFunction": this.vh((d) => d.df = this.ait); break; case "TransitionOutEasingFunction": this.vh((d) => d.dg = this.aiu); break; } } get akr() { return this.ako; } set akr(a) { let b = this.akr; if (a != b) { this.ako = a; this.wj("TransitionInDuration", b, this.akr); } } get aks() { return this.akp; } set aks(a) { let b = this.aks; if (a != b) { this.akp = a; this.wj("TransitionOutDuration", b, this.aks); } } get ait() { return this.air; } set ait(a) { let b = this.ait; if (a != b) { this.air = a; this.wj("TransitionInEasingFunction", b, this.ait); } } get aiu() { return this.ais; } set aiu(a) { let b = this.aiu; if (a != b) { this.ais = a; this.wj("TransitionOutEasingFunction", b, this.aiu); } } aky() { let cvd_ = this.l9(); cvd_.scaleByViewport(); return (cvd_.serialize()); } vn(a, b) { super.vn(a, b); a.en = this.gl; a.yd = this.aja; a.yg = this.ajb; a.y3 = this.ajz; a.y4 = this.aj0; a.xi = this.ah8; } vt(a, b) { super.vt(a, b); let c = typeCast(HorizontalAnchoredCategorySeries.$, a); if (c == null) { return; } c.aa4 = this.aie; c.zq = this.ai9; c.za = this.aig; c.c6 = this.aiq; c.trendLineBrush = ArrayExtension.getModulus$1(Brush.$, this.af, b); c.trendLineType = this.ec; c.trendLineThickness = this.kq; c.xf = this.c2(a, b); if (a.fn) { a.r7(ArrayExtension.getModulus$1(Brush.$, this.ah5, b), ArrayExtension.getModulus$1(Brush.$, this.ah6, b)); } } aih() { return new CategoryXAxis(); } ail() { return new NumericYAxis(); } u3() { this.xAxis = this.aih(); this.xAxis.name = "xAxis"; let a = this.xAxis; a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.al2)); this.yAxis = this.ail(); this.yAxis.name = "yAxis"; let b = this.yAxis; b.propertyChanged = delegateCombine(b.propertyChanged, runOn(this, this.al3)); if (this.xAxis.az == null) { this.xAxis.az = new AxisLabelSettings(); } if (this.yAxis.az == null) { this.yAxis.az = new AxisLabelSettings(); } } agf(a) { super.agf(a); a.lf = this.ajd; a.lj = this.ajf; a.b1 = this.aje; } agd(a) { super.agd(a); a.b1 = this.ajc; a.zoomMaximumCategoryRange = this.akd; a.zoomToCategoryRange = this.akf; a.zoomToCategoryStart = this.akg; a.zoomMaximumItemSpan = this.ake; a.zoomToItemSpan = this.akh; } get_cb() { return 0; } get cb() { return this.get_cb(); } get aic() { return this.aib; } set aic(a) { if (a != this.aib) { let b = this.aic; this.aib = a; this.wj("ChartType", enumGetBox(CategoryChartType_$type, b), enumGetBox(CategoryChartType_$type, this.aic)); } } get aie() { return this.aid; } set aie(a) { let b = this.aie; if (a != b) { this.aid = a; this.wj("MarkerCollisionAvoidance", enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, b), enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, this.aie)); } } get ai8() { return this.aix; } set ai8(a) { let b = this.ai8; if (a != b) { this.aix = a; this.wj("IsSplineShapePartOfRange", b, this.ai8); } } get ai9() { return this.aiy; } set ai9(a) { let b = this.ai9; if (a != b) { this.aiy = a; this.wj("IsTransitionInEnabled", b, this.ai9); } } get aig() { return this.aif; } set aig(a) { let b = this.aig; if (a != b) { this.aif = a; this.wj("TransitionInMode", enumGetBox(CategoryTransitionInMode_$type, b), enumGetBox(CategoryTransitionInMode_$type, this.aig)); } } get aiq() { return this.aip; } set aiq(a) { let b = this.aiq; if (a != b) { this.aip = a; this.wj("TransitionInSpeedType", enumGetBox(TransitionInSpeedType_$type, b), enumGetBox(TransitionInSpeedType_$type, this.aiq)); } } get aj8() { return this.ajl; } set aj8(a) { let b = this.aj8; if (a != b) { this.ajl = a; this.wj("XAxisInterval", b, this.aj8); } } get akb() { return this.ajo; } set akb(a) { let b = this.akb; if (a != b) { this.ajo = a; this.wj("XAxisMinorInterval", b, this.akb); } } get aj7() { return this.ajk; } set aj7(a) { let b = this.aj7; if (a != b) { this.ajk = a; this.wj("XAxisGap", b, this.aj7); } } get aka() { return this.ajn; } set aka(a) { let b = this.aka; if (a != b) { this.ajn = a; this.wj("XAxisMinimumGapSize", b, this.aka); } } get aj9() { return this.ajm; } set aj9(a) { let b = this.aj9; if (a != b) { this.ajm = a; this.wj("XAxisMaximumGap", b, this.aj9); } } get akc() { return this.ajp; } set akc(a) { let b = this.akc; if (a != b) { this.ajp = a; this.wj("XAxisOverlap", b, this.akc); } } get akk() { return this.ajv; } set akk(a) { let b = this.akk; if (a != b) { this.ajv = a; this.wj("YAxisInterval", b, this.akk); } } get ah8() { return this.ah7; } set ah8(a) { let b = this.ah8; if (a != b) { this.ah7 = a; this.wj("AutoMarginAndAngleUpdateMode", enumGetBox(AutoMarginsAndAngleUpdateMode_$type, b), enumGetBox(AutoMarginsAndAngleUpdateMode_$type, this.ah8)); } } al4() { if (this.dataChart != null) { this.dataChart.aao(); } } get aja() { return this.aiz; } set aja(a) { let b = this.aja; if (a != b) { this.aiz = a; this.wj("ShouldAutoExpandMarginForInitialLabels", b, this.aja); } } get ajb() { return this.ai0; } set ajb(a) { let b = this.ajb; if (a != b) { this.ai0 = a; this.wj(CategoryChart.ak7, b, this.ajb); } } get ajz() { return this.aji; } set ajz(a) { let b = this.ajz; if (a != b) { this.aji = a; this.wj("AutoExpandMarginExtraPadding", b, this.ajz); } } get aj0() { return this.ajj; } set aj0(a) { let b = this.aj0; if (a != b) { this.ajj = a; this.wj("AutoExpandMarginMaximumValue", b, this.aj0); } } get ajf() { return this.ai4; } set ajf(a) { let b = this.ajf; if (a != b) { this.ai4 = a; this.wj("YAxisFavorLabellingScaleEnd", b, this.ajf); } } get ajc() { return this.ai1; } set ajc(a) { let b = this.ajc; if (a != b) { this.ai1 = a; this.wj(CategoryChart.ale, b, this.ajc); } } get aje() { return this.ai3; } set aje(a) { let b = this.aje; if (a != b) { this.ai3 = a; this.wj(CategoryChart.als, b, this.aje); } } get aia() { return this.ah9; } set aia(a) { let b = this.aia; if (a != b) { this.ah9 = a; this.wj("YAxisAutoRangeBufferMode", enumGetBox(AxisRangeBufferMode_$type, b), enumGetBox(AxisRangeBufferMode_$type, this.aia)); } } get ajg() { return this.ai5; } set ajg(a) { let b = this.ajg; if (a != b) { this.ai5 = a; this.wj("YAxisIsLogarithmic", b, this.ajg); } } get akt() { return this.akq; } set akt(a) { let b = this.akt; if (a != b) { this.akq = a; this.wj("YAxisLogarithmBase", b, this.akt); } } get akm() { return this.ajx; } set akm(a) { let b = this.akm; if (a != b) { this.ajx = a; this.wj("YAxisMinimumValue", b, this.akm); } } get akl() { return this.ajw; } set akl(a) { let b = this.akl; if (a != b) { this.ajw = a; this.wj("YAxisMaximumValue", b, this.akl); } } get akn() { return this.ajy; } set akn(a) { let b = this.akn; if (a != b) { this.ajy = a; this.wj("YAxisMinorInterval", b, this.akn); } } get aj6() { return this.xAxis.m1; } get aj5() { return this.xAxis.m0; } aj2() { return this.aj6; } aj4() { return this.akj; } aj1() { return this.aj5; } aj3() { return this.aki; } get akj() { return this.yAxis.l4; } get aki() { return this.yAxis.l3; } get ah5() { return this.ah3; } set ah5(a) { let b = this.ah5; if (a != b) { this.ah3 = a; this.wj("NegativeBrushes", b, this.ah5); } } get ah6() { return this.ah4; } set ah6(a) { let b = this.ah6; if (a != b) { this.ah4 = a; this.wj("NegativeOutlines", b, this.ah6); } } get ajd() { return this.ai2; } set ajd(a) { let b = this.ajd; if (a != b) { this.ai2 = a; this.wj("YAxisAbbreviateLargeNumbers", b, this.ajd); } } get akd() { return this.ajq; } set akd(a) { let b = this.akd; if (a != b) { this.ajq = a; this.wj("XAxisZoomMaximumCategoryRange", b, this.akd); } } get ake() { return this.ajr; } set ake(a) { let b = this.ake; if (a != b) { this.ajr = a; this.wj("XAxisZoomMaximumItemSpan", b, this.ake); } } get akf() { return this.ajs; } set akf(a) { let b = this.akf; if (a != b) { this.ajs = a; this.wj("XAxisZoomToCategoryRange", b, this.akf); } } get akg() { return this.ajt; } set akg(a) { let b = this.akg; if (a != b) { this.ajt = a; this.wj("XAxisZoomToCategoryStart", b, this.akg); } } get akh() { return this.aju; } set akh(a) { let b = this.akh; if (a != b) { this.aju = a; this.wj("XAxisZoomToItemSpan", b, this.akh); } } get ai6() { return this.aiv; } set ai6(a) { let b = this.ai6; if (a != b) { this.aiv = a; this.wj("IsCategoryHighlightingEnabled", b, this.ai6); } } get ai7() { return this.aiw; } set ai7(a) { let b = this.ai7; if (a != b) { this.aiw = a; this.wj("IsItemHighlightingEnabled", b, this.ai7); } } constructor() { super(); this.ako = 1000; this.akp = 1000; this.air = null; this.ais = null; this.aib = 9; this.aid = 1; this.aix = false; this.aiy = true; this.aif = 0; this.aip = 0; this.ajl = 0; this.ajo = 0; this.ajk = 0; this.ajn = 0; this.ajm = 1; this.ajp = 0; this.ajv = NaN; this.ah7 = 1; this.aiz = true; this.ai0 = true; this.aji = DeviceUtils.g(2); this.ajj = DeviceUtils.g(60); this.ai4 = true; this.ai1 = true; this.ai3 = false; this.ah9 = 0; this.ai5 = false; this.akq = 10; this.ajx = NaN; this.ajw = NaN; this.ajy = 0; this.ah3 = null; this.ah4 = null; this.ai2 = true; this.ajq = 3; this.ajr = NaN; this.ajs = NaN; this.ajt = NaN; this.aju = NaN; this.aiv = false; this.aiw = false; this.ajh = null; DVContainer.instance.registerIfLoaded("CategoryChartToolbarFactoryManager"); this.u8(); } get_h6() { 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 h6() { return this.get_h6(); } ic() { if (this.ajh == null) { this.ajh = CategoryChartMockDataGenerator.a(); } return this.ajh; } c1(a) { if (a != null) { let b = super.c1(a); if (b == 2) { if (a.fm && this.g5) { return 13; } } } return super.c1(a); } c3(a) { if (a != null) { let b = super.c1(a); if (b == 2) { if (a.fm && this.g5) { return 13; } } } return super.c3(a); } get_ho() { return true; } al2(a, b) { switch (b.propertyName) { case "ActualMinimum": this.w1("XAxisActualMinimum"); break; case "ActualMaximum": this.w1("XAxisActualMaximum"); break; } } al3(a, b) { switch (b.propertyName) { case "ActualMinimumValue": this.w1("YAxisActualMinimum"); break; case "ActualMaximumValue": this.w1("YAxisActualMaximum"); break; } } xg() { super.xg(); this.xAxis.f2 = this.adk == null ? XYChart.adw(this.xAxis, this.bf.dataSeries) : this.adk; this.xAxis.itemsSource = this.dataChart != null && this.dataChart.series.count > 0 ? this.dataChart.series._inner[0].itemsSource : null; if (this.aja) { this.v7((a) => a.aao()); } } get xAxis() { return this._xAxis; } set xAxis(a) { this._xAxis = a; } get yAxis() { return this._yAxis; } set yAxis(a) { this._yAxis = a; } aik(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.aij(b); default: return this.df(1); } } aij(a) { return this.df(a); } be(a) { switch (this.aic) { 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.aik(this.aic, a.suggestedSeries); c.abu = a.findMatchingHint(0).path; c.xAxis = this.xAxis; c.yAxis = this.yAxis; return c; } xe(a) { if (a.suggestedSecondaryAxis == 2) { this.yAxis.lo = true; this.yAxis.mm = 10; } } xh() { this.yAxis.lo = this.ajg; this.yAxis.mm = this.akt; } get_h5() { return ((() => { let $ret = new List$1(IDataSeriesAdapterRule_$type, 0); $ret.add(new SimpleCategorySeriesRule()); $ret.add(new SubCollectionsRule()); return $ret; })()); } get h5() { return this.get_h5(); } ux(a, b) { let c = typeCast(HorizontalAnchoredCategorySeries.$, a); if (c != null) { c.aa4 = this.aie; c.xf = this.c2(a, b); } } al0(a) { this.al1((b, c) => a(b)); } al1(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); } } aau() { return this.xAxis; } aav() { return this.yAxis; } ain() { return this.df(30); } aio() { return this.df(31); } h2(a, b) { let c = super.h2(a, b); if (c != null) { let d = new List$1(Series.$, 0); if (this.aiv) { d.add(this.ain()); } if (this.aiw) { d.add(this.aio()); } 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; } } xl(a, b, c) { super.xl(a, b, c); if (this.bf.dataSeries.count > 0) { if (stringIsNullOrEmpty(this.n3)) { this.ce.setXMemberPath(a, c.getMemberPathFor(16)); } if (stringIsNullOrEmpty(this.n5)) { this.ce.setYMemberPath(a, c.getMemberPathFor(0)); } if (stringIsNullOrEmpty(this.nq)) { this.ce.setLabelMemberPath(a, c.getMemberPathFor(0)); } if (stringIsNullOrEmpty(this.nm)) { this.ce.setContentMemberPath(a, c.getMemberPathFor(0)); } } } g8() { if (this.crosshairsDisplayMode == 4 || this.crosshairsDisplayMode == 3) { return true; } else if (this.crosshairsDisplayMode == 0) { if (this.aic == 2 || this.aic == 8) { return false; } else if (this.aic == 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_hf() { return DVContainer.instance.checkLoaded("CategoryChartToolbarFactoryManager"); } wj(a, b, c) { super.wj(a, b, c); switch (a) { case "ChartType": this.ve(); break; case "MarkerCollisionAvoidance": this.al0((d) => d.aa4 = this.aie); break; case "IsTransitionInEnabled": this.al0((d) => d.zq = this.ai9); break; case "IsSplineShapePartOfRange": this.al0((d) => { if (d.f1) { d.r8(this.ai8); } }); break; case "TransitionInMode": this.al0((d) => d.za = this.aig); break; case "TransitionInSpeedType": this.al0((d) => d.c6 = this.aiq); break; case "XAxisInterval": this.xAxis.mw = this.aj8; break; case "XAxisMinorInterval": this.xAxis.mx = this.akb; break; case "XAxisGap": this.xAxis.k5 = this.aj7; break; case "XAxisOverlap": this.xAxis.le = this.akc; break; case "XAxisMinimumGapSize": this.xAxis.ld = this.aka; break; case "XAxisMaximumGap": this.xAxis.lc = this.aj9; break; case "XAxisZoomMaximumCategoryRange": this.xAxis.zoomMaximumCategoryRange = this.akd; break; case "XAxisZoomMaximumItemSpan": this.xAxis.zoomMaximumItemSpan = this.ake; break; case "XAxisZoomToCategoryRange": this.xAxis.zoomToCategoryRange = this.akf; break; case "XAxisZoomToCategoryStart": this.xAxis.zoomToCategoryStart = this.akg; break; case "XAxisZoomToItemSpan": this.xAxis.zoomToItemSpan = this.akh; break; case "YAxisInterval": this.yAxis.l8 = this.akk; break; case "YAxisFavorLabellingScaleEnd": this.yAxis.lj = this.ajf; break; case "YAxisAutoRangeBufferMode": this.yAxis.ky = this.aia; break; case "YAxisIsLogarithmic": this.yAxis.lo = this.ajg; break; case "YAxisLogarithmBase": this.yAxis.mm = this.akt; break; case "YAxisMinimumValue": this.yAxis.mc = this.akm; break; case "YAxisMaximumValue": this.yAxis.mb = this.akl; break; case "YAxisMinorInterval": this.yAxis.md = this.akn; break; case "NegativeBrushes": case "NegativeOutlines": this.al1((d, e) => { if (d.fn) { d.r7(ArrayExtension.getModulus$1(Brush.$, this.ah5, e), ArrayExtension.getModulus$1(Brush.$, this.ah6, e)); } }); break; case "YAxisAbbreviateLargeNumbers": this.agm((d) => d.lf = this.ajd); break; case "IsCategoryHighlightingEnabled": case "IsItemHighlightingEnabled": this.ve(); break; case "AutoMarginAndAngleUpdateMode": this.v7((d) => d.xi = this.ah8); break; case "ShouldAutoExpandMarginForInitialLabels": this.v7((d) => d.yd = this.aja); break; case CategoryChart.ak7: this.v7((d) => d.yg = this.ajb); break; case "AutoExpandMarginExtraPadding": this.v7((d) => d.y3 = this.ajz); break; case "AutoExpandMarginMaximumValue": this.v7((d) => d.y4 = this.aj0); break; case CategoryChart.ale: this.agi((d) => d.b1 = this.ajc, a); break; case CategoryChart.als: this.agm((d) => d.b1 = this.aje); break; } } } CategoryChart.$t = /*@__PURE__*/ markType(CategoryChart, 'CategoryChart', XYChart.$); CategoryChart.ak7 = "ShouldConsiderAutoRotationForInitialLabels"; CategoryChart.ale = "XAxisEnhancedIntervalPreferMoreCategoryLabels"; CategoryChart.als = "YAxisEnhancedIntervalPreferMoreCategoryLabels"; return CategoryChart; })();