igniteui-webcomponents-charts
Version:
Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.
576 lines (571 loc) • 21.3 kB
JavaScript
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 let IgcValueOverlayComponent = /*@__PURE__*/ (() => {
class IgcValueOverlayComponent extends IgcSeriesComponent {
createImplementation() {
return new ValueOverlay();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor() {
super();
this._axisName = null;
this._stylingOverlayText = null;
this._stylingOverlayText_wrapped = null;
}
connectedCallback() {
if (super["connectedCallback"]) {
super["connectedCallback"]();
}
if (this.i.connectedCallback) {
this.i.connectedCallback();
}
if (!this._attached) {
this._attached = true;
this._flushQueuedAttributes();
}
}
disconnectedCallback() {
if (super["disconnectedCallback"]) {
super["disconnectedCallback"]();
}
if (this.i.disconnectedCallback) {
this.i.disconnectedCallback();
}
if (this._attached) {
this._attached = false;
}
}
static get observedAttributes() {
if (IgcValueOverlayComponent._observedAttributesIgcValueOverlayComponent == null) {
let names = getAllPropertyNames(IgcValueOverlayComponent);
for (let i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcValueOverlayComponent._observedAttributesIgcValueOverlayComponent = names;
}
return IgcValueOverlayComponent._observedAttributesIgcValueOverlayComponent;
}
static register() {
if (!IgcValueOverlayComponent._isElementRegistered) {
IgcValueOverlayComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcValueOverlayComponent.htmlTagName, IgcValueOverlayComponent);
}
}
/**
* Gets or sets the axis used by the value overlay.
*/
get axis() {
const r = this.i.w6;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = IgcAxisComponent._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
}
set axis(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;
}
/**
* Gets or sets the name to use to resolve axis from markup.
*/
get axisName() {
return this._axisName;
}
set axisName(v) {
this._axisName = v;
}
/**
* Gets or sets the value of the overlay.
*/
get value() {
return this.i.x7;
}
set value(v) {
this.i.x7 = +v;
this._a("value", this.i.x7);
}
/**
* Gets or sets whether to draw annotations over the axes where the crosshair meets with them.
*/
get isAxisAnnotationEnabled() {
return this.i.xe;
}
set isAxisAnnotationEnabled(v) {
this.i.xe = ensureBool(v);
this._a("isAxisAnnotationEnabled", this.i.xe);
}
/**
* Sets or gets a function which takes an object that produces a formatted label for the axis annotation.
*/
get axisAnnotationFormatLabel() {
return this.i.w8;
}
set axisAnnotationFormatLabel(v) {
this.i.w8 = v;
}
/**
* Gets or sets the color to use for the axis annotation text. Leave unset for an automatic value.
*/
get axisAnnotationTextColor() {
return brushToString(this.i.aai);
}
set axisAnnotationTextColor(v) {
this.i.aai = stringToBrush(v);
this._a("axisAnnotationTextColor", brushToString(this.i.aai));
}
/**
* Gets or sets the color to use for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationBackground() {
return brushToString(this.i.aag);
}
set axisAnnotationBackground(v) {
this.i.aag = stringToBrush(v);
this._a("axisAnnotationBackground", brushToString(this.i.aag));
}
/**
* Gets or sets the corner radius to use for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationBackgroundCornerRadius() {
return this.i.xm;
}
set axisAnnotationBackgroundCornerRadius(v) {
this.i.xm = +v;
this._a("axisAnnotationBackgroundCornerRadius", this.i.xm);
}
/**
* Gets or sets the precision to use displaying values for interpolated positions.
*/
get axisAnnotationInterpolatedValuePrecision() {
return this.i.x8;
}
set axisAnnotationInterpolatedValuePrecision(v) {
this.i.x8 = +v;
this._a("axisAnnotationInterpolatedValuePrecision", this.i.x8);
}
/**
* Gets or sets the color to use for the axis annotation outline. Leave unset for an automatic value.
*/
get axisAnnotationOutline() {
return brushToString(this.i.aah);
}
set axisAnnotationOutline(v) {
this.i.aah = stringToBrush(v);
this._a("axisAnnotationOutline", brushToString(this.i.aah));
}
/**
* 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 axisAnnotationPaddingLeft() {
return this.i.xo;
}
set axisAnnotationPaddingLeft(v) {
this.i.xo = +v;
this._a("axisAnnotationPaddingLeft", this.i.xo);
}
/**
* 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 axisAnnotationPaddingTop() {
return this.i.xq;
}
set axisAnnotationPaddingTop(v) {
this.i.xq = +v;
this._a("axisAnnotationPaddingTop", this.i.xq);
}
/**
* 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 axisAnnotationPaddingRight() {
return this.i.xp;
}
set axisAnnotationPaddingRight(v) {
this.i.xp = +v;
this._a("axisAnnotationPaddingRight", this.i.xp);
}
/**
* 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 axisAnnotationPaddingBottom() {
return this.i.xn;
}
set axisAnnotationPaddingBottom(v) {
this.i.xn = +v;
this._a("axisAnnotationPaddingBottom", this.i.xn);
}
/**
* Gets or sets the stroke thickness for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationStrokeThickness() {
return this.i.xr;
}
set axisAnnotationStrokeThickness(v) {
this.i.xr = +v;
this._a("axisAnnotationStrokeThickness", this.i.xr);
}
/**
* Gets whether the series is a value overlay.
*/
get isValueOverlay() {
return this.i.isValueOverlay;
}
get labelResolved() {
return this.i.yn;
}
/**
* Gets or sets location of the overlay text in relation to shape of data annotation.
*/
get overlayTextLocation() {
return this.i.w9;
}
set overlayTextLocation(v) {
this.i.w9 = ensureEnum(OverlayTextLocation_$type, v);
this._a("overlayTextLocation", enumToString(OverlayTextLocation_$type, this.i.w9));
}
/**
* Gets or sets the horizontal margin of the overlay text in relation to shape of data annotation.
*/
get overlayTextHorizontalMargin() {
return this.i.x0;
}
set overlayTextHorizontalMargin(v) {
this.i.x0 = +v;
this._a("overlayTextHorizontalMargin", this.i.x0);
}
/**
* Gets or sets the vertical margin of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalMargin() {
return this.i.x2;
}
set overlayTextVerticalMargin(v) {
this.i.x2 = +v;
this._a("overlayTextVerticalMargin", this.i.x2);
}
/**
* Gets or sets the horizontal padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextHorizontalPadding() {
return this.i.x1;
}
set overlayTextHorizontalPadding(v) {
this.i.x1 = +v;
this._a("overlayTextHorizontalPadding", this.i.x1);
}
/**
* Gets or sets the vertical padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalPadding() {
return this.i.x3;
}
set overlayTextVerticalPadding(v) {
this.i.x3 = +v;
this._a("overlayTextVerticalPadding", this.i.x3);
}
/**
* Gets or sets the angle rotation (in degrees) of the overlay text in relation to shape of data annotation.
*/
get overlayTextAngle() {
return this.i.xu;
}
set overlayTextAngle(v) {
this.i.xu = +v;
this._a("overlayTextAngle", this.i.xu);
}
/**
* Gets or sets the color the overlay text.
*/
get overlayTextColor() {
return brushToString(this.i.aal);
}
set overlayTextColor(v) {
this.i.aal = stringToBrush(v);
this._a("overlayTextColor", brushToString(this.i.aal));
}
/**
* Gets or sets the background the overlay text.
*/
get overlayTextBackground() {
return brushToString(this.i.aaj);
}
set overlayTextBackground(v) {
this.i.aaj = stringToBrush(v);
this._a("overlayTextBackground", brushToString(this.i.aaj));
}
/**
* Gets or sets the border stroke of the overlay text.
*/
get overlayTextBorderColor() {
return brushToString(this.i.aak);
}
set overlayTextBorderColor(v) {
this.i.aak = stringToBrush(v);
this._a("overlayTextBorderColor", brushToString(this.i.aak));
}
/**
* Gets or sets the border corner of the overlay text.
*/
get overlayTextBorderRadius() {
return this.i.xw;
}
set overlayTextBorderRadius(v) {
this.i.xw = +v;
this._a("overlayTextBorderRadius", this.i.xw);
}
/**
* Gets or sets the border thickness of the overlay text.
*/
get overlayTextBorderThickness() {
return this.i.xy;
}
set overlayTextBorderThickness(v) {
this.i.xy = +v;
this._a("overlayTextBorderThickness", this.i.xy);
}
/**
* Gets or sets whether the overlay text is visible in shape of data annotation
*/
get overlayTextVisible() {
return this.i.xi;
}
set overlayTextVisible(v) {
this.i.xi = ensureBool(v);
this._a("overlayTextVisible", this.i.xi);
}
/**
* Gets or sets the text that will be displayed as the overlay annotation.
*/
get overlayText() {
return this.i.yo;
}
set overlayText(v) {
this.i.yo = v;
}
/**
* 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 overlayTextColorShift() {
return this.i.xz;
}
set overlayTextColorShift(v) {
this.i.xz = +v;
this._a("overlayTextColorShift", this.i.xz);
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextColorMode() {
return this.i.w5;
}
set overlayTextColorMode(v) {
this.i.w5 = ensureEnum(AnnotationAppearanceMode_$type, v);
this._a("overlayTextColorMode", enumToString(AnnotationAppearanceMode_$type, this.i.w5));
}
/**
* Gets or sets whether the overlay text color matches brush of the layer
*/
get overlayTextColorMatchLayer() {
return this.i.xh;
}
set overlayTextColorMatchLayer(v) {
this.i.xh = ensureBool(v);
this._a("overlayTextColorMatchLayer", this.i.xh);
}
/**
* 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 overlayTextBackgroundShift() {
return this.i.xv;
}
set overlayTextBackgroundShift(v) {
this.i.xv = +v;
this._a("overlayTextBackgroundShift", this.i.xv);
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextBackgroundMode() {
return this.i.w3;
}
set overlayTextBackgroundMode(v) {
this.i.w3 = ensureEnum(AnnotationAppearanceMode_$type, v);
this._a("overlayTextBackgroundMode", enumToString(AnnotationAppearanceMode_$type, this.i.w3));
}
/**
* Gets or sets whether the overlay text background matches brush of the layer
*/
get overlayTextBackgroundMatchLayer() {
return this.i.xf;
}
set overlayTextBackgroundMatchLayer(v) {
this.i.xf = ensureBool(v);
this._a("overlayTextBackgroundMatchLayer", this.i.xf);
}
/**
* 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 overlayTextBorderShift() {
return this.i.xx;
}
set overlayTextBorderShift(v) {
this.i.xx = +v;
this._a("overlayTextBorderShift", this.i.xx);
}
/**
* Gets or sets the mode used for shifting the border of overlay text based on the target series.
*/
get overlayTextBorderMode() {
return this.i.w4;
}
set overlayTextBorderMode(v) {
this.i.w4 = ensureEnum(AnnotationAppearanceMode_$type, v);
this._a("overlayTextBorderMode", enumToString(AnnotationAppearanceMode_$type, this.i.w4));
}
/**
* Gets or sets whether the overlay text border matches brush of the layer
*/
get overlayTextBorderMatchLayer() {
return this.i.xg;
}
set overlayTextBorderMatchLayer(v) {
this.i.xg = ensureBool(v);
this._a("overlayTextBorderMatchLayer", this.i.xg);
}
/**
* Gets or Sets the style to use for the display text.
*/
get overlayTextStyle() {
if (this.i.xd == null) {
return null;
}
return this.i.xd.fontString;
}
set overlayTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.xd = fi;
this._a("overlayTextStyle", this.i.xd != null ? this.i.xd.fontString : "");
}
bindAxes(axes) {
super.bindAxes(axes);
for (let i = 0; i < axes.length; i++) {
if (this.axisName && this.axisName.length > 0 &&
axes[i].name == this.axisName) {
this.axis = axes[i];
}
}
}
findByName(name) {
var baseResult = super.findByName(name);
if (baseResult) {
return baseResult;
}
if (this.axis && this.axis.name && this.axis.name == name) {
return this.axis;
}
return null;
}
_styling(container, component, parent) {
super._styling(container, component, parent);
this._inStyling = true;
if (this.axis && this.axis._styling) {
this.axis._styling(container, component, this);
}
this._inStyling = false;
}
getSeriesValue(world, useInterpolation, skipUnknowns) {
let iv = this.i.i6(toPoint(world), useInterpolation, skipUnknowns);
return (iv);
}
getSeriesValuePosition(world, useInterpolation, skipUnknowns) {
let iv = this.i.wh(toPoint(world), useInterpolation, skipUnknowns);
return fromPoint(iv);
}
/**
* Gets the item index associated with the specified world position
* @param world
*/
getItemIndex(world) {
let 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.
*/
getItem(world) {
let 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.
*/
scrollIntoView(item) {
let iv = this.i.ge(item);
return (iv);
}
/**
* Gets the label for a data item.
* @param value * The unscaled value to get a label for.
*/
getLabel(value) {
let iv = this.i.yl(value);
return (iv);
}
/**
* Event raised when updating style of overlay text
*/
get stylingOverlayText() {
return this._stylingOverlayText;
}
set stylingOverlayText(ev) {
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 = (o, e) => {
let 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);
;
}
}
IgcValueOverlayComponent._observedAttributesIgcValueOverlayComponent = null;
IgcValueOverlayComponent.htmlTagName = "igc-value-overlay";
IgcValueOverlayComponent._isElementRegistered = false;
return IgcValueOverlayComponent;
})();