igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
159 lines (158 loc) • 6.44 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, INotifyPropertyChanged_$type, PropertyChangedEventArgs, enumGetBox, markType } from "igniteui-angular-core";
import { TimeAxisIntervalType_$type } from "./TimeAxisIntervalType";
import { truncate } from "igniteui-angular-core";
import { dateAddSeconds, dateFromValues, dateGetMonth, dateAddMinutes, dateAddHours, dateAddDays, dateMaxValue, dateAddMonths, dateAddYears } from "igniteui-angular-core";
import { timeSpanFromTicks, timeSpanFromMilliseconds, timeSpanFromSeconds, timeSpanFromMinutes, timeSpanFromHours, timeSpanFromDays } from "igniteui-angular-core";
/**
* @hidden
*/
var TimeAxisInterval = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(TimeAxisInterval, _super);
function TimeAxisInterval() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.j = (0);
_this.e = 0;
_this.a = 0;
_this.propertyChanged = null;
return _this;
}
Object.defineProperty(TimeAxisInterval.prototype, "k", {
get: function () {
return this.j;
},
set: function (a) {
var b = this.k;
if (a != b) {
this.j = a;
this.l("Range", b, this.k);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(TimeAxisInterval.prototype, "f", {
get: function () {
return this.e;
},
set: function (a) {
var b = this.f;
if (a != b) {
this.e = a;
this.l("Interval", b, this.f);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(TimeAxisInterval.prototype, "b", {
get: function () {
return this.a;
},
set: function (a) {
var b = this.b;
if (a != b) {
this.a = a;
this.l("Interval", enumGetBox(TimeAxisIntervalType_$type, b), enumGetBox(TimeAxisIntervalType_$type, this.b));
}
},
enumerable: false,
configurable: true
});
TimeAxisInterval.prototype.d = function (a) {
var b;
switch (this.b) {
case 0:
var c = 10000;
return dateAddSeconds(a, 1 / c);
case 1:
b = dateAddSeconds(a, 1 / 1000);
return dateFromValues(b.getFullYear(), dateGetMonth(b), b.getDate(), b.getHours(), b.getMinutes(), b.getSeconds(), b.getMilliseconds());
case 2:
b = dateAddSeconds(a, 1);
return dateFromValues(b.getFullYear(), dateGetMonth(b), b.getDate(), b.getHours(), b.getMinutes(), b.getSeconds(), 0);
case 3:
b = dateAddMinutes(a, 1);
return dateFromValues(b.getFullYear(), dateGetMonth(b), b.getDate(), b.getHours(), b.getMinutes(), 0, 0);
case 4:
case 5:
b = dateAddHours(a, 1);
return dateFromValues(b.getFullYear(), dateGetMonth(b), b.getDate(), b.getHours(), 0, 0, 0);
case 6:
case 7:
case 8:
b = dateAddDays(a, 1);
return dateFromValues(b.getFullYear(), dateGetMonth(b), b.getDate(), 0, 0, 0, 0);
default: return a;
}
};
TimeAxisInterval.prototype.c = function (a) {
var b = +(dateMaxValue()) - +a;
switch (this.b) {
case 0:
var c = 10000;
if (b > timeSpanFromTicks(truncate(this.f))) {
return dateAddSeconds(a, this.f / c);
}
return dateMaxValue();
case 1:
if (b > timeSpanFromMilliseconds(this.f)) {
return dateAddSeconds(a, this.f / 1000);
}
return dateMaxValue();
case 2:
if (b > timeSpanFromSeconds(this.f)) {
return dateAddSeconds(a, this.f);
}
return dateMaxValue();
case 3:
if (b > timeSpanFromMinutes(this.f)) {
return dateAddMinutes(a, this.f);
}
return dateMaxValue();
case 4:
if (b > timeSpanFromHours(this.f)) {
return dateAddHours(a, this.f);
}
return dateMaxValue();
case 5:
if (b > timeSpanFromDays(this.f)) {
return dateAddDays(a, this.f);
}
return dateMaxValue();
case 6:
if (b > timeSpanFromDays(7 * this.f)) {
return dateAddDays(a, this.f * 7);
}
return dateMaxValue();
case 7:
if (b > timeSpanFromDays(31 * truncate(this.f))) {
return dateAddMonths(a, truncate(this.f));
}
return dateMaxValue();
case 8:
if (b > timeSpanFromDays(365 * truncate(this.f))) {
return dateAddYears(a, truncate(this.f));
}
return dateMaxValue();
default: return a;
}
};
TimeAxisInterval.prototype.l = function (a, b, c) {
this.m(a, b, c);
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs(a));
}
};
TimeAxisInterval.prototype.m = function (a, b, c) {
};
TimeAxisInterval.$t = markType(TimeAxisInterval, 'TimeAxisInterval', Base.$, [INotifyPropertyChanged_$type]);
return TimeAxisInterval;
}(Base));
export { TimeAxisInterval };