igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
829 lines (827 loc) • 28 kB
JavaScript
import { __extends } from "tslib";
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { AxisRangeBufferMode_$type } from "./AxisRangeBufferMode";
import { IgrAxis } from "./igr-axis";
import { ensureBool, ensureEnum, arrayFindByName } from "igniteui-react-core";
/**
* Represents the base class for all IgxDataChartComponent numeric axes.
*/
var IgrNumericAxisBase = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrNumericAxisBase, _super);
function IgrNumericAxisBase(props) {
var _this = _super.call(this, props) || this;
_this._actualMinimumValueChange = null;
_this._actualMinimumValueChange_wrapped = null;
_this._actualMaximumValueChange = null;
_this._actualMaximumValueChange_wrapped = null;
_this._actualIntervalChange = null;
_this._actualIntervalChange_wrapped = null;
_this._actualMinorIntervalChange = null;
_this._actualMinorIntervalChange_wrapped = null;
return _this;
}
Object.defineProperty(IgrNumericAxisBase.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "isNumeric", {
/**
* Gets or sets if the current axis is of numeric axis type
*/
get: function () {
return this.i.dh;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "autoRangeBufferMode", {
/**
* Gets or sets how the numeric axis will adjust its range buffer to less closely fix the data from the series.
*/
get: function () {
return this.i.ok;
},
set: function (v) {
this.i.ok = ensureEnum(AxisRangeBufferMode_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "minimumValue", {
/**
* Gets or sets the MinimumValue property.
*
* Used to set the minimum value of a numeric axis. To get the minimum value in effect on a numeric axis use `ActualMinimumValue`.
*
* ```ts
* this.yAxis.minimumValue = 0;
* ```
*
* ```ts
* <IgrDataChart >
*
*
* <IgrCategoryXAxis name="xAxisYears"
* interval={12} labelLocation="OutsideBottom"
* label="Year" overlap={1} gap={0.4} />
*
* <IgrNumericYAxis name="yAxisLeft"
* title="Expanse | Revenue"
* minimumValue={-900}
* labelLocation="OutsideLeft"
* maximumValue={900}
* interval={300} />
*
*
* <IgrLineSeries name="series1"
* valueMemberPath="Revenue"
* xAxisName="xAxisMonths"
* yAxisName="yAxisLeft" />
* </IgrDataChart>
* ```
*/
get: function () {
return this.i.p3;
},
set: function (v) {
this.i.p3 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualMinimumValue", {
/**
* Gets the effective minimum value for the current numeric axis object.
*
* ```ts
* let effectiveMinValue: number = yAxis.actualMinimumValue;
* ```
*/
get: function () {
return this.i.pr;
},
set: function (v) {
this.i.pr = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualVisibleMinimumValue", {
/**
* Gets the effective minimum value for the current numeric axis object.
*
* The `actualVisibleMinimumValue` is used to get the current visible maximum value for the a numeric axis. Note, at times the `actualVisibleMinimumValue` may differ from the `actualMinimumValue`, for example when the chart is zoomed.
*
* ```ts
* let effectiveVisibleMinValue: number = yAxis.actualVisibleMinimumValue;
* ```
*/
get: function () {
return this.i.pu;
},
set: function (v) {
this.i.pu = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "maximumValue", {
/**
* Gets or sets the MaximumValue property.
*
* Used to set the maximum value of a numeric axis. To get the maximum value in effect on a numeric axis use `ActualMaximumValue`.
*
* ```ts
* this.yAxis.maximumValue = 80;
* ```
*
* ```ts
* <IgrDataChart >
*
*
* <IgrCategoryXAxis name="xAxisYears"
* interval={12} labelLocation="OutsideBottom"
* label="Year" overlap={1} gap={0.4} />
*
* <IgrNumericYAxis name="yAxisLeft"
* title="Expanse | Revenue"
* minimumValue={-900}
* labelLocation="OutsideLeft"
* interval={300} />
*
*
* <IgrLineSeries name="series1"
* valueMemberPath="Revenue"
* xAxisName="xAxisMonths"
* yAxisName="yAxisLeft" />
* </IgrDataChart>
* ```
*/
get: function () {
return this.i.p2;
},
set: function (v) {
this.i.p2 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualMaximumValue", {
/**
* Gets the effective maximum value for the current numeric axis object.
*
* ```ts
* let effectiveMaxValue: number = yAxis.actualMaximumValue;
* ```
*/
get: function () {
return this.i.pq;
},
set: function (v) {
this.i.pq = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualVisibleMaximumValue", {
/**
* Gets the effective visible maximum value for the current numeric axis object.
*
* The `ActualVisibleMaximumValue` is used to get the current visible maximum value for the a numeric axis. Note, at times the `ActualVisibleMaximumValue` may differ from the `ActualMaximumValue`, for example when the chart is zoomed.
*
* ```ts
* let effectiveVisibleMaxValue: number = yAxis.actualVisibleMaximumValue;
* ```
*/
get: function () {
return this.i.pt;
},
set: function (v) {
this.i.pt = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "interval", {
/**
* Gets or sets the Interval property.
*
* The `Interval` is used to get or set the numeric axis major interval which specifies how frequent major gridlines and axis labels are rendered on an axis.
*
* ```ts
* this.yAxis.interval = 20;
* ```
*
* ```ts
* <IgrDataChart >
*
*
* <IgrCategoryXAxis name="xAxisYears"
* interval={12} labelLocation="OutsideBottom"
* label="Year" overlap={1} gap={0.4} />
*
* <IgrNumericYAxis name="yAxisLeft"
* title="Expanse | Revenue"
* minimumValue={-900}
* labelLocation="OutsideLeft"
* maximumValue={900}
* interval={300} />
*
*
* <IgrLineSeries name="series1"
* valueMemberPath="Revenue"
* xAxisName="xAxisMonths"
* yAxisName="yAxisLeft" />
* </IgrDataChart>
* ```
*/
get: function () {
return this.i.pz;
},
set: function (v) {
this.i.pz = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualInterval", {
/**
* Gets the effective value for the current Interval.
*
* ```ts
* let effectiveInterval: number = yAxis.actualInterval;
* ```
*/
get: function () {
return this.i.pp;
},
set: function (v) {
this.i.pp = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualMaxPrecision", {
/**
* Gets the effective value for the current max precision.
*/
get: function () {
return this.i.qa;
},
set: function (v) {
this.i.qa = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "maxPrecision", {
/**
* Gets or sets the the maximum precision to use for the auto interval.
*/
get: function () {
return this.i.qg;
},
set: function (v) {
this.i.qg = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "shouldApplyMaxPrecisionWhenZoomed", {
/**
* Gets or sets the the maximum precision to use for the auto interval.
*/
get: function () {
return this.i.pf;
},
set: function (v) {
this.i.pf = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "minorInterval", {
/**
* Gets or sets the MinorInterval property.
*
* The `MinorInterval` is used to get or set the numeric axis minor interval which specifies how frequent minor gridlines are rendered on an axis. Please note, in order for minor gridlines to be displayed the following may also need to be set: `MinorStroke`, `MinorStrokeThickness`.
*
* ```ts
* this.yAxis.minorInterval = 2.5;
* this.yAxis.minorStroke = 'blue';
* this.yAxis.minorStrokeThickness = 1;
* ```
*
* ```ts
* <IgrDataChart >
*
* <IgrCategoryXAxis name="xAxisYears"
* interval={12} labelLocation="OutsideBottom"
* label="Year" overlap={1} gap={0.4} />
*
* <IgrNumericYAxis name="yAxisLeft"
* title="Expanse | Revenue"
* minimumValue={-900}
* minorInterval= 2.5
* minorStroke="blue" />
*
*
* <IgrLineSeries name="series1"
* valueMemberPath="Revenue"
* xAxisName="xAxisMonths"
* yAxisName="yAxisLeft" />
* </IgrDataChart>
* ```
*/
get: function () {
return this.i.p4;
},
set: function (v) {
this.i.p4 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualMinorInterval", {
/**
* Gets the effective value for the current MinorInterval.
*
* ```ts
* let effectiveMinorInterval: number = yAxis.actualMinorInterval;
* ```
*/
get: function () {
return this.i.ps;
},
set: function (v) {
this.i.ps = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "referenceValue", {
/**
* Gets or sets the ReferenceValue property.
*
* Used to get or set a reference value on a numeric axis which when used with an area, bar, or column series will result in the series shapes being drawn above or below the specified value.
*
* ```ts
* this.yAxis.referenceValue = 30;
* ```
*
* ```ts
* <IgrDataChart >
*
* <IgrCategoryXAxis name="xAxisYears"
* interval={12} labelLocation="OutsideBottom"
* label="Year" overlap={1} gap={0.4} />
*
* <IgrNumericYAxis name="yAxisLeft"
* title="Expanse | Revenue"
* referenceValue= {30} />
*
*
* <IgrLineSeries name="series1"
* valueMemberPath="Revenue"
* xAxisName="xAxisMonths"
* yAxisName="yAxisLeft" />
* </IgrDataChart>
* ```
*/
get: function () {
return this.i.p5;
},
set: function (v) {
this.i.p5 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "isLogarithmic", {
/**
* Gets or sets the IsLogarithmic property.
*
* `IsLogarithmic` is used to get or set whether the numeric axis scaler is in linear or logarithmic mode. For logarithmic scaling, this can be used in conjunction with `LogarithmBase` to further define the logarithmic scale.
*
* ```ts
* this.yAxis.isLogarithmic= true;
* this.yAxis.logarithmBase = 2;
* ```
*
* ```ts
* <IgrDataChart >
*
*
* <IgrCategoryXAxis name="xAxisYears"
* interval={12} labelLocation="OutsideBottom"
* label="Year" overlap={1} gap={0.4} />
*
* <IgrNumericYAxis name="yAxisLeft"
* title="Expanse | Revenue"
* IsLogarithmic="True"
* LogarithmBase={2}/>
*
*
* <IgrLineSeries name="series1"
* valueMemberPath="Revenue"
* xAxisName="xAxisMonths"
* yAxisName="yAxisLeft" />
* </IgrDataChart>
* ```
*/
get: function () {
return this.i.pb;
},
set: function (v) {
this.i.pb = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualIsLogarithmic", {
/**
* Determines if the axis has a valid logarithmic scale.
*
* ```ts
* let effectiveLogarithmic: boolean = this.yAxis.actualIsLogarithmic
* ```
*/
get: function () {
return this.i.o2;
},
set: function (v) {
this.i.o2 = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "favorLabellingScaleEnd", {
/**
* Gets or sets whether the axis should favor emitting a label at the end of the scale.
*/
get: function () {
return this.i.o6;
},
set: function (v) {
this.i.o6 = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "logarithmBase", {
/**
* Gets or sets the LogarithmBase property.
*
* `LogarithmBase` is used to get or set logarithm base when a numeric axis is in Logarithmic scale mode. For logarithmic scaling, this is used in conjunction with `IsLogarithmic` or `ScaleMode` to set logarithmic scaling.
*
* ```ts
* this.yAxis.scaleMode = NumericScaleMode.Logarithmic;
* this.yAxis.logarithmBase = 2;
* ```
*
* ```ts
* <IgrDataChart >
*
*
* <IgrCategoryXAxis name="xAxisYears"
* interval={12} labelLocation="OutsideBottom"
* label="Year" overlap={1} gap={0.4} />
*
* <IgrNumericYAxis name="yAxisLeft"
* title="Expanse | Revenue"
* ScaleMode="Logarithmic"
* LogarithmBase={2}/>
*
* <IgrLineSeries name="series1"
* valueMemberPath="Revenue"
* xAxisName="xAxisMonths"
* yAxisName="yAxisLeft" />
* </IgrDataChart>
* ```
*/
get: function () {
return this.i.qe;
},
set: function (v) {
this.i.qe = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "companionAxisInterval", {
/**
* Gets or sets interval of labels on the secondary axis.
*/
get: function () {
return this.i.pv;
},
set: function (v) {
this.i.pv = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "companionAxisMinorInterval", {
/**
* Gets or sets interval of minor gridlines on the secondary axis.
*/
get: function () {
return this.i.py;
},
set: function (v) {
this.i.py = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "companionAxisMinimumValue", {
/**
* Gets or sets minimum value the secondary axis.
*/
get: function () {
return this.i.px;
},
set: function (v) {
this.i.px = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "companionAxisMaximumValue", {
/**
* Gets or sets maximum value the secondary axis.
*/
get: function () {
return this.i.pw;
},
set: function (v) {
this.i.pw = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "companionAxisIsLogarithmic", {
/**
* Gets or sets whether or not the secondary axis is logarithmic.
*/
get: function () {
return this.i.o5;
},
set: function (v) {
this.i.o5 = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "companionAxisLogarithmBase", {
/**
* Gets or sets logarithm base on the secondary axis.
*/
get: function () {
return this.i.qd;
},
set: function (v) {
this.i.qd = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "formatAbbreviatedLabel", {
/**
* Sets or gets a function which takes an object that produces a formatted label for displaying in the chart.
*/
get: function () {
return this.i.of;
},
set: function (v) {
this.i.of = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "abbreviatedLabelFormat", {
/**
* Gets or sets the label format string to use for the label.
*/
get: function () {
return this.i.qi;
},
set: function (v) {
this.i.qi = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "abbreviatedLabelFormatSpecifiers", {
/**
* Gets or sets the format specifiers to use with the AbbreviatedLabelFormat string.
*/
get: function () {
return this.i.od;
},
set: function (v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
var re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.od = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "isFormattingAbbreviatedLargeNumber", {
get: function () {
return this.i.pa;
},
set: function (v) {
this.i.pa = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "hasUserMinimum", {
/**
* Determines if the axis has a user-defined minimum.
*
* `HasUserMaximum` is used to determine if a numeric axis has a user definied maximum value.
*
* ```ts
* let hasSetMaximum: boolean = this.yAxis.hasUserMaximum;
* ```
*/
get: function () {
return this.i.o9;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "hasUserMaximum", {
/**
* Determines if the axis has a user-defined maximum.
*
* `HasUserMinimum` is used to determine if a numeric axis has a user definied minium value.
*
* ```ts
* let hasSetMinimum: boolean = this.yAxis.hasUserMinimum;
* ```
*/
get: function () {
return this.i.o8;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "abbreviateLargeNumbers", {
/**
* A boolean indicating whether or not to abbreviate large numbers.
*/
get: function () {
return this.i.o1;
},
set: function (v) {
this.i.o1 = ensureBool(v);
},
enumerable: false,
configurable: true
});
IgrNumericAxisBase.prototype.findByName = function (name) {
var baseResult = _super.prototype.findByName.call(this, name);
if (baseResult) {
return baseResult;
}
if (this.abbreviatedLabelFormatSpecifiers != null && arrayFindByName(this.abbreviatedLabelFormatSpecifiers, name)) {
return arrayFindByName(this.abbreviatedLabelFormatSpecifiers, name);
}
return null;
};
IgrNumericAxisBase.prototype.getFullRange = function () {
var iv = this.i.ag();
return (iv);
};
/**
* Unscales a value from screen space into axis space.
* @param unscaledValue * The scaled value in screen coordinates to unscale into axis space.
*
* Unscales a value from screen space into axis space.
*
* ```ts
* let dataValue: number = this.yAxis.unscaleValue(pixel);
* ```
*/
IgrNumericAxisBase.prototype.unscaleValue = function (unscaledValue) {
var iv = this.i.p6(unscaledValue);
return (iv);
};
Object.defineProperty(IgrNumericAxisBase.prototype, "actualMinimumValueChange", {
get: function () {
return this._actualMinimumValueChange;
},
set: function (ev) {
var _this = this;
if (this._actualMinimumValueChange_wrapped !== null) {
this.i.propertyChanged = delegateRemove(this.i.propertyChanged, this._actualMinimumValueChange_wrapped);
this._actualMinimumValueChange_wrapped = null;
this._actualMinimumValueChange = null;
}
this._actualMinimumValueChange = ev;
this._actualMinimumValueChange_wrapped = function (o, e) {
var ext = _this.actualMinimumValue;
if (_this.beforeActualMinimumValueChange) {
_this.beforeActualMinimumValueChange(_this, ext);
}
if (_this._actualMinimumValueChange) {
_this._actualMinimumValueChange(_this, ext);
}
};
this.i.propertyChanged = delegateCombine(this.i.propertyChanged, this._actualMinimumValueChange_wrapped);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualMaximumValueChange", {
get: function () {
return this._actualMaximumValueChange;
},
set: function (ev) {
var _this = this;
if (this._actualMaximumValueChange_wrapped !== null) {
this.i.propertyChanged = delegateRemove(this.i.propertyChanged, this._actualMaximumValueChange_wrapped);
this._actualMaximumValueChange_wrapped = null;
this._actualMaximumValueChange = null;
}
this._actualMaximumValueChange = ev;
this._actualMaximumValueChange_wrapped = function (o, e) {
var ext = _this.actualMaximumValue;
if (_this.beforeActualMaximumValueChange) {
_this.beforeActualMaximumValueChange(_this, ext);
}
if (_this._actualMaximumValueChange) {
_this._actualMaximumValueChange(_this, ext);
}
};
this.i.propertyChanged = delegateCombine(this.i.propertyChanged, this._actualMaximumValueChange_wrapped);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualIntervalChange", {
get: function () {
return this._actualIntervalChange;
},
set: function (ev) {
var _this = this;
if (this._actualIntervalChange_wrapped !== null) {
this.i.propertyChanged = delegateRemove(this.i.propertyChanged, this._actualIntervalChange_wrapped);
this._actualIntervalChange_wrapped = null;
this._actualIntervalChange = null;
}
this._actualIntervalChange = ev;
this._actualIntervalChange_wrapped = function (o, e) {
var ext = _this.actualInterval;
if (_this.beforeActualIntervalChange) {
_this.beforeActualIntervalChange(_this, ext);
}
if (_this._actualIntervalChange) {
_this._actualIntervalChange(_this, ext);
}
};
this.i.propertyChanged = delegateCombine(this.i.propertyChanged, this._actualIntervalChange_wrapped);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrNumericAxisBase.prototype, "actualMinorIntervalChange", {
get: function () {
return this._actualMinorIntervalChange;
},
set: function (ev) {
var _this = this;
if (this._actualMinorIntervalChange_wrapped !== null) {
this.i.propertyChanged = delegateRemove(this.i.propertyChanged, this._actualMinorIntervalChange_wrapped);
this._actualMinorIntervalChange_wrapped = null;
this._actualMinorIntervalChange = null;
}
this._actualMinorIntervalChange = ev;
this._actualMinorIntervalChange_wrapped = function (o, e) {
var ext = _this.actualMinorInterval;
if (_this.beforeActualMinorIntervalChange) {
_this.beforeActualMinorIntervalChange(_this, ext);
}
if (_this._actualMinorIntervalChange) {
_this._actualMinorIntervalChange(_this, ext);
}
};
this.i.propertyChanged = delegateCombine(this.i.propertyChanged, this._actualMinorIntervalChange_wrapped);
},
enumerable: false,
configurable: true
});
return IgrNumericAxisBase;
}(IgrAxis));
export { IgrNumericAxisBase };