UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

208 lines (207 loc) 7.93 kB
import { __extends } from "tslib"; import { TimeAxisLabellingMode_$type } from "./TimeAxisLabellingMode"; import { IgrTimeAxisLabelFormatCollection } from "./igr-time-axis-label-format-collection"; import { IgrCategoryXAxis } from "./igr-category-x-axis"; import { OrdinalTimeXAxis } from "./OrdinalTimeXAxis"; import { ensureEnum } from "igniteui-react-core"; import { TimeAxisLabelFormatCollection as TimeAxisLabelFormatCollection_internal } from "./TimeAxisLabelFormatCollection"; import { TimeAxisLabelFormat } from "./TimeAxisLabelFormat"; import { SyncableObservableCollection$1 } from "igniteui-react-core"; /** * A horizontal axis that uses an ordinal DateTime scale. * On an ordinal time axis, datapoints are aligned according to their order in the ItemsSource, like a category axis. * * You can use the `OrdinalTimeXAxis` to display dates at equidistant. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * <IgrOrdinalTimeXAxis name="xAxis" label="Date" /> * <IgrNumericYAxis name="yAxis" /> * </IgrDataChart> * ``` * * ```ts * this.series.xAxis = this.ordinalTimeXAxis; * this.series.yAxis = this.numericYAxis; * this.series.xAxisName = "xAxis"; * this.series.yAxisName = "YAxis"; * ``` */ var IgrOrdinalTimeXAxis = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrOrdinalTimeXAxis, _super); function IgrOrdinalTimeXAxis(props) { var _this = _super.call(this, props) || this; _this._labelFormats = null; return _this; } IgrOrdinalTimeXAxis.prototype.createImplementation = function () { return new OrdinalTimeXAxis(); }; Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; }, enumerable: false, configurable: true }); Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "dateTimeMemberPath", { /** * Gets or sets the DateTime mapping property for the axis. */ get: function () { return this.i.dateTimeMemberPath; }, set: function (v) { this.i.dateTimeMemberPath = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "labellingMode", { /** * Gets or sets the labelling mode to use when the automatic label formats are applied. */ get: function () { return this.i.ri; }, set: function (v) { this.i.ri = ensureEnum(TimeAxisLabellingMode_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "isOrdinal", { /** * Gets or sets if the current axis is of ordinal axis type */ get: function () { return this.i.di; }, enumerable: false, configurable: true }); Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "labelFormats", { /** * A list of axis label formats to apply, which are selected according to the visible axis range. * The label format selected will be the one with the largest range smaller than the visible range of the axis. * * You can use the `LabelFormats` for adjusting the labels depending on the range of the time shown by the chart. * * ```ts * let labelFormat = new TimeAxisLabelFormat(); * labelFormat.format = "hh:mm:ss"; * labelFormat.range = 1000; * this.xAxis.labelFormats.add(labelFormat); * labelFormat = new TimeAxisLabelFormat(); * labelFormat.format = "hh:mm"; * labelFormat.range = 60 * 1000; * this.xAxis.labelFormats.add(labelFormat); * labelFormat = new TimeAxisLabelFormat(); * labelFormat.format = "MMM-dd-yy"; * labelFormat.range = 24 * 60 * 60 * 1000; * this.xAxis.labelFormats.add(labelFormat); * labelFormat = new TimeAxisLabelFormat(); * labelFormat.format = "MMM yy"; * labelFormat.range = 365.24 * 24 * 60 * 60 * 1000; * this.xAxis.labelFormats.add(labelFormat); * labelFormat = new TimeAxisLabelFormat(); * labelFormat.format = "yyyy"; * labelFormat.range = 5 * 365 * 24 * 60 * 60 * 1000; * this.xAxis.labelFormats.add(labelFormat); * ``` * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * <IgrOrdinalTimeXAxis name="xAxis" * label="Date" * labelFormats="labelFormats" /> * <IgrNumericYAxis name="yAxis" /> * </IgrDataChart> * ``` */ get: function () { if (this._labelFormats === null) { var coll = new IgrTimeAxisLabelFormatCollection(); var innerColl = this.i.rg; if (!innerColl) { innerColl = new TimeAxisLabelFormatCollection_internal(); } this._labelFormats = coll._fromInner(innerColl); } return this._labelFormats; }, set: function (v) { if (this._labelFormats !== null) { this._labelFormats._setSyncTarget(null); this._labelFormats = null; } var coll = new IgrTimeAxisLabelFormatCollection(); this._labelFormats = coll._fromOuter(v); var syncColl = new SyncableObservableCollection$1(TimeAxisLabelFormat.$type); var innerColl = this.i.rg; if (!innerColl) { innerColl = new TimeAxisLabelFormatCollection_internal(); } syncColl._inner = innerColl; syncColl.clear(); this._labelFormats._setSyncTarget(syncColl); }, enumerable: false, configurable: true }); Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "minimumValue", { /** * Sets the minimum DateTime value to be displayed on this axis. * This property can be used to constrain the items displayed on the axis, within the range of DateTimes in the ItemsSource. It will ignore any setting outside the actual range of data. */ get: function () { return this.i.minimumValue; }, set: function (v) { this.i.minimumValue = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "maximumValue", { /** * Sets the maximum DateTime value to be displayed on this axis. * This property can be used to constrain the items displayed on the axis, within the range of DateTimes in the ItemsSource. It will ignore any setting outside the actual range of data. */ get: function () { return this.i.maximumValue; }, set: function (v) { this.i.maximumValue = v; }, enumerable: false, configurable: true }); IgrOrdinalTimeXAxis.prototype.findByName = function (name) { var baseResult = _super.prototype.findByName.call(this, name); if (baseResult) { return baseResult; } if (this.labelFormats != null && this.labelFormats.findByName && this.labelFormats.findByName(name)) { return this.labelFormats.findByName(name); } return null; }; IgrOrdinalTimeXAxis.prototype.getValueLabel = function (value) { var iv = this.i.ih(value); return (iv); }; return IgrOrdinalTimeXAxis; }(IgrCategoryXAxis)); export { IgrOrdinalTimeXAxis };