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 { vw() { super.vw(); if (this.dataChart == null) { return; } let a = this.dataChart.dp.j.e(); this.aia = a.d; this.aib = a.e; if (this.ahk == null) { this.ahk = a.k; } if (this.ahr == null) { this.ahr = a.k; } this.adf = 0; this.ahs = AxisDefaults.axis_MajorBrush; this.ahv = null; this.aho = AxisDefaults.axis_LineBrush; this.ahl = null; this.acw = AxisDefaults.categoryAxis_TickLength; this.ahp = AxisDefaults.axis_TickBrush; this.acx = AxisDefaults.axis_TickStroke; this.crosshairsAnnotationEnabled = true; this.gv = true; this.crosshairsDisplayMode = 0; this.jw = Defaults.crosshairLineThickness; this.y9 = Defaults.crosshairLineBrush; this.y4 = Defaults.crosshairXAxisAnnotationBackground; this.y5 = Defaults.crosshairXAxisAnnotationTextColor; this.aje = true; } vy(a, b) { super.vy(a, b); a.ki = this.akw; a.kj = this.akx; a.df = this.aiy; a.dg = this.aiz; } wr(a, b, c) { super.wr(a, b, c); switch (a) { case "TransitionInDuration": this.vl((d) => d.ki = this.akw); break; case "TransitionOutDuration": this.vl((d) => d.kj = this.akx); break; case "TransitionInEasingFunction": this.vl((d) => d.df = this.aiy); break; case "TransitionOutEasingFunction": this.vl((d) => d.dg = this.aiz); break; } } get akw() { return this.akt; } set akw(a) { let b = this.akw; if (a != b) { this.akt = a; this.wn("TransitionInDuration", b, this.akw); } } get akx() { return this.aku; } set akx(a) { let b = this.akx; if (a != b) { this.aku = a; this.wn("TransitionOutDuration", b, this.akx); } } get aiy() { return this.aiw; } set aiy(a) { let b = this.aiy; if (a != b) { this.aiw = a; this.wn("TransitionInEasingFunction", b, this.aiy); } } get aiz() { return this.aix; } set aiz(a) { let b = this.aiz; if (a != b) { this.aix = a; this.wn("TransitionOutEasingFunction", b, this.aiz); } } ak3() { let cvd_ = this.mc(); cvd_.scaleByViewport(); return (cvd_.serialize()); } vr(a, b) { super.vr(a, b); a.ez = this.gm; a.y9 = this.ajf; a.zc = this.ajg; a.zz = this.aj4; a.z0 = this.aj5; a.yc = this.aid; } vx(a, b) { super.vx(a, b); let c = typeCast(HorizontalAnchoredCategorySeries.$, a); if (c == null) { return; } c.aba = this.aij; c.zw = this.aje; c.zg = this.ail; c.c6 = this.aiv; c.trendLineBrush = ArrayExtension.getModulus$1(Brush.$, this.af, b); c.trendLineType = this.ed; c.trendLineThickness = this.kt; c.xl = this.c3(a, b); if (a.fn) { a.sc(ArrayExtension.getModulus$1(Brush.$, this.aia, b), ArrayExtension.getModulus$1(Brush.$, this.aib, b)); } } aim() { return new CategoryXAxis(); } aiq() { return new NumericYAxis(); } u7() { this.xAxis = this.aim(); this.xAxis.name = "xAxis"; let a = this.xAxis; a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.al7)); this.yAxis = this.aiq(); this.yAxis.name = "yAxis"; let b = this.yAxis; b.propertyChanged = delegateCombine(b.propertyChanged, runOn(this, this.al8)); if (this.xAxis.a3 == null) { this.xAxis.a3 = new AxisLabelSettings(); } if (this.yAxis.a3 == null) { this.yAxis.a3 = new AxisLabelSettings(); } } agk(a) { super.agk(a); a.o1 = this.aji; a.o6 = this.ajk; a.cr = this.ajj; } agi(a) { super.agi(a); a.cr = this.ajh; a.zoomMaximumCategoryRange = this.aki; a.zoomToCategoryRange = this.akk; a.zoomToCategoryStart = this.akl; a.zoomMaximumItemSpan = this.akj; a.zoomToItemSpan = this.akm; } get_cc() { return 0; } get cc() { return this.get_cc(); } get aih() { return this.aig; } set aih(a) { if (a != this.aig) { let b = this.aih; this.aig = a; this.wn("ChartType", enumGetBox(CategoryChartType_$type, b), enumGetBox(CategoryChartType_$type, this.aih)); } } get aij() { return this.aii; } set aij(a) { let b = this.aij; if (a != b) { this.aii = a; this.wn("MarkerCollisionAvoidance", enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, b), enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, this.aij)); } } get ajd() { return this.ai2; } set ajd(a) { let b = this.ajd; if (a != b) { this.ai2 = a; this.wn("IsSplineShapePartOfRange", b, this.ajd); } } get aje() { return this.ai3; } set aje(a) { let b = this.aje; if (a != b) { this.ai3 = a; this.wn("IsTransitionInEnabled", b, this.aje); } } get ail() { return this.aik; } set ail(a) { let b = this.ail; if (a != b) { this.aik = a; this.wn("TransitionInMode", enumGetBox(CategoryTransitionInMode_$type, b), enumGetBox(CategoryTransitionInMode_$type, this.ail)); } } get aiv() { return this.aiu; } set aiv(a) { let b = this.aiv; if (a != b) { this.aiu = a; this.wn("TransitionInSpeedType", enumGetBox(TransitionInSpeedType_$type, b), enumGetBox(TransitionInSpeedType_$type, this.aiv)); } } get akd() { return this.ajq; } set akd(a) { let b = this.akd; if (a != b) { this.ajq = a; this.wn("XAxisInterval", b, this.akd); } } get akg() { return this.ajt; } set akg(a) { let b = this.akg; if (a != b) { this.ajt = a; this.wn("XAxisMinorInterval", b, this.akg); } } get akc() { return this.ajp; } set akc(a) { let b = this.akc; if (a != b) { this.ajp = a; this.wn("XAxisGap", b, this.akc); } } get akf() { return this.ajs; } set akf(a) { let b = this.akf; if (a != b) { this.ajs = a; this.wn("XAxisMinimumGapSize", b, this.akf); } } get ake() { return this.ajr; } set ake(a) { let b = this.ake; if (a != b) { this.ajr = a; this.wn("XAxisMaximumGap", b, this.ake); } } get akh() { return this.aju; } set akh(a) { let b = this.akh; if (a != b) { this.aju = a; this.wn("XAxisOverlap", b, this.akh); } } get akp() { return this.aj0; } set akp(a) { let b = this.akp; if (a != b) { this.aj0 = a; this.wn("YAxisInterval", b, this.akp); } } get aid() { return this.aic; } set aid(a) { let b = this.aid; if (a != b) { this.aic = a; this.wn("AutoMarginAndAngleUpdateMode", enumGetBox(AutoMarginsAndAngleUpdateMode_$type, b), enumGetBox(AutoMarginsAndAngleUpdateMode_$type, this.aid)); } } al9() { if (this.dataChart != null) { this.dataChart.abk(); } } get ajf() { return this.ai4; } set ajf(a) { let b = this.ajf; if (a != b) { this.ai4 = a; this.wn("ShouldAutoExpandMarginForInitialLabels", b, this.ajf); } } get ajg() { return this.ai5; } set ajg(a) { let b = this.ajg; if (a != b) { this.ai5 = a; this.wn(CategoryChart.alc, b, this.ajg); } } get aj4() { return this.ajn; } set aj4(a) { let b = this.aj4; if (a != b) { this.ajn = a; this.wn("AutoExpandMarginExtraPadding", b, this.aj4); } } get aj5() { return this.ajo; } set aj5(a) { let b = this.aj5; if (a != b) { this.ajo = a; this.wn("AutoExpandMarginMaximumValue", b, this.aj5); } } get ajk() { return this.ai9; } set ajk(a) { let b = this.ajk; if (a != b) { this.ai9 = a; this.wn("YAxisFavorLabellingScaleEnd", b, this.ajk); } } get ajh() { return this.ai6; } set ajh(a) { let b = this.ajh; if (a != b) { this.ai6 = a; this.wn(CategoryChart.alj, b, this.ajh); } } get ajj() { return this.ai8; } set ajj(a) { let b = this.ajj; if (a != b) { this.ai8 = a; this.wn(CategoryChart.alx, b, this.ajj); } } get aif() { return this.aie; } set aif(a) { let b = this.aif; if (a != b) { this.aie = a; this.wn("YAxisAutoRangeBufferMode", enumGetBox(AxisRangeBufferMode_$type, b), enumGetBox(AxisRangeBufferMode_$type, this.aif)); } } get ajl() { return this.aja; } set ajl(a) { let b = this.ajl; if (a != b) { this.aja = a; this.wn("YAxisIsLogarithmic", b, this.ajl); } } get aky() { return this.akv; } set aky(a) { let b = this.aky; if (a != b) { this.akv = a; this.wn("YAxisLogarithmBase", b, this.aky); } } get akr() { return this.aj2; } set akr(a) { let b = this.akr; if (a != b) { this.aj2 = a; this.wn("YAxisMinimumValue", b, this.akr); } } get akq() { return this.aj1; } set akq(a) { let b = this.akq; if (a != b) { this.aj1 = a; this.wn("YAxisMaximumValue", b, this.akq); } } get aks() { return this.aj3; } set aks(a) { let b = this.aks; if (a != b) { this.aj3 = a; this.wn("YAxisMinorInterval", b, this.aks); } } get akb() { return this.xAxis.qp; } get aka() { return this.xAxis.qo; } aj7() { return this.akb; } aj9() { return this.ako; } aj6() { return this.aka; } aj8() { return this.akn; } get ako() { return this.yAxis.pr; } get akn() { return this.yAxis.pq; } get aia() { return this.ah8; } set aia(a) { let b = this.aia; if (a != b) { this.ah8 = a; this.wn("NegativeBrushes", b, this.aia); } } get aib() { return this.ah9; } set aib(a) { let b = this.aib; if (a != b) { this.ah9 = a; this.wn("NegativeOutlines", b, this.aib); } } get aji() { return this.ai7; } set aji(a) { let b = this.aji; if (a != b) { this.ai7 = a; this.wn("YAxisAbbreviateLargeNumbers", b, this.aji); } } get aki() { return this.ajv; } set aki(a) { let b = this.aki; if (a != b) { this.ajv = a; this.wn("XAxisZoomMaximumCategoryRange", b, this.aki); } } get akj() { return this.ajw; } set akj(a) { let b = this.akj; if (a != b) { this.ajw = a; this.wn("XAxisZoomMaximumItemSpan", b, this.akj); } } get akk() { return this.ajx; } set akk(a) { let b = this.akk; if (a != b) { this.ajx = a; this.wn("XAxisZoomToCategoryRange", b, this.akk); } } get akl() { return this.ajy; } set akl(a) { let b = this.akl; if (a != b) { this.ajy = a; this.wn("XAxisZoomToCategoryStart", b, this.akl); } } get akm() { return this.ajz; } set akm(a) { let b = this.akm; if (a != b) { this.ajz = a; this.wn("XAxisZoomToItemSpan", b, this.akm); } } get ajb() { return this.ai0; } set ajb(a) { let b = this.ajb; if (a != b) { this.ai0 = a; this.wn("IsCategoryHighlightingEnabled", b, this.ajb); } } get ajc() { return this.ai1; } set ajc(a) { let b = this.ajc; if (a != b) { this.ai1 = a; this.wn("IsItemHighlightingEnabled", b, this.ajc); } } constructor() { super(); this.akt = 1000; this.aku = 1000; this.aiw = null; this.aix = null; this.aig = 9; this.aii = 1; this.ai2 = false; this.ai3 = true; this.aik = 0; this.aiu = 0; this.ajq = 0; this.ajt = 0; this.ajp = 0; this.ajs = 0; this.ajr = 1; this.aju = 0; this.aj0 = NaN; this.aic = 1; this.ai4 = true; this.ai5 = true; this.ajn = DeviceUtils.g(2); this.ajo = DeviceUtils.g(60); this.ai9 = true; this.ai6 = true; this.ai8 = false; this.aie = 0; this.aja = false; this.akv = 10; this.aj2 = NaN; this.aj1 = NaN; this.aj3 = 0; this.ah8 = null; this.ah9 = null; this.ai7 = true; this.ajv = 3; this.ajw = NaN; this.ajx = NaN; this.ajy = NaN; this.ajz = NaN; this.ai0 = false; this.ai1 = false; this.ajm = null; DVContainer.instance.registerIfLoaded("CategoryChartToolbarFactoryManager"); this.vc(); } get_h7() { 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 h7() { return this.get_h7(); } id() { if (this.ajm == null) { this.ajm = CategoryChartMockDataGenerator.a(); } return this.ajm; } c2(a) { if (a != null) { let b = super.c2(a); if (b == 2) { if (a.fm && this.g6) { return 13; } } } return super.c2(a); } c4(a) { if (a != null) { let b = super.c2(a); if (b == 2) { if (a.fm && this.g6) { return 13; } } } return super.c4(a); } get_hp() { return true; } al7(a, b) { switch (b.propertyName) { case "ActualMinimum": this.w6("XAxisActualMinimum"); break; case "ActualMaximum": this.w6("XAxisActualMaximum"); break; } } al8(a, b) { switch (b.propertyName) { case "ActualMinimumValue": this.w6("YAxisActualMinimum"); break; case "ActualMaximumValue": this.w6("YAxisActualMaximum"); break; } } xl() { super.xl(); this.xAxis.hg = this.adp == null ? XYChart.ad1(this.xAxis, this.bg.dataSeries) : this.adp; this.xAxis.itemsSource = this.dataChart != null && this.dataChart.series.count > 0 ? this.dataChart.series._inner[0].itemsSource : null; if (this.ajf) { this.wb((a) => a.abk()); } } get xAxis() { return this._xAxis; } set xAxis(a) { this._xAxis = a; } get yAxis() { return this._yAxis; } set yAxis(a) { this._yAxis = a; } aip(a, b) { switch (a) { case 2: return this.dg(1); case 3: return this.dg(10); case 0: return this.dg(0); case 1: return this.dg(2); case 6: return this.dg(6); case 7: return this.dg(7); case 4: return this.dg(4); case 5: return this.dg(5); case 8: return this.dg(8); case 9: return this.aio(b); default: return this.dg(1); } } aio(a) { return this.dg(a); } bf(a) { switch (this.aih) { 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; } } dd(a, b) { let c = this.aip(this.aih, a.suggestedSeries); c.ab0 = a.findMatchingHint(0).path; c.xAxis = this.xAxis; c.yAxis = this.yAxis; return c; } xj(a) { if (a.suggestedSecondaryAxis == 2) { this.yAxis.pb = true; this.yAxis.qe = 10; } } xm() { this.yAxis.pb = this.ajl; this.yAxis.qe = this.aky; } get_h6() { return ((() => { let $ret = new List$1(IDataSeriesAdapterRule_$type, 0); $ret.add(new SimpleCategorySeriesRule()); $ret.add(new SubCollectionsRule()); return $ret; })()); } get h6() { return this.get_h6(); } u1(a, b) { let c = typeCast(HorizontalAnchoredCategorySeries.$, a); if (c != null) { c.aba = this.aij; c.xl = this.c3(a, b); } } al5(a) { this.al6((b, c) => a(b)); } al6(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); } } aaz() { return this.xAxis; } aa0() { return this.yAxis; } ais() { return this.dg(30); } ait() { return this.dg(31); } h3(a, b) { let c = super.h3(a, b); if (c != null) { let d = new List$1(Series.$, 0); if (this.ai0) { d.add(this.ais()); } if (this.ai1) { d.add(this.ait()); } for (let e = 0; e < d.count; e++) { let f = d._inner[e]; f.name = a + getInstanceType(f).typeName; c.add(f); } } return c; } bb() { if (this.ba == 0) { return 1; } else { return this.ba; } } xq(a, b, c) { super.xq(a, b, c); if (this.bg.dataSeries.count > 0) { if (stringIsNullOrEmpty(this.n6)) { this.cf.setXMemberPath(a, c.getMemberPathFor(16)); } if (stringIsNullOrEmpty(this.n8)) { this.cf.setYMemberPath(a, c.getMemberPathFor(0)); } if (stringIsNullOrEmpty(this.nt)) { this.cf.setLabelMemberPath(a, c.getMemberPathFor(0)); } if (stringIsNullOrEmpty(this.np)) { this.cf.setContentMemberPath(a, c.getMemberPathFor(0)); } } } g9() { if (this.crosshairsDisplayMode == 4 || this.crosshairsDisplayMode == 3) { return true; } else if (this.crosshairsDisplayMode == 0) { if (this.aih == 2 || this.aih == 8) { return false; } else if (this.aih == 9 && this.bg != null && this.bg.dataSeries != null && this.bg.dataSeries.count > 0) { let a = this.bg.dataSeries._inner[0].suggestedSeries; if (a == 1 || a == 8) { return false; } } return true; } return false; } get_hg() { return DVContainer.instance.checkLoaded("CategoryChartToolbarFactoryManager"); } wn(a, b, c) { super.wn(a, b, c); switch (a) { case "ChartType": this.vi(); break; case "MarkerCollisionAvoidance": this.al5((d) => d.aba = this.aij); break; case "IsTransitionInEnabled": this.al5((d) => d.zw = this.aje); break; case "IsSplineShapePartOfRange": this.al5((d) => { if (d.f1) { d.sd(this.ajd); } }); break; case "TransitionInMode": this.al5((d) => d.zg = this.ail); break; case "TransitionInSpeedType": this.al5((d) => d.c6 = this.aiv); break; case "XAxisInterval": this.xAxis.qk = this.akd; break; case "XAxisMinorInterval": this.xAxis.ql = this.akg; break; case "XAxisGap": this.xAxis.or = this.akc; break; case "XAxisOverlap": this.xAxis.o0 = this.akh; break; case "XAxisMinimumGapSize": this.xAxis.oz = this.akf; break; case "XAxisMaximumGap": this.xAxis.oy = this.ake; break; case "XAxisZoomMaximumCategoryRange": this.xAxis.zoomMaximumCategoryRange = this.aki; break; case "XAxisZoomMaximumItemSpan": this.xAxis.zoomMaximumItemSpan = this.akj; break; case "XAxisZoomToCategoryRange": this.xAxis.zoomToCategoryRange = this.akk; break; case "XAxisZoomToCategoryStart": this.xAxis.zoomToCategoryStart = this.akl; break; case "XAxisZoomToItemSpan": this.xAxis.zoomToItemSpan = this.akm; break; case "YAxisInterval": this.yAxis.pz = this.akp; break; case "YAxisFavorLabellingScaleEnd": this.yAxis.o6 = this.ajk; break; case "YAxisAutoRangeBufferMode": this.yAxis.ok = this.aif; break; case "YAxisIsLogarithmic": this.yAxis.pb = this.ajl; break; case "YAxisLogarithmBase": this.yAxis.qe = this.aky; break; case "YAxisMinimumValue": this.yAxis.p3 = this.akr; break; case "YAxisMaximumValue": this.yAxis.p2 = this.akq; break; case "YAxisMinorInterval": this.yAxis.p4 = this.aks; break; case "NegativeBrushes": case "NegativeOutlines": this.al6((d, e) => { if (d.fn) { d.sc(ArrayExtension.getModulus$1(Brush.$, this.aia, e), ArrayExtension.getModulus$1(Brush.$, this.aib, e)); } }); break; case "YAxisAbbreviateLargeNumbers": this.agr((d) => d.o1 = this.aji); break; case "IsCategoryHighlightingEnabled": case "IsItemHighlightingEnabled": this.vi(); break; case "AutoMarginAndAngleUpdateMode": this.wb((d) => d.yc = this.aid); break; case "ShouldAutoExpandMarginForInitialLabels": this.wb((d) => d.y9 = this.ajf); break; case CategoryChart.alc: this.wb((d) => d.zc = this.ajg); break; case "AutoExpandMarginExtraPadding": this.wb((d) => d.zz = this.aj4); break; case "AutoExpandMarginMaximumValue": this.wb((d) => d.z0 = this.aj5); break; case CategoryChart.alj: this.agn((d) => d.cr = this.ajh, a); break; case CategoryChart.alx: this.agr((d) => d.cr = this.ajj); break; } } } CategoryChart.$t = /*@__PURE__*/ markType(CategoryChart, 'CategoryChart', XYChart.$); CategoryChart.alc = "ShouldConsiderAutoRotationForInitialLabels"; CategoryChart.alj = "XAxisEnhancedIntervalPreferMoreCategoryLabels"; CategoryChart.alx = "YAxisEnhancedIntervalPreferMoreCategoryLabels"; return CategoryChart; })();