UNPKG

igniteui-react-charts

Version:

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

286 lines (283 loc) 10.2 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 { __extends } from "tslib"; import { IgrAxis } from './igr-axis'; import { toPoint, fromRect, ensureBool } from "igniteui-react-core"; /** * Represents the base class for all IgxDataChartComponent category-based axes. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} > * * <IgrCategoryXAxis name="xAxis" /> * <IgrNumericYAxis name="yAxis" /> * * <IgrColumnSeries * name="series1" * xAxisName="xAxis" * yAxisName="yAxis" * valueMemberPath="Value" /> * </IgrDataChart> * ``` * * ```ts * this.columnSeries1 = new IgrColumnSeries({ name: "colSeries1" }); * this.columnSeries1.dataSource = this.categoryData; * this.columnSeries1.xAxis = this.categoryXAxis; * this.columnSeries1.yAxis = this.numericYAxis; * this.columnSeries1.xAxisName = "categoryXAxis"; * this.columnSeries1.yAxisName = "numericYAxis"; * this.columnSeries1.valueMemberPath = "USA"; * ``` */ var IgrCategoryAxisBase = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrCategoryAxisBase, _super); function IgrCategoryAxisBase(props) { var _this = _super.call(this, props) || this; _this._chartLevelData = null; _this._dataSource = null; return _this; } IgrCategoryAxisBase.prototype.provideData = function (data) { this._chartLevelData = data; this.updateDataSource(); }; IgrCategoryAxisBase.prototype.updateDataSource = function () { if (this._dataSource == null) { this.i.itemsSource = this._chartLevelData; } else { this.i.itemsSource = this._dataSource; } }; Object.defineProperty(IgrCategoryAxisBase.prototype, "dataSource", { get: function () { if (this._dataSource != null) { return this._dataSource; } return this.i.itemsSource; }, set: function (value) { this._dataSource = value; this.updateDataSource(); //console.log("setting axis data source: " + value) }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "isContinuous", { /** * Gets if the current axis is a continuous rather than a discrete scale */ get: function () { return this.i.db; }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "isCategory", { /** * Checks if the axis is of category axis type */ get: function () { return this.i.c8; }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "itemsCount", { /** * Gets the number of items in the current category axis items source. */ get: function () { return this.i.o6; }, set: function (v) { this.i.o6 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "gap", { /** * Gets or sets the amount of space between adjacent categories for the current axis object. * The gap is silently clamped to the range [0, 1] when used. * * Use the `Gap` property to configure the spacing between items on a category axis with item spacing. * * A `Gap` of 0 allocates no space between items. A `Gap` of 1 allocates a space between items equal to the width of one item. * * To set the item spacing to 75% the width of one item, set the `Gap` to 0.75, as in this code: * * ```ts * <IgrDataChart * ref={this.onChartRef} * dataSource={this.state.dataSource} > * * <IgrCategoryXAxis name="xAxis" gap={0.4} /> * <IgrNumericYAxis name="yAxis" /> * * <IgrColumnSeries * name="series1" * xAxisName="xAxis" * yAxisName="yAxis" * valueMemberPath="Value" /> * </IgrDataChart> * ``` */ get: function () { return this.i.or; }, set: function (v) { this.i.or = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "maximumGap", { /** * Gets or sets the maximum gap value to allow. This defaults to 1.0. */ get: function () { return this.i.oy; }, set: function (v) { this.i.oy = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "minimumGapSize", { /** * Gets or sets the minimum amount of pixels to use for the gap between categories, if possible. */ get: function () { return this.i.oz; }, set: function (v) { this.i.oz = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "overlap", { /** * Gets or sets the amount of overlap between adjacent categories for the current axis object. * The overlap is silently clamped to the range [-1, 1] when used. * * Use the `Overlap` property to configure the spacing between items on a category axis with item spacing and more than one series. * * An `Overlap` of 0 places grouped items adjacent to each other. An `Overlap` of 1 places grouped items in the same axis space, completely overlapping. An `Overlap` of -1 places a space between grouped items equal to the width of one item. * * To place grouped items with 75% overlap, set the `Overlap` to 0.75, as in this code: * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} > * * <IgrCategoryXAxis name="xAxis" overlap={1} /> * <IgrNumericYAxis name="yAxis" /> * * <IgrColumnSeries * name="series1" * xAxisName="xAxis" * yAxisName="yAxis" * valueMemberPath="Value" * /> * </IgrDataChart> * ``` */ get: function () { return this.i.o0; }, set: function (v) { this.i.o0 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrCategoryAxisBase.prototype, "useClusteringMode", { /** * Gets or sets whether the category axis should use clustering display mode even if no series are present that would force clustering mode. * * `UseClusteringMode` applies grouping and spacing to a category axis equivalent to the grouping that occurs when grouping series, such as ColumnSeries, are used. * * Try setting it on an axis displaying financial series to adjust the spacing on the left and right sides of the axis: * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} > * * <IgrCategoryXAxis name="xAxis" useClusteringMode={2} /> * <IgrNumericYAxis name="yAxis" /> * * <IgrColumnSeries * name="series1" * xAxisName="xAxis" * yAxisName="yAxis" * valueMemberPath="Value" /> * </IgrDataChart> * ``` */ get: function () { return this.i.ol; }, set: function (v) { this.i.ol = ensureBool(v); }, enumerable: false, configurable: true }); IgrCategoryAxisBase.prototype.getFullRange = function () { var iv = this.i.ag(); return (iv); }; IgrCategoryAxisBase.prototype.getCategoryBoundingBox = function (point, useInterpolation, singularWidth) { var iv = this.i.p5(toPoint(point), useInterpolation, singularWidth); return fromRect(iv); }; IgrCategoryAxisBase.prototype.getCategoryBoundingBoxHelper = function (point, useInterpolation, singularWidth, isVertical) { var iv = this.i.p6(toPoint(point), useInterpolation, singularWidth, isVertical); return fromRect(iv); }; /** * Unscales a value from screen space into axis space. * @param unscaledValue * The scaled value in screen coordinates to unscale into axis space. */ IgrCategoryAxisBase.prototype.unscaleValue = function (unscaledValue) { var iv = this.i.o2(unscaledValue); return (iv); }; IgrCategoryAxisBase.prototype.notifySetItem = function (index, oldItem, newItem) { this.i.pq(index, oldItem, newItem); }; /** * Used to manually notify the axis that the data source has reset or cleared its items. */ IgrCategoryAxisBase.prototype.notifyClearItems = function () { this.i.pn(); }; IgrCategoryAxisBase.prototype.notifyInsertItem = function (index, newItem) { this.i.po(index, newItem); }; IgrCategoryAxisBase.prototype.notifyRemoveItem = function (index, oldItem) { this.i.pp(index, oldItem); }; return IgrCategoryAxisBase; }(IgrAxis)); export { IgrCategoryAxisBase };