igniteui-webcomponents-charts
Version:
Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.
763 lines (758 loc) • 27.8 kB
JavaScript
import { __extends } from "tslib";
import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core";
import { IgcAxisComponent } from "./igc-axis-component";
import { OverlayTextLocation_$type } from "./OverlayTextLocation";
import { AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode";
import { IgcOverlayTextUpdatingEventArgs } from "./igc-overlay-text-updating-event-args";
import { IgcSeriesComponent } from "./igc-series-component";
import { ValueOverlay } from "./ValueOverlay";
import { getAllPropertyNames, toSpinal, ensureBool, brushToString, stringToBrush, ensureEnum, enumToString, toPoint, fromPoint } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
import { FontInfo } from "igniteui-webcomponents-core";
/**
* Represents the class of the value overlay. The value overlay is a line or circle representing a value on an axis.
*/
export var IgcValueOverlayComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcValueOverlayComponent, _super);
function IgcValueOverlayComponent() {
var _this = _super.call(this) || this;
_this._axisName = null;
_this._stylingOverlayText = null;
_this._stylingOverlayText_wrapped = null;
return _this;
}
IgcValueOverlayComponent.prototype.createImplementation = function () {
return new ValueOverlay();
};
Object.defineProperty(IgcValueOverlayComponent.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
IgcValueOverlayComponent.prototype.connectedCallback = function () {
if (_super.prototype["connectedCallback"]) {
_super.prototype["connectedCallback"].call(this);
}
if (this.i.connectedCallback) {
this.i.connectedCallback();
}
if (!this._attached) {
this._attached = true;
this._flushQueuedAttributes();
}
};
IgcValueOverlayComponent.prototype.disconnectedCallback = function () {
if (_super.prototype["disconnectedCallback"]) {
_super.prototype["disconnectedCallback"].call(this);
}
if (this.i.disconnectedCallback) {
this.i.disconnectedCallback();
}
if (this._attached) {
this._attached = false;
}
};
Object.defineProperty(IgcValueOverlayComponent, "observedAttributes", {
get: function () {
if (IgcValueOverlayComponent._observedAttributesIgcValueOverlayComponent == null) {
var names = getAllPropertyNames(IgcValueOverlayComponent);
for (var i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcValueOverlayComponent._observedAttributesIgcValueOverlayComponent = names;
}
return IgcValueOverlayComponent._observedAttributesIgcValueOverlayComponent;
},
enumerable: false,
configurable: true
});
IgcValueOverlayComponent.register = function () {
if (!IgcValueOverlayComponent._isElementRegistered) {
IgcValueOverlayComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcValueOverlayComponent.htmlTagName, IgcValueOverlayComponent);
}
};
Object.defineProperty(IgcValueOverlayComponent.prototype, "axis", {
/**
* Gets or sets the axis used by the value overlay.
*/
get: function () {
var r = this.i.xm;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = IgcAxisComponent._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.xm = null : this.i.xm = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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(IgcValueOverlayComponent.prototype, "value", {
/**
* Gets or sets the value of the overlay.
*/
get: function () {
return this.i.yp;
},
set: function (v) {
this.i.yp = +v;
this._a("value", this.i.yp);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "dateValue", {
/**
* Gets or sets the value of the overlay as a date. If this is set to something other than the minimum date, then it will be preferred over the Value property.
*/
get: function () {
return this.i.x2;
},
set: function (v) {
this.i.x2 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "isAxisAnnotationEnabled", {
/**
* Gets or sets whether to draw annotations over the axes where the crosshair meets with them.
*/
get: function () {
return this.i.xu;
},
set: function (v) {
this.i.xu = ensureBool(v);
this._a("isAxisAnnotationEnabled", this.i.xu);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.xo;
},
set: function (v) {
this.i.xo = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.aa2);
},
set: function (v) {
this.i.aa2 = stringToBrush(v);
this._a("axisAnnotationTextColor", brushToString(this.i.aa2));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.aa0);
},
set: function (v) {
this.i.aa0 = stringToBrush(v);
this._a("axisAnnotationBackground", brushToString(this.i.aa0));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.x3;
},
set: function (v) {
this.i.x3 = +v;
this._a("axisAnnotationBackgroundCornerRadius", this.i.x3);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "axisAnnotationInterpolatedValuePrecision", {
/**
* Gets or sets the precision to use displaying values for interpolated positions.
*/
get: function () {
return this.i.yq;
},
set: function (v) {
this.i.yq = +v;
this._a("axisAnnotationInterpolatedValuePrecision", this.i.yq);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.aa1);
},
set: function (v) {
this.i.aa1 = stringToBrush(v);
this._a("axisAnnotationOutline", brushToString(this.i.aa1));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.x5;
},
set: function (v) {
this.i.x5 = +v;
this._a("axisAnnotationPaddingLeft", this.i.x5);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.x7;
},
set: function (v) {
this.i.x7 = +v;
this._a("axisAnnotationPaddingTop", this.i.x7);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.x6;
},
set: function (v) {
this.i.x6 = +v;
this._a("axisAnnotationPaddingRight", this.i.x6);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.x4;
},
set: function (v) {
this.i.x4 = +v;
this._a("axisAnnotationPaddingBottom", this.i.x4);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "axisAnnotationStrokeThickness", {
/**
* Gets or sets the stroke thickness for the axis annotation backing. Leave unset for an automatic value.
*/
get: function () {
return this.i.x8;
},
set: function (v) {
this.i.x8 = +v;
this._a("axisAnnotationStrokeThickness", this.i.x8);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "isValueOverlay", {
/**
* Gets whether the series is a value overlay.
*/
get: function () {
return this.i.isValueOverlay;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "labelResolved", {
get: function () {
return this.i.y6;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextLocation", {
/**
* Gets or sets location of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.xp;
},
set: function (v) {
this.i.xp = ensureEnum(OverlayTextLocation_$type, v);
this._a("overlayTextLocation", enumToString(OverlayTextLocation_$type, this.i.xp));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextHorizontalMargin", {
/**
* Gets or sets the horizontal margin of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.yh;
},
set: function (v) {
this.i.yh = +v;
this._a("overlayTextHorizontalMargin", this.i.yh);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextVerticalMargin", {
/**
* Gets or sets the vertical margin of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.yj;
},
set: function (v) {
this.i.yj = +v;
this._a("overlayTextVerticalMargin", this.i.yj);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextHorizontalPadding", {
/**
* Gets or sets the horizontal padding of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.yi;
},
set: function (v) {
this.i.yi = +v;
this._a("overlayTextHorizontalPadding", this.i.yi);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextVerticalPadding", {
/**
* Gets or sets the vertical padding of the overlay text in relation to shape of data annotation.
*/
get: function () {
return this.i.yk;
},
set: function (v) {
this.i.yk = +v;
this._a("overlayTextVerticalPadding", this.i.yk);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.yb;
},
set: function (v) {
this.i.yb = +v;
this._a("overlayTextAngle", this.i.yb);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextColor", {
/**
* Gets or sets the color the overlay text.
*/
get: function () {
return brushToString(this.i.aa5);
},
set: function (v) {
this.i.aa5 = stringToBrush(v);
this._a("overlayTextColor", brushToString(this.i.aa5));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextBackground", {
/**
* Gets or sets the background the overlay text.
*/
get: function () {
return brushToString(this.i.aa3);
},
set: function (v) {
this.i.aa3 = stringToBrush(v);
this._a("overlayTextBackground", brushToString(this.i.aa3));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextBorderColor", {
/**
* Gets or sets the border stroke of the overlay text.
*/
get: function () {
return brushToString(this.i.aa4);
},
set: function (v) {
this.i.aa4 = stringToBrush(v);
this._a("overlayTextBorderColor", brushToString(this.i.aa4));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextBorderRadius", {
/**
* Gets or sets the border corner of the overlay text.
*/
get: function () {
return this.i.yd;
},
set: function (v) {
this.i.yd = +v;
this._a("overlayTextBorderRadius", this.i.yd);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextBorderThickness", {
/**
* Gets or sets the border thickness of the overlay text.
*/
get: function () {
return this.i.yf;
},
set: function (v) {
this.i.yf = +v;
this._a("overlayTextBorderThickness", this.i.yf);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextVisible", {
/**
* Gets or sets whether the overlay text is visible in shape of data annotation
*/
get: function () {
return this.i.xy;
},
set: function (v) {
this.i.xy = ensureBool(v);
this._a("overlayTextVisible", this.i.xy);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayText", {
/**
* Gets or sets the text that will be displayed as the overlay annotation.
*/
get: function () {
return this.i.y7;
},
set: function (v) {
this.i.y7 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.yg;
},
set: function (v) {
this.i.yg = +v;
this._a("overlayTextColorShift", this.i.yg);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.xl;
},
set: function (v) {
this.i.xl = ensureEnum(AnnotationAppearanceMode_$type, v);
this._a("overlayTextColorMode", enumToString(AnnotationAppearanceMode_$type, this.i.xl));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextColorMatchLayer", {
/**
* Gets or sets whether the overlay text color matches brush of the layer
*/
get: function () {
return this.i.xx;
},
set: function (v) {
this.i.xx = ensureBool(v);
this._a("overlayTextColorMatchLayer", this.i.xx);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.yc;
},
set: function (v) {
this.i.yc = +v;
this._a("overlayTextBackgroundShift", this.i.yc);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.xj;
},
set: function (v) {
this.i.xj = ensureEnum(AnnotationAppearanceMode_$type, v);
this._a("overlayTextBackgroundMode", enumToString(AnnotationAppearanceMode_$type, this.i.xj));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextBackgroundMatchLayer", {
/**
* Gets or sets whether the overlay text background matches brush of the layer
*/
get: function () {
return this.i.xv;
},
set: function (v) {
this.i.xv = ensureBool(v);
this._a("overlayTextBackgroundMatchLayer", this.i.xv);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.ye;
},
set: function (v) {
this.i.ye = +v;
this._a("overlayTextBorderShift", this.i.ye);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.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.xk;
},
set: function (v) {
this.i.xk = ensureEnum(AnnotationAppearanceMode_$type, v);
this._a("overlayTextBorderMode", enumToString(AnnotationAppearanceMode_$type, this.i.xk));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextBorderMatchLayer", {
/**
* Gets or sets whether the overlay text border matches brush of the layer
*/
get: function () {
return this.i.xw;
},
set: function (v) {
this.i.xw = ensureBool(v);
this._a("overlayTextBorderMatchLayer", this.i.xw);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcValueOverlayComponent.prototype, "overlayTextStyle", {
/**
* Gets or Sets the style to use for the display text.
*/
get: function () {
if (this.i.xt == null) {
return null;
}
return this.i.xt.fontString;
},
set: function (v) {
var fi = new FontInfo();
fi.fontString = v;
this.i.xt = fi;
this._a("overlayTextStyle", this.i.xt != null ? this.i.xt.fontString : "");
},
enumerable: false,
configurable: true
});
IgcValueOverlayComponent.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];
}
}
};
IgcValueOverlayComponent.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;
};
IgcValueOverlayComponent.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;
};
IgcValueOverlayComponent.prototype.getSeriesValue = function (world, useInterpolation, skipUnknowns) {
var iv = this.i.jd(toPoint(world), useInterpolation, skipUnknowns);
return (iv);
};
IgcValueOverlayComponent.prototype.getSeriesValuePosition = function (world, useInterpolation, skipUnknowns) {
var iv = this.i.ww(toPoint(world), useInterpolation, skipUnknowns);
return fromPoint(iv);
};
/**
* Gets the item index associated with the specified world position
* @param world
*/
IgcValueOverlayComponent.prototype.getItemIndex = function (world) {
var iv = this.i.kc(toPoint(world));
return (iv);
};
/**
* Gets the item that is the best match for the specified world coordinates.
* @param world * The world coordinates to use.
*/
IgcValueOverlayComponent.prototype.getItem = function (world) {
var iv = this.i.kw(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.
*/
IgcValueOverlayComponent.prototype.scrollIntoView = function (item) {
var iv = this.i.gj(item);
return (iv);
};
/**
* Gets the label for a data item.
* @param value * The unscaled value to get a label for.
*/
IgcValueOverlayComponent.prototype.getLabel = function (value) {
var iv = this.i.y4(value);
return (iv);
};
Object.defineProperty(IgcValueOverlayComponent.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 IgcOverlayTextUpdatingEventArgs();
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
});
IgcValueOverlayComponent._observedAttributesIgcValueOverlayComponent = null;
IgcValueOverlayComponent.htmlTagName = "igc-value-overlay";
IgcValueOverlayComponent._isElementRegistered = false;
return IgcValueOverlayComponent;
}(IgcSeriesComponent));