igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
670 lines (665 loc) • 22.4 kB
JavaScript
import { __extends } from "tslib";
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrAxis } from "./igr-axis";
import { OverlayTextLocation_$type } from "./OverlayTextLocation";
import { AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode";
import { IgrOverlayTextUpdatingEventArgs } from "./igr-overlay-text-updating-event-args";
import { IgrSeries } from "./igr-series";
import { ValueOverlay } from "./ValueOverlay";
import { ensureBool, brushToString, stringToBrush, ensureEnum, toPoint, fromPoint } from "igniteui-react-core";
import { FontInfo } from "igniteui-react-core";
/**
* Represents the class of the value overlay. The value overlay is a line or circle representing a value on an axis.
*/
var IgrValueOverlay = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrValueOverlay, _super);
function IgrValueOverlay(props) {
var _this = _super.call(this, props) || this;
_this._axisName = null;
_this._stylingOverlayText = null;
_this._stylingOverlayText_wrapped = null;
return _this;
}
IgrValueOverlay.prototype.createImplementation = function () {
return new ValueOverlay();
};
Object.defineProperty(IgrValueOverlay.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axis", {
/**
* Gets or sets the axis used by the value overlay.
*/
get: function () {
var r = this.i.w6;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = IgrAxis._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.w6 = null : this.i.w6 = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisName", {
/**
* Gets or sets the name to use to resolve axis from markup.
*/
get: function () {
return this._axisName;
},
set: function (v) {
this._axisName = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "value", {
/**
* Gets or sets the value of the overlay.
*/
get: function () {
return this.i.x7;
},
set: function (v) {
this.i.x7 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "isAxisAnnotationEnabled", {
/**
* Gets or sets whether to draw annotations over the axes where the crosshair meets with them.
*/
get: function () {
return this.i.xe;
},
set: function (v) {
this.i.xe = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationFormatLabel", {
/**
* Sets or gets a function which takes an object that produces a formatted label for the axis annotation.
*/
get: function () {
return this.i.w8;
},
set: function (v) {
this.i.w8 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationTextColor", {
/**
* Gets or sets the color to use for the axis annotation text. Leave unset for an automatic value.
*/
get: function () {
return brushToString(this.i.aai);
},
set: function (v) {
this.i.aai = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationBackground", {
/**
* Gets or sets the color to use for the axis annotation backing. Leave unset for an automatic value.
*/
get: function () {
return brushToString(this.i.aag);
},
set: function (v) {
this.i.aag = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationBackgroundCornerRadius", {
/**
* Gets or sets the corner radius to use for the axis annotation backing. Leave unset for an automatic value.
*/
get: function () {
return this.i.xm;
},
set: function (v) {
this.i.xm = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationInterpolatedValuePrecision", {
/**
* Gets or sets the precision to use displaying values for interpolated positions.
*/
get: function () {
return this.i.x8;
},
set: function (v) {
this.i.x8 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationOutline", {
/**
* Gets or sets the color to use for the axis annotation outline. Leave unset for an automatic value.
*/
get: function () {
return brushToString(this.i.aah);
},
set: function (v) {
this.i.aah = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationPaddingLeft", {
/**
* Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins.
*/
get: function () {
return this.i.xo;
},
set: function (v) {
this.i.xo = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationPaddingTop", {
/**
* Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins.
*/
get: function () {
return this.i.xq;
},
set: function (v) {
this.i.xq = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationPaddingRight", {
/**
* Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins.
*/
get: function () {
return this.i.xp;
},
set: function (v) {
this.i.xp = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationPaddingBottom", {
/**
* Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins.
*/
get: function () {
return this.i.xn;
},
set: function (v) {
this.i.xn = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "axisAnnotationStrokeThickness", {
/**
* Gets or sets the stroke thickness for the axis annotation backing. Leave unset for an automatic value.
*/
get: function () {
return this.i.xr;
},
set: function (v) {
this.i.xr = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "isValueOverlay", {
/**
* Gets whether the series is a value overlay.
*/
get: function () {
return this.i.isValueOverlay;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "labelResolved", {
get: function () {
return this.i.yn;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextLocation", {
/**
* Gets or sets location of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.w9;
},
set: function (v) {
this.i.w9 = ensureEnum(OverlayTextLocation_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextHorizontalMargin", {
/**
* Gets or sets the horizontal margin of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.x0;
},
set: function (v) {
this.i.x0 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextVerticalMargin", {
/**
* Gets or sets the vertical margin of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.x2;
},
set: function (v) {
this.i.x2 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextHorizontalPadding", {
/**
* Gets or sets the horizontal padding of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.x1;
},
set: function (v) {
this.i.x1 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextVerticalPadding", {
/**
* Gets or sets the vertical padding of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.x3;
},
set: function (v) {
this.i.x3 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextAngle", {
/**
* Gets or sets the angle rotation (in degrees) of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.xu;
},
set: function (v) {
this.i.xu = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextColor", {
/**
* Gets or sets the color the overlay text.
*/
get: function () {
return brushToString(this.i.aal);
},
set: function (v) {
this.i.aal = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBackground", {
/**
* Gets or sets the background the overlay text.
*/
get: function () {
return brushToString(this.i.aaj);
},
set: function (v) {
this.i.aaj = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBorderColor", {
/**
* Gets or sets the border stroke of the overlay text.
*/
get: function () {
return brushToString(this.i.aak);
},
set: function (v) {
this.i.aak = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBorderRadius", {
/**
* Gets or sets the border corner of the overlay text.
*/
get: function () {
return this.i.xw;
},
set: function (v) {
this.i.xw = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBorderThickness", {
/**
* Gets or sets the border thickness of the overlay text.
*/
get: function () {
return this.i.xy;
},
set: function (v) {
this.i.xy = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextVisible", {
/**
* Gets or sets whether the overlay text is visible in shape of data annotation
*/
get: function () {
return this.i.xi;
},
set: function (v) {
this.i.xi = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayText", {
/**
* Gets or sets the text that will be displayed as the overlay annotation.
*/
get: function () {
return this.i.yo;
},
set: function (v) {
this.i.yo = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextColorShift", {
/**
* Gets or sets the shift of the overlay text color based on OverlayTextColorMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get: function () {
return this.i.xz;
},
set: function (v) {
this.i.xz = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextColorMode", {
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get: function () {
return this.i.w5;
},
set: function (v) {
this.i.w5 = ensureEnum(AnnotationAppearanceMode_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextColorMatchLayer", {
/**
* Gets or sets whether the overlay text color matches brush of the layer
*/
get: function () {
return this.i.xh;
},
set: function (v) {
this.i.xh = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBackgroundShift", {
/**
* Gets or sets the shift of the overlay background based on OverlayTextBackgroundMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get: function () {
return this.i.xv;
},
set: function (v) {
this.i.xv = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBackgroundMode", {
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get: function () {
return this.i.w3;
},
set: function (v) {
this.i.w3 = ensureEnum(AnnotationAppearanceMode_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBackgroundMatchLayer", {
/**
* Gets or sets whether the overlay text background matches brush of the layer
*/
get: function () {
return this.i.xf;
},
set: function (v) {
this.i.xf = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBorderShift", {
/**
* Gets or sets the shift of the overlay border based on OverlayTextBorderMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get: function () {
return this.i.xx;
},
set: function (v) {
this.i.xx = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBorderMode", {
/**
* Gets or sets the mode used for shifting the border of overlay text based on the target series.
*/
get: function () {
return this.i.w4;
},
set: function (v) {
this.i.w4 = ensureEnum(AnnotationAppearanceMode_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextBorderMatchLayer", {
/**
* Gets or sets whether the overlay text border matches brush of the layer
*/
get: function () {
return this.i.xg;
},
set: function (v) {
this.i.xg = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrValueOverlay.prototype, "overlayTextStyle", {
/**
* Gets or Sets the style to use for the display text.
*/
get: function () {
if (this.i.xd == null) {
return null;
}
return this.i.xd.fontString;
},
set: function (v) {
var fi = new FontInfo();
fi.fontString = v;
this.i.xd = fi;
},
enumerable: false,
configurable: true
});
IgrValueOverlay.prototype.bindAxes = function (axes) {
_super.prototype.bindAxes.call(this, axes);
for (var i = 0; i < axes.length; i++) {
if (this.axisName && this.axisName.length > 0 &&
axes[i].name == this.axisName) {
this.axis = axes[i];
}
}
};
IgrValueOverlay.prototype.findByName = function (name) {
var baseResult = _super.prototype.findByName.call(this, name);
if (baseResult) {
return baseResult;
}
if (this.axis && this.axis.name && this.axis.name == name) {
return this.axis;
}
return null;
};
IgrValueOverlay.prototype._styling = function (container, component, parent) {
_super.prototype._styling.call(this, container, component, parent);
this._inStyling = true;
if (this.axis && this.axis._styling) {
this.axis._styling(container, component, this);
}
this._inStyling = false;
};
IgrValueOverlay.prototype.getSeriesValue = function (world, useInterpolation, skipUnknowns) {
var iv = this.i.i6(toPoint(world), useInterpolation, skipUnknowns);
return (iv);
};
IgrValueOverlay.prototype.getSeriesValuePosition = function (world, useInterpolation, skipUnknowns) {
var iv = this.i.wh(toPoint(world), useInterpolation, skipUnknowns);
return fromPoint(iv);
};
/**
* Gets the item index associated with the specified world position
* @param world
*/
IgrValueOverlay.prototype.getItemIndex = function (world) {
var iv = this.i.j4(toPoint(world));
return (iv);
};
/**
* Gets the item that is the best match for the specified world coordinates.
* @param world * The world coordinates to use.
*/
IgrValueOverlay.prototype.getItem = function (world) {
var iv = this.i.ko(toPoint(world));
return (iv);
};
/**
* Requests that the provided item should be brought into view if possible.
* @param item * The item to attempt to bring into view.
*/
IgrValueOverlay.prototype.scrollIntoView = function (item) {
var iv = this.i.ge(item);
return (iv);
};
/**
* Gets the label for a data item.
* @param value * The unscaled value to get a label for.
*/
IgrValueOverlay.prototype.getLabel = function (value) {
var iv = this.i.yl(value);
return (iv);
};
Object.defineProperty(IgrValueOverlay.prototype, "stylingOverlayText", {
/**
* Event raised when updating style of overlay text
*/
get: function () {
return this._stylingOverlayText;
},
set: function (ev) {
var _this = this;
if (this._stylingOverlayText_wrapped !== null) {
this.i.stylingOverlayText = delegateRemove(this.i.stylingOverlayText, this._stylingOverlayText_wrapped);
this._stylingOverlayText_wrapped = null;
this._stylingOverlayText = null;
}
this._stylingOverlayText = ev;
this._stylingOverlayText_wrapped = function (o, e) {
var outerArgs = new IgrOverlayTextUpdatingEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeStylingOverlayText) {
_this.beforeStylingOverlayText(_this, outerArgs);
}
if (_this._stylingOverlayText) {
_this._stylingOverlayText(_this, outerArgs);
}
};
this.i.stylingOverlayText = delegateCombine(this.i.stylingOverlayText, this._stylingOverlayText_wrapped);
;
},
enumerable: false,
configurable: true
});
return IgrValueOverlay;
}(IgrSeries));
export { IgrValueOverlay };