igniteui-react-core
Version:
Ignite UI React Core.
111 lines (110 loc) • 3.94 kB
JavaScript
/*
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 { __extends } from "tslib";
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
*/
var SimpleGaugeRule = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SimpleGaugeRule, _super);
function SimpleGaugeRule() {
var _this = _super.call(this) || this;
_this._priority = 0;
_this.priority = 10;
return _this;
}
Object.defineProperty(SimpleGaugeRule.prototype, "priority", {
get: function () {
return this._priority;
},
set: function (a) {
this._priority = a;
},
enumerable: false,
configurable: true
});
SimpleGaugeRule.prototype.getPrimaryAxisLabelsString = function (a) {
return null;
};
SimpleGaugeRule.prototype.getPrimaryAxisLabelsStrings = function (a) {
return null;
};
SimpleGaugeRule.prototype.getAdditionalValuePropertyStrings = function (a) {
return null;
};
SimpleGaugeRule.prototype.evaluate = function (a) {
var b = 1;
var c = null;
var 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;
}
var 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 (var f = 0; f < c.length; f++) {
var g = new Array(1);
g[0] = c[f];
var h = a.analyzer.getTitleString(null, g);
var i = new DataSeries();
var j = new DataSeriesMemberPathHint();
j.intent = 0;
j.path = c[f];
i.addMemberPathHint(j);
i.suggestedSeries = 37;
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);
}
};
SimpleGaugeRule.prototype.a = function (a, b) {
if (!b.hasValidType(a)) {
a.suggestedSeries = 37;
if (b.hasValidType(a)) {
return;
}
a.suggestedSeries = 38;
if (b.hasValidType(a)) {
return;
}
}
};
SimpleGaugeRule.$t = markType(SimpleGaugeRule, 'SimpleGaugeRule', Base.$, [IDataSeriesAdapterRule_$type]);
return SimpleGaugeRule;
}(Base));
export { SimpleGaugeRule };