scichart
Version:
Fast WebGL JavaScript Charting Library and Framework
63 lines (62 loc) • 3.3 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.DateTimeNumericAxis = void 0;
var AxisType_1 = require("../../../types/AxisType");
var DateTimeDeltaCalculator_1 = require("./DeltaCalculator/DateTimeDeltaCalculator");
var SmartDateLabelProvider_1 = require("./LabelProvider/SmartDateLabelProvider");
var NumericAxis_1 = require("./NumericAxis");
/**
* @summary A 2D Chart DateTime Axis type
* @description A DateTime axis is a specialized numeric axis that displays date and time values.
* @remarks
* Set a {@link DateTimeNumericAxis} on the {@link SciChartSurface.xAxes} or {@link SciChartSurface.yAxes} property.
*
* ---
* 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/axis-api/axis-types/date-time-numeric-axis/}
*/
var DateTimeNumericAxis = /** @class */ (function (_super) {
__extends(DateTimeNumericAxis, _super);
function DateTimeNumericAxis(webAssemblyContext, options) {
var _this = this;
if (!(options === null || options === void 0 ? void 0 : options.labelProvider)) {
options = options !== null && options !== void 0 ? options : {};
options.labelProvider = new SmartDateLabelProvider_1.SmartDateLabelProvider(options);
}
_this = _super.call(this, webAssemblyContext, options) || this;
_this.type = AxisType_1.EAxisType.DateTimeNumericAxis;
_this.possibleDeltasOption = options === null || options === void 0 ? void 0 : options.possibleDeltas;
_this.minTicksOption = options === null || options === void 0 ? void 0 : options.minTicks;
_this.deltaCalculator = new DateTimeDeltaCalculator_1.DateTimeDeltaCalculator(webAssemblyContext, {
possibleDeltas: options === null || options === void 0 ? void 0 : options.possibleDeltas,
minTicks: options === null || options === void 0 ? void 0 : options.minTicks,
datePrecision: options === null || options === void 0 ? void 0 : options.datePrecision,
});
return _this;
}
DateTimeNumericAxis.prototype.toJSON = function () {
var json = _super.prototype.toJSON.call(this);
var options = {
possibleDeltas: this.possibleDeltasOption,
minTicks: this.minTicksOption
};
Object.assign(json.options, options);
return json;
};
return DateTimeNumericAxis;
}(NumericAxis_1.NumericAxis));
exports.DateTimeNumericAxis = DateTimeNumericAxis;