UNPKG

igniteui-webcomponents-charts

Version:

Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.

743 lines (742 loc) 28.5 kB
import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core"; import { ValueLayerValueMode_$type } from "./ValueLayerValueMode"; import { IgcSeriesComponent } from "./igc-series-component"; 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 { IgcAnnotationLayerComponent } from "./igc-annotation-layer-component"; import { ValueLayer } from "./ValueLayer"; import { getAllPropertyNames, toSpinal, ensureBool, ensureEnum, enumToString, brushToString, stringToBrush, toPoint } from "igniteui-webcomponents-core"; import { RegisterElementHelper } from "igniteui-webcomponents-core"; import { FontInfo } from "igniteui-webcomponents-core"; let IgcValueLayerComponent = /*@__PURE__*/ (() => { class IgcValueLayerComponent extends IgcAnnotationLayerComponent { createImplementation() { return new ValueLayer(); } /** * @hidden */ get i() { return this._implementation; } constructor() { super(); this._targetSeriesName = null; this._targetAxisName = 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 (IgcValueLayerComponent._observedAttributesIgcValueLayerComponent == null) { let names = getAllPropertyNames(IgcValueLayerComponent); for (let i = 0; i < names.length; i++) { names[i] = toSpinal(names[i]); } IgcValueLayerComponent._observedAttributesIgcValueLayerComponent = names; } return IgcValueLayerComponent._observedAttributesIgcValueLayerComponent; } static register() { if (!IgcValueLayerComponent._isElementRegistered) { IgcValueLayerComponent._isElementRegistered = true; RegisterElementHelper.registerElement(IgcValueLayerComponent.htmlTagName, IgcValueLayerComponent); } } /** * Gets whether the series is an crosshair annotation layer. */ get isAnnotationValueLayer() { return this.i.ew; } /** * Gets or sets the value mode for the overlay. */ get valueMode() { return this.i.aa5; } set valueMode(v) { this.i.aa5 = ensureEnum(ValueLayerValueMode_$type, v); this._a("valueMode", enumToString(ValueLayerValueMode_$type, this.i.aa5)); } /** * Gets or sets the color to use for the horizontal line. Leave null for an automatic value. */ get horizontalLineStroke() { return brushToString(this.i.afi); } set horizontalLineStroke(v) { this.i.afi = stringToBrush(v); this._a("horizontalLineStroke", brushToString(this.i.afi)); } /** * Gets or sets the color to use for vertical line. Leave null for an automatic value. */ get verticalLineStroke() { return brushToString(this.i.afm); } set verticalLineStroke(v) { this.i.afm = stringToBrush(v); this._a("verticalLineStroke", brushToString(this.i.afm)); } /** * Gets or sets the series to target this annotation to. If null, this annotation targets all series simultaneously. */ get targetSeries() { const r = this.i.aa3; if (r == null) { return null; } if (!r.externalObject) { let e = IgcSeriesComponent._createFromInternal(r); if (e) { e._implementation = r; } r.externalObject = e; } return r.externalObject; } set targetSeries(v) { if (v != null && this._stylingContainer && v._styling) v._styling(this._stylingContainer, this, this); v == null ? this.i.aa3 = null : this.i.aa3 = v.i; } /** * Gets or sets the name to use to resolve targetSeries from markup. */ get targetSeriesName() { return this._targetSeriesName; } set targetSeriesName(v) { this._targetSeriesName = v; } /** * Gets or sets the axis to target this annotation to. If null, this annotation targets all value axis simultaneously. */ get targetAxis() { const r = this.i.aaw; 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 targetAxis(v) { if (v != null && this._stylingContainer && v._styling) v._styling(this._stylingContainer, this, this); v == null ? this.i.aaw = null : this.i.aaw = v.i; } /** * Gets or sets the name to use to resolve targetAxis from markup. */ get targetAxisName() { return this._targetAxisName; } set targetAxisName(v) { this._targetAxisName = v; } /** * Gets or sets whether to use value interpolation when drawing a line through the best value for the cursor position. */ get useInterpolation() { return this.i.abg; } set useInterpolation(v) { this.i.abg = ensureBool(v); this._a("useInterpolation", this.i.abg); } /** * Gets or sets whether to draw annotations over the axes where the crosshair meets with them. */ get isAxisAnnotationEnabled() { return this.i.aa9; } set isAxisAnnotationEnabled(v) { this.i.aa9 = ensureBool(v); this._a("isAxisAnnotationEnabled", this.i.aa9); } /** * Sets or gets a function which takes an object that produces a formatted label for the x axis annotation. */ get xAxisAnnotationFormatLabel() { return this.i.aax; } set xAxisAnnotationFormatLabel(v) { this.i.aax = v; } /** * Sets or gets a function which takes an object that produces a formatted label for the y axis annotation. */ get yAxisAnnotationFormatLabel() { return this.i.aay; } set yAxisAnnotationFormatLabel(v) { this.i.aay = v; } /** * Gets or sets the color to use for the x axis annotation text. Leave unset for an automatic value. */ get xAxisAnnotationTextColor() { return brushToString(this.i.afp); } set xAxisAnnotationTextColor(v) { this.i.afp = stringToBrush(v); this._a("xAxisAnnotationTextColor", brushToString(this.i.afp)); } /** * Gets or sets the color to use for the x axis annotation backing. Leave unset for an automatic value. */ get xAxisAnnotationBackground() { return brushToString(this.i.afn); } set xAxisAnnotationBackground(v) { this.i.afn = stringToBrush(v); this._a("xAxisAnnotationBackground", brushToString(this.i.afn)); } /** * Gets or sets the corner radius to use for the x axis annotation backing. Leave unset for an automatic value. */ get xAxisAnnotationBackgroundCornerRadius() { return this.i.abt; } set xAxisAnnotationBackgroundCornerRadius(v) { this.i.abt = +v; this._a("xAxisAnnotationBackgroundCornerRadius", this.i.abt); } /** * Gets or sets the precision to use displaying values for interpolated crosshair positions. */ get xAxisAnnotationInterpolatedValuePrecision() { return this.i.ab5; } set xAxisAnnotationInterpolatedValuePrecision(v) { this.i.ab5 = +v; this._a("xAxisAnnotationInterpolatedValuePrecision", this.i.ab5); } /** * Gets or sets the color to use for the x axis annotation outline. Leave unset for an automatic value. */ get xAxisAnnotationOutline() { return brushToString(this.i.afo); } set xAxisAnnotationOutline(v) { this.i.afo = stringToBrush(v); this._a("xAxisAnnotationOutline", brushToString(this.i.afo)); } /** * 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 xAxisAnnotationPaddingLeft() { return this.i.abv; } set xAxisAnnotationPaddingLeft(v) { this.i.abv = +v; this._a("xAxisAnnotationPaddingLeft", this.i.abv); } /** * 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 xAxisAnnotationPaddingTop() { return this.i.abx; } set xAxisAnnotationPaddingTop(v) { this.i.abx = +v; this._a("xAxisAnnotationPaddingTop", this.i.abx); } /** * 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 xAxisAnnotationPaddingRight() { return this.i.abw; } set xAxisAnnotationPaddingRight(v) { this.i.abw = +v; this._a("xAxisAnnotationPaddingRight", this.i.abw); } /** * 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 xAxisAnnotationPaddingBottom() { return this.i.abu; } set xAxisAnnotationPaddingBottom(v) { this.i.abu = +v; this._a("xAxisAnnotationPaddingBottom", this.i.abu); } /** * 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 yAxisAnnotationPaddingLeft() { return this.i.ab1; } set yAxisAnnotationPaddingLeft(v) { this.i.ab1 = +v; this._a("yAxisAnnotationPaddingLeft", this.i.ab1); } /** * 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 yAxisAnnotationPaddingTop() { return this.i.ab3; } set yAxisAnnotationPaddingTop(v) { this.i.ab3 = +v; this._a("yAxisAnnotationPaddingTop", this.i.ab3); } /** * 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 yAxisAnnotationPaddingRight() { return this.i.ab2; } set yAxisAnnotationPaddingRight(v) { this.i.ab2 = +v; this._a("yAxisAnnotationPaddingRight", this.i.ab2); } /** * 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 yAxisAnnotationPaddingBottom() { return this.i.ab0; } set yAxisAnnotationPaddingBottom(v) { this.i.ab0 = +v; this._a("yAxisAnnotationPaddingBottom", this.i.ab0); } /** * Gets or sets the stroke thickness for the x axis annotation backing. Leave unset for an automatic value. */ get xAxisAnnotationStrokeThickness() { return this.i.aby; } set xAxisAnnotationStrokeThickness(v) { this.i.aby = +v; this._a("xAxisAnnotationStrokeThickness", this.i.aby); } /** * Gets or sets the color to use for the y axis annotation text. Leave unset for an automatic value. */ get yAxisAnnotationTextColor() { return brushToString(this.i.afs); } set yAxisAnnotationTextColor(v) { this.i.afs = stringToBrush(v); this._a("yAxisAnnotationTextColor", brushToString(this.i.afs)); } /** * Gets or sets the color to use for the y axis annotation backing. Leave unset for an automatic value. */ get yAxisAnnotationBackground() { return brushToString(this.i.afq); } set yAxisAnnotationBackground(v) { this.i.afq = stringToBrush(v); this._a("yAxisAnnotationBackground", brushToString(this.i.afq)); } /** * Gets or sets the corner radius to use for the y axis annotation backing. Leave unset for an automatic value. */ get yAxisAnnotationBackgroundCornerRadius() { return this.i.abz; } set yAxisAnnotationBackgroundCornerRadius(v) { this.i.abz = +v; this._a("yAxisAnnotationBackgroundCornerRadius", this.i.abz); } /** * Gets or sets the precision to use displaying values for interpolated crosshair positions. */ get yAxisAnnotationInterpolatedValuePrecision() { return this.i.ab6; } set yAxisAnnotationInterpolatedValuePrecision(v) { this.i.ab6 = +v; this._a("yAxisAnnotationInterpolatedValuePrecision", this.i.ab6); } /** * Gets or sets the color to use for the y axis annotation outline. Leave unset for an automatic value. */ get yAxisAnnotationOutline() { return brushToString(this.i.afr); } set yAxisAnnotationOutline(v) { this.i.afr = stringToBrush(v); this._a("yAxisAnnotationOutline", brushToString(this.i.afr)); } /** * Gets or sets the stroke thickness for the y axis annotation backing. Leave unset for an automatic value. */ get yAxisAnnotationStrokeThickness() { return this.i.ab4; } set yAxisAnnotationStrokeThickness(v) { this.i.ab4 = +v; this._a("yAxisAnnotationStrokeThickness", this.i.ab4); } /** * Gets or sets whether to skip unknown values when searching for series values. */ get skipUnknownValues() { return this.i.abf; } set skipUnknownValues(v) { this.i.abf = ensureBool(v); this._a("skipUnknownValues", this.i.abf); } /** * Gets or sets location of the overlay text in relation to shape of data annotation. */ get overlayTextLocation() { return this.i.aaz; } set overlayTextLocation(v) { this.i.aaz = ensureEnum(OverlayTextLocation_$type, v); this._a("overlayTextLocation", enumToString(OverlayTextLocation_$type, this.i.aaz)); } /** * Gets or sets the horizontal margin of the overlay text in relation to shape of data annotation. */ get overlayTextHorizontalMargin() { return this.i.abp; } set overlayTextHorizontalMargin(v) { this.i.abp = +v; this._a("overlayTextHorizontalMargin", this.i.abp); } /** * Gets or sets the vertical margin of the overlay text in relation to shape of data annotation. */ get overlayTextVerticalMargin() { return this.i.abr; } set overlayTextVerticalMargin(v) { this.i.abr = +v; this._a("overlayTextVerticalMargin", this.i.abr); } /** * Gets or sets the horizontal padding of the overlay text in relation to shape of data annotation. */ get overlayTextHorizontalPadding() { return this.i.abq; } set overlayTextHorizontalPadding(v) { this.i.abq = +v; this._a("overlayTextHorizontalPadding", this.i.abq); } /** * Gets or sets the vertical padding of the overlay text in relation to shape of data annotation. */ get overlayTextVerticalPadding() { return this.i.abs; } set overlayTextVerticalPadding(v) { this.i.abs = +v; this._a("overlayTextVerticalPadding", this.i.abs); } /** * Gets or sets the angle rotation (in degrees) of the overlay text in relation to shape of data annotation. */ get overlayTextAngle() { return this.i.abj; } set overlayTextAngle(v) { this.i.abj = +v; this._a("overlayTextAngle", this.i.abj); } /** * Gets or sets the color the overlay text. */ get overlayTextColor() { return brushToString(this.i.afl); } set overlayTextColor(v) { this.i.afl = stringToBrush(v); this._a("overlayTextColor", brushToString(this.i.afl)); } /** * Gets or sets the background the overlay text. */ get overlayTextBackground() { return brushToString(this.i.afj); } set overlayTextBackground(v) { this.i.afj = stringToBrush(v); this._a("overlayTextBackground", brushToString(this.i.afj)); } /** * Gets or sets the border stroke of the overlay text. */ get overlayTextBorderColor() { return brushToString(this.i.afk); } set overlayTextBorderColor(v) { this.i.afk = stringToBrush(v); this._a("overlayTextBorderColor", brushToString(this.i.afk)); } /** * Gets or sets the border corner of the overlay text. */ get overlayTextBorderRadius() { return this.i.abl; } set overlayTextBorderRadius(v) { this.i.abl = +v; this._a("overlayTextBorderRadius", this.i.abl); } /** * Gets or sets the border thickness of the overlay text. */ get overlayTextBorderThickness() { return this.i.abn; } set overlayTextBorderThickness(v) { this.i.abn = +v; this._a("overlayTextBorderThickness", this.i.abn); } /** * Gets or sets whether the overlay text is visible in shape of data annotation */ get overlayTextVisible() { return this.i.abe; } set overlayTextVisible(v) { this.i.abe = ensureBool(v); this._a("overlayTextVisible", this.i.abe); } /** * Gets or sets the text that will be displayed as the overlay annotation. */ get overlayText() { return this.i.acb; } set overlayText(v) { this.i.acb = 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.abo; } set overlayTextColorShift(v) { this.i.abo = +v; this._a("overlayTextColorShift", this.i.abo); } /** * Gets or sets the mode used for shifting the background of overlay text based on the target series. */ get overlayTextColorMode() { return this.i.aav; } set overlayTextColorMode(v) { this.i.aav = ensureEnum(AnnotationAppearanceMode_$type, v); this._a("overlayTextColorMode", enumToString(AnnotationAppearanceMode_$type, this.i.aav)); } /** * Gets or sets whether the overlay text color matches brush of the layer */ get overlayTextColorMatchLayer() { return this.i.abd; } set overlayTextColorMatchLayer(v) { this.i.abd = ensureBool(v); this._a("overlayTextColorMatchLayer", this.i.abd); } /** * 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.abk; } set overlayTextBackgroundShift(v) { this.i.abk = +v; this._a("overlayTextBackgroundShift", this.i.abk); } /** * Gets or sets the mode used for shifting the background of overlay text based on the target series. */ get overlayTextBackgroundMode() { return this.i.aat; } set overlayTextBackgroundMode(v) { this.i.aat = ensureEnum(AnnotationAppearanceMode_$type, v); this._a("overlayTextBackgroundMode", enumToString(AnnotationAppearanceMode_$type, this.i.aat)); } /** * Gets or sets whether the overlay text background matches brush of the layer */ get overlayTextBackgroundMatchLayer() { return this.i.abb; } set overlayTextBackgroundMatchLayer(v) { this.i.abb = ensureBool(v); this._a("overlayTextBackgroundMatchLayer", this.i.abb); } /** * 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.abm; } set overlayTextBorderShift(v) { this.i.abm = +v; this._a("overlayTextBorderShift", this.i.abm); } /** * Gets or sets the mode used for shifting the border of overlay text based on the target series. */ get overlayTextBorderMode() { return this.i.aau; } set overlayTextBorderMode(v) { this.i.aau = ensureEnum(AnnotationAppearanceMode_$type, v); this._a("overlayTextBorderMode", enumToString(AnnotationAppearanceMode_$type, this.i.aau)); } /** * Gets or sets whether the overlay text border matches brush of the layer */ get overlayTextBorderMatchLayer() { return this.i.abc; } set overlayTextBorderMatchLayer(v) { this.i.abc = ensureBool(v); this._a("overlayTextBorderMatchLayer", this.i.abc); } /** * Gets or Sets the style to use for the display text. */ get overlayTextStyle() { if (this.i.aa8 == null) { return null; } return this.i.aa8.fontString; } set overlayTextStyle(v) { let fi = new FontInfo(); fi.fontString = v; this.i.aa8 = fi; this._a("overlayTextStyle", this.i.aa8 != null ? this.i.aa8.fontString : ""); } /** * Gets the effective brush for the current value layer. Can be null for value * modes that target multiple series. */ get actualValueLayerBrush() { return brushToString(this.i.afh); } set actualValueLayerBrush(v) { this.i.afh = stringToBrush(v); this._a("actualValueLayerBrush", brushToString(this.i.afh)); } get isSummarizationSupported() { return this.i.isSummarizationSupported; } bindSeries(series) { super.bindSeries(series); for (let i = 0; i < series.length; i++) { if (this.targetSeriesName && this.targetSeriesName.length > 0 && series[i].name == this.targetSeriesName) { this.targetSeries = series[i]; } } } bindAxes(axes) { super.bindAxes(axes); for (let i = 0; i < axes.length; i++) { if (this.targetAxisName && this.targetAxisName.length > 0 && axes[i].name == this.targetAxisName) { this.targetAxis = axes[i]; } } } findByName(name) { var baseResult = super.findByName(name); if (baseResult) { return baseResult; } if (this.targetSeries && this.targetSeries.name && this.targetSeries.name == name) { return this.targetSeries; } if (this.targetAxis && this.targetAxis.name && this.targetAxis.name == name) { return this.targetAxis; } return null; } _styling(container, component, parent) { super._styling(container, component, parent); this._inStyling = true; if (this.targetSeries && this.targetSeries._styling) { this.targetSeries._styling(container, component, this); } if (this.targetAxis && this.targetAxis._styling) { this.targetAxis._styling(container, component, this); } this._inStyling = false; } getSeriesValue(world, useInterpolation, skipUnknowns) { let iv = this.i.jd(toPoint(world), useInterpolation, skipUnknowns); 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); ; } } IgcValueLayerComponent._observedAttributesIgcValueLayerComponent = null; IgcValueLayerComponent.htmlTagName = "igc-value-layer"; IgcValueLayerComponent._isElementRegistered = false; return IgcValueLayerComponent; })(); export { IgcValueLayerComponent };