igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
612 lines (603 loc) • 21.7 kB
JavaScript
import { __extends } from "tslib";
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrNumericXAxis } from "./igr-numeric-x-axis";
import { IgrNumericYAxis } from "./igr-numeric-y-axis";
import { TrendLineType_$type } from "igniteui-react-core";
import { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { IgrAssigningScatterStyleEventArgs } from "./igr-assigning-scatter-style-event-args";
import { IgrAssigningScatterMarkerStyleEventArgs } from "./igr-assigning-scatter-marker-style-event-args";
import { ValueLayerValueMode_$type } from "./ValueLayerValueMode";
import { IgrMarkerSeries } from "./igr-marker-series";
import { ensureBool, ensureEnum, brushToString, stringToBrush, toDoubleCollection, fromDoubleCollection, toPoint, fromRect, fromPoint } from "igniteui-react-core";
/**
* Represents the base class for all IgxDataChartComponent scatter series
*/
var IgrScatterBase = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrScatterBase, _super);
function IgrScatterBase(props) {
var _this = _super.call(this, props) || this;
_this._xAxisName = null;
_this._yAxisName = null;
_this._assigningScatterStyle = null;
_this._assigningScatterStyle_wrapped = null;
_this._assigningScatterMarkerStyle = null;
_this._assigningScatterMarkerStyle_wrapped = null;
return _this;
}
Object.defineProperty(IgrScatterBase.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "isScatter", {
/**
* Checks if this series is a scatter series
*/
get: function () {
return this.i.fx;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "xAxis", {
/**
* Gets or sets the effective x-axis for the current object.
*/
get: function () {
var r = this.i.xAxis;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = IgrNumericXAxis._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
},
set: function (v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.xAxis = null : this.i.xAxis = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "xAxisName", {
/**
* Gets or sets the name to use to resolve xAxis from markup.
*/
get: function () {
return this._xAxisName;
},
set: function (v) {
this._xAxisName = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "yAxis", {
/**
* Gets or sets the effective y-axis for the current object.
*/
get: function () {
var r = this.i.yAxis;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = IgrNumericYAxis._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
},
set: function (v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.yAxis = null : this.i.yAxis = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "yAxisName", {
/**
* Gets or sets the name to use to resolve yAxis from markup.
*/
get: function () {
return this._yAxisName;
},
set: function (v) {
this._yAxisName = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "xMemberPath", {
/**
* Gets or sets the value mapping property for the current series object.
*/
get: function () {
return this.i.aa4;
},
set: function (v) {
this.i.aa4 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "yMemberPath", {
/**
* Gets or sets the value mapping property for the current series object.
*/
get: function () {
return this.i.abc;
},
set: function (v) {
this.i.abc = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "highlightedXMemberPath", {
/**
* Gets or sets the highlighted X value mapping property for the current series object.
*/
get: function () {
return this.i.aao;
},
set: function (v) {
this.i.aao = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "highlightedYMemberPath", {
/**
* Gets or sets the highlighted Y value mapping property for the current series object.
*/
get: function () {
return this.i.aaq;
},
set: function (v) {
this.i.aaq = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "xMemberAsLegendLabel", {
/**
* Gets or sets the label displayed before series X value in the Data Legend.
*/
get: function () {
return this.i.aa0;
},
set: function (v) {
this.i.aa0 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "yMemberAsLegendLabel", {
/**
* Gets or sets the label displayed before series Y value in the Data Legend.
*/
get: function () {
return this.i.aa8;
},
set: function (v) {
this.i.aa8 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "xMemberAsLegendUnit", {
/**
* Gets or sets the unit after displayed after series X value in the Data Legend.
*/
get: function () {
return this.i.aa2;
},
set: function (v) {
this.i.aa2 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "yMemberAsLegendUnit", {
/**
* Gets or sets the unit after displayed after series Y value in the Data Legend.
*/
get: function () {
return this.i.aba;
},
set: function (v) {
this.i.aba = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "trendLineType", {
/**
* Gets or sets the trend type for the current scatter series.
*/
get: function () {
return this.i.trendLineType;
},
set: function (v) {
this.i.trendLineType = ensureEnum(TrendLineType_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "trendLineBrush", {
/**
* Gets or sets the brush to use to draw the trend line.
*/
get: function () {
return brushToString(this.i.trendLineBrush);
},
set: function (v) {
this.i.trendLineBrush = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "actualTrendLineBrush", {
/**
* Gets the effective TrendLineBrush for this series.
*/
get: function () {
return brushToString(this.i.act);
},
set: function (v) {
this.i.act = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "trendLineThickness", {
/**
* Gets or sets the thickness of the current scatter series object's trend line.
*/
get: function () {
return this.i.trendLineThickness;
},
set: function (v) {
this.i.trendLineThickness = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "trendLineDashArray", {
/**
* Gets or sets a collection of double values that indicate the pattern of dashes and gaps that
* is used to draw the trend line for the current scatter series object.
*/
get: function () {
return fromDoubleCollection(this.i.acu);
},
set: function (v) {
this.i.acu = toDoubleCollection(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "trendLinePeriod", {
/**
* Gets or sets the moving average period for the current scatter series object.
* The typical, and initial, value for trend line period is 7.
*/
get: function () {
return this.i.trendLinePeriod;
},
set: function (v) {
this.i.trendLinePeriod = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "markerCollisionAvoidance", {
/**
* The desired behavior for markers in this series which are placed too close together for the current view, resulting in a collision.
*/
get: function () {
return this.i.y4;
},
set: function (v) {
this.i.y4 = ensureEnum(CollisionAvoidanceType_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "trendLineZIndex", {
/**
* Gets or sets the Z-Index of the trend line. Values greater than 1000 will result in the trend line being rendered in front of the series data.
*/
get: function () {
return this.i.aal;
},
set: function (v) {
this.i.aal = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "maximumMarkers", {
/**
* Gets or sets the maximum number of markerItems displayed by the current series.
* If more than the specified number of markerItems are visible, the series will automatically
* choose a representative set.
*/
get: function () {
return this.i.aak;
},
set: function (v) {
this.i.aak = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "itemSearchMode", {
/**
* Gets or sets the mode the series will use to find the closest point to the cursor.
*/
get: function () {
return this.i.zj;
},
set: function (v) {
this.i.zj = ensureEnum(ScatterItemSearchMode_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "itemSearchThreshold", {
/**
* Gets or sets the threshold to use when searching for items using ItemSearchMode.
*/
get: function () {
return this.i.aaj;
},
set: function (v) {
this.i.aaj = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "actualItemSearchMode", {
get: function () {
return this.i.zh;
},
set: function (v) {
this.i.zh = ensureEnum(ScatterItemSearchMode_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "isCustomScatterStyleAllowed", {
/**
* Gets or sets whether this Scatter series should allow custom style overrides of its individual visuals.
*/
get: function () {
return this.i.z0;
},
set: function (v) {
this.i.z0 = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "isCustomScatterMarkerStyleAllowed", {
/**
* Gets or sets whether this Scatter series should allow custom style overrides of its individual marker visuals.
*/
get: function () {
return this.i.zz;
},
set: function (v) {
this.i.zz = ensureBool(v);
},
enumerable: false,
configurable: true
});
IgrScatterBase.prototype.bindAxes = function (axes) {
_super.prototype.bindAxes.call(this, axes);
for (var i = 0; i < axes.length; i++) {
if (this.xAxisName && this.xAxisName.length > 0 &&
axes[i].name == this.xAxisName) {
this.xAxis = axes[i];
}
}
for (var i = 0; i < axes.length; i++) {
if (this.yAxisName && this.yAxisName.length > 0 &&
axes[i].name == this.yAxisName) {
this.yAxis = axes[i];
}
}
};
IgrScatterBase.prototype.findByName = function (name) {
var baseResult = _super.prototype.findByName.call(this, name);
if (baseResult) {
return baseResult;
}
if (this.xAxis && this.xAxis.name && this.xAxis.name == name) {
return this.xAxis;
}
if (this.yAxis && this.yAxis.name && this.yAxis.name == name) {
return this.yAxis;
}
return null;
};
IgrScatterBase.prototype._styling = function (container, component, parent) {
_super.prototype._styling.call(this, container, component, parent);
this._inStyling = true;
if (this.xAxis && this.xAxis._styling) {
this.xAxis._styling(container, component, this);
}
if (this.yAxis && this.yAxis._styling) {
this.yAxis._styling(container, component, this);
}
this._inStyling = false;
};
IgrScatterBase.prototype.getItemValue = function (item, memberPathName) {
var iv = this.i.ku(item, memberPathName);
return (iv);
};
/**
* Gets the value of a requested member path from the series.
* @param memberPathName * The property name of a valid member path for the series
*/
IgrScatterBase.prototype.getMemberPathValue = function (memberPathName) {
var iv = this.i.mi(memberPathName);
return (iv);
};
/**
* If possible, will return the best available value marker bounding box within the series that has the best value match for the world position provided.
* @param world * The world coordinates for which to get a value marker bounding box for
*/
IgrScatterBase.prototype.getSeriesValueMarkerBoundingBox = function (world) {
var iv = this.i.w0(toPoint(world));
return fromRect(iv);
};
/**
* Determine if object can be used as YAxis
* @param axis * The object to check
*/
IgrScatterBase.prototype.canUseAsYAxis = function (axis) {
var iv = this.i.zy(axis);
return (iv);
};
/**
* Determine if object can be used as XAxis
* @param axis * The object to check
*/
IgrScatterBase.prototype.canUseAsXAxis = function (axis) {
var iv = this.i.zx(axis);
return (iv);
};
/**
* Gets the item that is the best match for the specified world coordinates.
* @param world * The world coordinates to use.
*/
IgrScatterBase.prototype.getItem = function (world) {
var iv = this.i.kr(toPoint(world));
return (iv);
};
/**
* Gets the index of the item that resides at the provided world coordinates.
* @param world * The world coordinates of the requested item.
*/
IgrScatterBase.prototype.getItemIndex = function (world) {
var iv = this.i.j7(toPoint(world));
return (iv);
};
IgrScatterBase.prototype.getExactItemIndex = function (world) {
var iv = this.i.it(toPoint(world));
return (iv);
};
IgrScatterBase.prototype.getSeriesValuePosition = function (world, useInterpolation, skipUnknowns) {
var iv = this.i.wn(toPoint(world), useInterpolation, skipUnknowns);
return fromPoint(iv);
};
/**
* Scrolls the series to display the item for the specified data item.
* The series is scrolled by the minimum amount required to place the specified data item within
* the central 80% of the visible axis.
* @param item * The data item (item) to scroll to.
*/
IgrScatterBase.prototype.scrollIntoView = function (item) {
var iv = this.i.ge(item);
return (iv);
};
/**
* Gets the numeric values from the X and Y axis associated with this scatter series that matches the desired
* value mode.
* @param mode * The type of value desired from the series numeric axis.
*/
IgrScatterBase.prototype.getSeriesValueType = function (mode) {
var iv = this.i.aq(ensureEnum(ValueLayerValueMode_$type, mode));
return (iv);
};
IgrScatterBase.prototype.getSeriesValueTypePositionFromValue = function (values) {
var iv = this.i.wr(values);
return fromPoint(iv);
};
IgrScatterBase.prototype.getSeriesValueTypePosition = function (mode) {
var iv = this.i.wq(ensureEnum(ValueLayerValueMode_$type, mode));
return fromPoint(iv);
};
Object.defineProperty(IgrScatterBase.prototype, "assigningScatterStyle", {
/**
* Event raised when Assigning Category Style
*/
get: function () {
return this._assigningScatterStyle;
},
set: function (ev) {
var _this = this;
if (this._assigningScatterStyle_wrapped !== null) {
this.i.assigningScatterStyle = delegateRemove(this.i.assigningScatterStyle, this._assigningScatterStyle_wrapped);
this._assigningScatterStyle_wrapped = null;
this._assigningScatterStyle = null;
}
this._assigningScatterStyle = ev;
this._assigningScatterStyle_wrapped = function (o, e) {
var outerArgs = new IgrAssigningScatterStyleEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeAssigningScatterStyle) {
_this.beforeAssigningScatterStyle(_this, outerArgs);
}
if (_this._assigningScatterStyle) {
_this._assigningScatterStyle(_this, outerArgs);
}
};
this.i.assigningScatterStyle = delegateCombine(this.i.assigningScatterStyle, this._assigningScatterStyle_wrapped);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrScatterBase.prototype, "assigningScatterMarkerStyle", {
/**
* Event raised when Assigning Scatter Marker Style
*/
get: function () {
return this._assigningScatterMarkerStyle;
},
set: function (ev) {
var _this = this;
if (this._assigningScatterMarkerStyle_wrapped !== null) {
this.i.assigningScatterMarkerStyle = delegateRemove(this.i.assigningScatterMarkerStyle, this._assigningScatterMarkerStyle_wrapped);
this._assigningScatterMarkerStyle_wrapped = null;
this._assigningScatterMarkerStyle = null;
}
this._assigningScatterMarkerStyle = ev;
this._assigningScatterMarkerStyle_wrapped = function (o, e) {
var outerArgs = new IgrAssigningScatterMarkerStyleEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeAssigningScatterMarkerStyle) {
_this.beforeAssigningScatterMarkerStyle(_this, outerArgs);
}
if (_this._assigningScatterMarkerStyle) {
_this._assigningScatterMarkerStyle(_this, outerArgs);
}
};
this.i.assigningScatterMarkerStyle = delegateCombine(this.i.assigningScatterMarkerStyle, this._assigningScatterMarkerStyle_wrapped);
;
},
enumerable: false,
configurable: true
});
return IgrScatterBase;
}(IgrMarkerSeries));
export { IgrScatterBase };