UNPKG

igniteui-react-core

Version:
105 lines (104 loc) 3.78 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, EnumUtil, markType } from "./type"; import { IDataSeriesAdapterRule_$type } from "./IDataSeriesAdapterRule"; import { DataSeriesIntent_$type } from "./DataSeriesIntent"; import { DataSeries } from "./DataSeries"; import { DataSeriesMemberPathHint } from "./DataSeriesMemberPathHint"; import { truncate } from "./number"; /** * @hidden */ export let SimpleGaugeRule = /*@__PURE__*/ (() => { class SimpleGaugeRule extends Base { constructor() { super(); this._priority = 0; this.priority = 10; } get priority() { return this._priority; } set priority(a) { this._priority = a; } getPrimaryAxisLabelsString(a) { return null; } getPrimaryAxisLabelsStrings(a) { return null; } getAdditionalValuePropertyStrings(a) { return null; } evaluate(a) { let b = 1; let c = null; let d = a.analyzer.getAllPropertiesWithIntent(EnumUtil.getName(DataSeriesIntent_$type, (0))); if (d.length > 0) { c = d; } if (c == null) { c = a.analyzer.getAllNumericProperties(); } if (c == null || c.length == 0) { return; } let e = a.getCurrentDataSource().actualCount; if (a.adjustPrioritiesBasedOnFitness && e == 1) { b *= 1.2; } if (a.adjustPrioritiesBasedOnFitness && e == 1 && c.length == 1) { b *= 1.2; } if (e != 1) { return; } for (let f = 0; f < c.length; f++) { let g = new Array(1); g[0] = c[f]; let h = a.analyzer.getTitleString(null, g); let i = new DataSeries(); let j = new DataSeriesMemberPathHint(); j.intent = 0; j.path = c[f]; i.addMemberPathHint(j); i.suggestedSeries = 36; this.a(i, a); i.suggestedPrimaryAxis = 9; i.suggestedSecondaryAxis = 9; i.name = c[f]; if (h != null) { i.title = h; } else { i.title = c[f]; i.title = a.analyzer.expandCamelCasedWords(i.title); } i.data = a.analyzer.getNonNullPropertyValue(c[f]); if (a.adjustPrioritiesBasedOnFitness) { i.priority = truncate(Math.round(this.priority * b)); } a.addDataSeries(i, this); } } a(a, b) { if (!b.hasValidType(a)) { a.suggestedSeries = 36; if (b.hasValidType(a)) { return; } a.suggestedSeries = 37; if (b.hasValidType(a)) { return; } } } } SimpleGaugeRule.$t = /*@__PURE__*/ markType(SimpleGaugeRule, 'SimpleGaugeRule', Base.$, [IDataSeriesAdapterRule_$type]); return SimpleGaugeRule; })();